How can i use VTEX payment API to make a purchase in my custom app

We are continuously looking for the possible solution of our problem, though we tried follow the api documentation from VTEX for transaction process and faced a new error on the way. Let us describe the flow what we did:

  1. Create a Gateway Affiliation on payment settings section for service “CCAvenue”, also mentioned the appKey and appToken for the same.

  2. Created a payment condition for CCAvenue with no special conditions.

  3. Called the API to create a new transaction “https://{accountName}.vtexpayments.com.br/api/pvt/transactions”

  4. After receiving a newly created transaction Id , we called a API to send the payment information to VTEX i.e: “https://{accountName}.vtexpayments.com.br/api/pub/transactions/{transactionId}/payments” Received (201 Response)

  5. The fourth and last step to create a new transaction, we called the API “https://{accountName}.vtexpayments.com.br/api/pvt/transactions/{transactionId}/authorization-request” , but here we got an error

{

    "error": {

        "code": "1403",

        "message": "Authorization is pending for payments with Ids = 5311514DB8A04446B2F787E14F021515. A new authorization execution is needed for these payments.",

        "exception": null

    }

}

At this point , we are not sure how we can make a payment with CCavenue payment connector, also how we can solve this error.

IMPORTANT: In simple words, I want to make a payment using CCAvenue gateway affilation using vtex api, but API documentation is not useful. Also i am not using VTEX Client for my app store but created a custom react app which will call the VTEX rest api to do all actions (like “Get all products and sku from catalog”, “Get user/customer details”, “Add product to the cart”)

Hi there!

MAYBE there´re some fields missing.

Try to compare with this json
{

"paymentSystem": 4,
"paymentSystemName": "Mastercard",
"group": "creditCardPaymentGroup",
"installments": 1,
"installmentsValue": 699,
"value": 699,
"fields": {
    "holderName": "*****",
    "cardNumber": "***********03",
    "validationCode": "***",
    "dueDate": "*****",
    "addressId": "***************",
    "bin": "512269"
},
"transaction": {
    "id": "************",
    "merchantName": "*************"
},
"id": "*************",
"installmentValue": 699,
"currencyCode": "BRL"

}

EDIT: Try to check the steps described in this post.

Hi @Saito ,
Thanks for your response,
I am also using the same json object,also even getting 201 on this particular request, but getting error on next step of transaction. i.e: https://{accountName}.vtexpayments.com.br/api/pvt/transactions/{transactionId}/authorization-request

Secondly, thanks for the similar topic link. but my main objective is to implement payment gateway through CCAvenue gateway affiliation in my custom react app (not vtex store), so i just want to understand the payment flow and how payment window will open on my custom app.

Hello @Saito,

I am trying your approach but for below request unable to find document on vtex api docs.

api/checkout/pub/orderForm/{orderFormId}/transaction?sc={salesChannel}

looking for docs because know to more about request object of api.

could you please share api docs reference for request ?

@vishal Could you check if there´s any transaction created in the CCAvenue gateway? Even a failed one?

Hello @mohit.patel I just got a random example from the forum, so it´s not my approach.
Anyway, I found these 2 links that might help you with the “transaction API”