ZRPL
  • Welcome!
  • Quick Start
  • Reference
    • API Reference
      • Categories List
      • Category Details by ID
      • Create Simple Product
      • Config Product Creation
      • Product List
      • Update Existing Product
      • Product Details by SKU
      • Product Details by ID
      • Products in Category
      • Create Order
      • Order Details
      • Order History
      • Create Customer
      • Customer Token
      • Create Customer Cart
      • Add Item to Cart
      • View Cart
      • Update Cart
      • Delete Cart
      • Country Code
      • Set Shipping and Billing
      • Place Order
      • Customer Details
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Place Order

This API is offering to Place Simple Order.

POST {{Base_url}}/rest/V1/carts/mine/payment-information

This API is used to place an order in Magento by submitting the payment details and finalizing the cart as an order. It transitions the shopping cart to an order and assigns an order entity ID.

Body

{
  "paymentMethod": {
    "method": "razorpay"
  }
}
curl --location '{{Base_url}}/rest/V1/carts/mine/payment-information' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjIxMDAyNywidXR5cGlkIjozLCJpYXQiOjE3Mzc1MzczODUsImV4cCI6MTczNzU0MDk4NX0.l_L_v__xKmNkdXidfiI6AZsQ9pWMJMDUtjFJDKQwDnU' \
--header 'Cookie: PHPSESSID=2639naaq26nbe7st472kk4ms4i' \
--data '{
  "paymentMethod": {
    "method": "razorpay"
  }
}
'

The given cURL command is an API request to the Magento 2 platform for placing an order in a customer's shopping cart using the specified payment method. This request finalizes the cart and generates an order based on the cart details, shipping information, and payment method.

Attributes in Payload

  1. paymentMethod:

    • An object that defines the payment method for the order.

  2. method:

    • Value: "razorpay"

    • Specifies the code of the payment method being used.

    • Common values include:

      • "cashondelivery" for Cash on Delivery.

      • "cashfree" for Cashfree payment gateway.

      • "razorpay" for Razorpay payment gateway.


Purpose of the API

  1. Places the Order:

    • Finalizes the current cart (mine) by associating it with the payment method.

    • Converts the cart into a confirmed order in Magento.

  2. Processes Payment:

    • Initiates the payment process with the selected payment gateway (razorpay).

  3. Generates Order ID:

    • On success, the API responds with an order ID confirming the order placement.

237161

The response 237161 indicates that the order has been successfully placed, and the number represents the Entity ID.

{
    "message": "Current customer does not have an active cart."
}
{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "self"
    }
}
PreviousSet Shipping and BillingNextCustomer Details

Last updated 4 months ago