Placing Orders via API
Learn how to process orders programmatically using the Vrio API.
The Vrio API provides flexible order processing for headless implementations and custom checkout experiences. There are many different ways to place an order via the API, but the most common approach uses a two-step process.
Two-Step Order Process
The recommended method creates the order with offers first, then processes the payment separately. This approach allows you to:
- Track partial order completion (customers who provide details but don't complete checkout)
- Build multi-page checkout flows
- Implement cart abandonment tracking
- Validate order details before payment processing
Before You Start
Make sure you have your API credentials ready. Learn how to create API keys →
Step 1: Create the Order with Offers
Use the POST /orders endpoint to create the order with customer information and items.
curl -X "POST" "https://api.vrio.app/orders" \
-H 'X-Api-Key: YOUR_VRIO_API_KEY' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"connection_id": 1,
"campaign_id": 1,
"email": "[email protected]",
"offers": [
"{\"offer_id\":1, \"order_offer_quantity\": 1}"
],
"ship_fname": "John",
"ship_lname": "Doe",
"ship_address1": "123 Main St",
"ship_city": "New York",
"ship_state": "NY",
"ship_country": "US",
"ship_zipcode": "10001",
"same_address": true
}'
Required fields:
connection_id
- Found on the Connections page in your Vrio admincampaign_id
- The campaign containing your checkout configurationemail
- Customer email addressoffers
- Array of offers to add to the ordership_*
- Shipping address fields (if order contains shippable items)
The response will include an order_id
that you'll use to process the order.
Step 2: Process the Order
Once ready, process the order using POST /orders/{id}/process.
curl -X "POST" "https://api.vrio.app/orders/ORDER_ID_FROM_STEP_1/process" \
-H 'X-Api-Key: YOUR_VRIO_API_KEY' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"card_type_id": 1,
"payment_method_id": 1,
"card_number": "4111222233334444",
"card_exp_month": 10,
"card_exp_year": 2025,
"card_cvv": 123
}'
Required fields:
- Payment method information (card details)
Response codes:
100
- Success101
- Additional action required (3DS, PayPal, etc.) - use POST /orders/{id}/complete200
- Declined - check transaction object for details
Learn more about handling 101 response codes →
Advanced Techniques
Explore these guides for more specialized implementations:
Updated about 6 hours ago