Magento 2 Payment API: Make Payment Using REST API

In this post, I will explain to you step-by-step methods to pay for any product through Magento 2 Payment API.

While making payment you can select the payment method like if you want to make cash on delivery (COD) payment then which API will be hit or if you want to make cash memo payment then which rest API will be used for that.

Through this post, we will also know that if you want to make a PayPal payment, then which API will be used for that.

I am explaining below the details of the steps to use all these payment APIs.


Create Order from Admin Dashboard via REST API

If you want to create an order through rest API from Magento 2 Admin Dashboard, then you will also have to complete payment for that.

When your payment is complete, the newly created order will appear in this dashboard.

Create Order From Admin via REST API

You can create an order directly from the sales admin dashboard using this rest api.

Admin > Sales > Order > Create New Order


Magento 2 Payment API for Guest Customer

You have to execute the below-mentioned four REST APIs step by step then only you will be able to complete the payment for the guest customers.

Guest customers can select and pay through the available payment options.

You can make payment based on whatever payment method available in your store like cash on delivery case money order paper payment etc.

Step 1

Step 2

Step 3

Step 4

If you want to know the above four steps in detail, then you can see our separate post for guest cart PayPal payment steps.


Step 5: Check Money Order Payment REST API


Method: PUT


  • Content-type = application/json


{ "paymentMethod": { "method": "checkmo" } }
Magento 2 Payment API
Now if you will go into the admin dashboard section then you can see the order has been created.
Created order Via API in dashboard

Cash On Delivery Payment REST API in Magento 2

Now if you want to make cash on delivery payment, then for that you have to follow the above-mentioned four states similarly.

If the guest wants to checkout, the steps will remain the same.

If you want to check out for Login Customer, then you can check the add to cart for login customer rest API to see other steps of Login Customer.

This is a final step that can be used to make payment by making payment through Cas on Delivery payment option via API in Magento 2.


Method: POST


  • Content-type = application/json

Now if you hit the above rest API Magento 2 gives you the response as a list of available payment methods, along with the total cart and details.

Magento 2 Payment API



Method: PUT


{ "paymentMethod": { "method": "cashondelivery" } }

Cash on delivery payment via REST API




You can order the product for the guest customer and also complete the payment.

For this, you will need to hit at least four REST APIs, and based on the quote id, you can place the order of the product.


Read more: Magento 2.4 Installation Guide: How to Install Magento 2.4.2