I need to use the Magento REST API to create an order from an API. In my case, I am trying to implement the payment directly using API to Magento. What I need to do is to create an order by setting the payment method as a Paypal or can say RazorPay or any other 3rd Party Payment method and to perform a guest checkout. Which API(s) should I use to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2020
11:01 AM
07-09-2020
11:01 AM
Magento 2 - Create order using REST API - Third Party Payment Gateway such as Paypal or other 3rd pa
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2020
06:34 PM
07-09-2020
06:34 PM
Re: Magento 2 - Create order using REST API - Third Party Payment Gateway such as Paypal or other 3r
Hello @siddhant _jain
Request: {YOUR_URL}/rest/V1/orders/create
Type: PUT
Body:
{ "entity": { "base_currency_code": "USD", "base_discount_amount": -4.5, "base_grand_total": 45.5, "base_shipping_amount": 5, "base_subtotal": 45, "base_tax_amount": 0, "customer_email": "rakesh@rakeshjesadiya.com", "customer_firstname": "rakesh", "customer_group_id": 1, "customer_id": 2, "customer_is_guest": 0, "customer_lastname": "jesadiya", "customer_note_notify": 1, "discount_amount": -4.5, "email_sent": 1, "coupon_code": "Test1", "discount_description": "Test1", "grand_total": 45.5, "is_virtual": 0, "order_currency_code": "USD", "shipping_amount": 5, "shipping_description": "Flat Rate - Fixed", "state": "new", "status": "pending", "store_currency_code": "USD", "store_id": 1, "store_name": "Main Website\nMain Website Store\n", "subtotal": 45, "subtotal_incl_tax": 45, "tax_amount": 0, "total_item_count": 1, "total_qty_ordered": 1, "weight": 1, "items": [ { "base_discount_amount": 4.5, "base_original_price": 45, "base_price": 45, "base_price_incl_tax": 45, "base_row_invoiced": 0, "base_row_total": 45, "base_tax_amount": 0, "base_tax_invoiced": 0, "discount_amount": 4.5, "discount_percent": 10, "free_shipping": 0, "is_virtual": 0, "name": "Push It Messenger Bag", "original_price": 45, "price": 45, "price_incl_tax": 45, "product_id": 14, "product_type": "simple", "qty_ordered": 1, "row_total": 45, "row_total_incl_tax": 45, "sku": "24-WB04", "store_id": 1 } ], "billing_address": { "address_type": "billing", "city": "Ahmedabad", "company": "Rbj", "country_id": "US", "email": "rakesh@rakeshjesadiya.com", "firstname": "rakesh", "lastname": "jesadiya", "postcode": "30332", "region": "Georgia", "region_code": "GA", "region_id": 19, "street": [ "Street 1", "Street 2" ], "telephone": "123456" }, "payment": { "method": "cashondelivery" // Change payment method according to you }, "extension_attributes": { "shipping_assignments": [ { "shipping": { "address": { "address_type": "shipping", "city": "Ahmedabad", "company": "Rbj", "country_id": "US", "customer_address_id": 2, "email": "rakesh@rakeshjesadiya.com", "firstname": "rakesh", "lastname": "jesadiya", "postcode": "30332", "region": "Georgia", "region_code": "GA", "region_id": 19, "street": [ "Street 1", "Street 2" ], "telephone": "123456" }, "method": "flatrate_flatrate" } } ] } } }
Take reference from here :
Problem Solved ? Click on 'Kudos' & Accept as Solution !
