Magento – MAGENTO 2 REST API Checkout payment using credit card

magento2payment-gateway

I am trying to place an order using magento 2 rest api through credit card. I am calling the below api POST
rest/V1/guest-carts/{cartId}/payment-information(for guests) and rest/V1/carts/mine/payment-information using token(for customers). The payload request is

 "paymentMethod": {
     "method": "custom_pay",
        "additional_data":{  
             "cc_cid":"000"
             "cc_type":"VI",
             "cc_exp_year":"2017",
             "cc_exp_month":"2",
             "cc_number":"xxxxxxxxxxxxxxxx"
         }
 }

It throws a generic error saying, error processing the payment. Please try to place an order again. Can anyone please suggest how to process an order using magento rest api through credit cards. Thank you.

Best Answer

Please try the below code.

"paymentMethod": {
    "method": "custom_pay",
    "additional_information": {
        "cc_cid": "000",
        "cc_type": "VI",
        "cc_exp_year": "2017",
        "cc_exp_month": "2",
        "cc_number": "xxxxxxxxxxxxxxxx"
    }
}

I hope it will be help you.

Related Topic