Orders
Why use the Order API
If you are using Vrio fully headless, you will want to process orders over the Order API
There are many different combinations to accomplish this, at the bottom you will see multiple recipe's to see different examples. In this guide, we are explaining the most common method which will allow the most flexibility.
Create the Order
Using the POST /orders endpoint, you will need the following values at a minimum to create the order. If you have more information available, you can pass it at this time.
- connection_id = This is found on the connection page within your Vrio Instance.
- campaign_id = The campaign is where all configuration for the checkout lives
- email = this will be the array of offers/items that should be added to the cart. This value can be updated
In the response, you will get an order_id. This value will be needed for future API calls.
Add Offers
If needed, you can update the offers in the cart using the POST /order_offer endpoint using the order_id generated from step 1 update the offers for the order.
Process the Order
Once you are ready to process the order using the POST /order/{id}
/process, the order must have the following.
- Offers
- Billing Address - If order requires payment
- Shipping Address - If order has shippable items
Once everything is ready, pass the payment method information required to process the order.
A successful order will return a 100 response_code. If you see a 101 is typical when using PayPal, AfterPay, Klarna or when using a 3 step redirect for 3DS transactions. To complete the transaction you will need to use the POST /order/{order_id}
/complete method. If a 200 response_code is returned, this means the transaction was declined, you will see information in the transaction object of the response as to why.
Updated 14 days ago