Magento – Process Payment Using Rest API In Magento 2

apimagento2paymentrest

I working on an APIs to create mobile application, everything worked ok,
now I need to pay for the mobile application using Magento 2 rest API.

how can I pay using rest API?

Is there any API available which can process payment and validate payments?

I am new to Magento, I need to pay using credit cards and debit cards using Magento default configurations.

It will be great if anyone can help,

Thanks

Best Answer

To process the payment you can use the native API of the payment method, but you can use these methods to get the payment methods available and to place an order in Magento using the REST API.

Get Payment Method

curl -g -X GET "XXXXX_STOREURL_XXXXX/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/payment-information" \
    -H "Authorization: Bearer XXXXX_TOKEN_XXXXX" 

Place Order

curl -g -X PUT "XXXXX_STOREURL_XXXXX/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/order" \
    -H "Authorization: Bearer XXXXX_TOKEN_XXXXX" \
    -H "Content-Type:application/json" \
     -d '
{
    "method": {
        "method": "checkmo"
    }
}
Related Topic