Payment gateway API integration

Hi everyone,
I need help figuring out how to manage integration with a payment gateway’s API.
I try to explain my workflow.
Step 1: From my cart page I send the call to the API which redirects me to the gateway page and I sign a session variable with an order number (is it more correct to use the session or a cookie?)
Step 2: After the user has entered the card details, the gateway redirects to one of my pages where I have to call another API to check the outcome of the transaction, always using the session variable as a parameter of the call.
Step 3: The API returns me a fairly complex array and here I need your help, since in the configuration of the API call in Step2 I can’t fetch the schema. Do I have to build an array manually with all the structure?
I would need to check only the value of the operationResult variable to process the order based on the outcome of the payment

You can copy the json structure from the payment API docs, and use it.

Right! I’m doing this manually because they don’t have a json structure in the documentation.
Does using a session variable to store the order ID throughout the workflow sound like the right way?

Yes, you can store your values and pass them between server actions using session variables.

1 Like

You can access any of the returned key values from the API using the dot notation, which might look like this: CheckPay.data.operationResult.