Apply Guest Customer to Cart
curl --request POST \
--url https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/customer \
--header 'Content-Type: application/json' \
--data '{
"user_id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"external_id": "<string>",
"shipping_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"billing_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"same_address": true,
"name": "<string>"
}'
{
"id": 123,
"token": "<string>",
"user_id": 123,
"app_id": 123,
"developer_id": 123,
"customer": {
"user_id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"external_id": "<string>",
"shipping_address": {
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"type": "shipping",
"address_1": "<string>"
},
"billing_address": {
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"type": "shipping",
"address_1": "<string>"
},
"same_address": true,
"name": "<string>"
},
"bags": [
{
"id": 123,
"order_id": 123,
"merchant_id": 123,
"app_id": 123,
"external_id": "<string>",
"status": "IN_PROGRESS",
"fulfillment_status": "PROCESSING",
"financial_status": "UNPAID",
"skus": [],
"shipping_method": {
"price": 123,
"shipping_method_id": "<string>",
"bag_id": 123,
"merchant_id": 123
},
"taxes": [],
"sub_total": 123,
"shipping_total": 123,
"tax_total": 123,
"discount_total": 123,
"total": 123,
"taxes_included": true,
"transactions": [],
"external_checkout": true,
"commission_rate": 123,
"date_created": "2023-11-07T05:31:56Z",
"remorse_period_ends": "2023-11-07T05:31:56Z",
"currency": "<string>",
"external_currency": "<string>",
"currency_exchange_rate": 123,
"channel": "APP",
"app_order_id": "<string>",
"platform": "OTHER",
"fulfillments": [],
"discounts": [],
"wallet_based_checkout": true,
"app_name": "<string>",
"bag_id": 123,
"bag_status": "IN_PROGRESS",
"merchant_name": "<string>"
}
],
"shipping_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"billing_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"payment_method": {
"brand": "<string>",
"last_four": "<string>",
"exp_month": 123,
"exp_year": 123,
"cardholder_name": "<string>",
"payment_method_id": 123,
"default": true
},
"sub_total": 123,
"shipping_total": 123,
"tax_total": 123,
"discount_total": 123,
"total": 123,
"app_customer_id": "<string>",
"app_order_id": "<string>",
"status": "in_progress",
"is_guest": true,
"date_created": "2023-11-07T05:31:56Z",
"date_last_modified": "2023-11-07T05:31:56Z",
"priced": true,
"wallet_based_checkout": true,
"currency": "<string>",
"referral_id": "<string>",
"errors": [
{
"id": 123,
"order_id": 123,
"bag_id": 123,
"entity_id": "<string>",
"type": "EXTERNAL_CREATE_CART",
"message": "<string>",
"date_created": "2023-11-07T05:31:56Z",
"platform": "OTHER"
}
],
"currency_symbol": "<string>",
"app_name": "<string>",
"stripe_key": "<string>",
"payment_intent_client_secret": "<string>",
"guest": true,
"order_status": "IN_PROGRESS",
"intent_based_checkout": true,
"order_id": 123
}
Note: For more details on this endpoint please refer to the API Reference
Once you have a cart with products in it you need to apply the customer information. For a brand new customer this would likely include Apply Guest Customer to Cart , Set Shipping Address , and Set Billing Address.
For the sake of ease in this example we will simplify address handling and use the same address for billing and shipping and pass this along with the customer the body of the request. For more details on what fields this API can take, refer to the documentation linked above. In this example, we have used the cart we created in the previous step. Your Cart Id will be unique and need to be updated in the request below.
Using same_address: true
we can set the shipping and billing address simultaneously.
Headers
Path Parameters
Query Parameters
Body
ID of the User the Order Customer references
First Name
Last Name
Email Address of Customer
ID of the Customer on the External Platform
The shipping or billing address of a user placing an order
The shipping or billing address of a user placing an order
Use Same Address for Both
Response
ID of the User placing the order
ID of the App creating the order
ID of the Developer who placed
The Customer Placing the Order
Bags in the Order
The shipping or billing address of a user placing an order
The shipping or billing address of a user placing an order
Payment Method belonging to an Order
Subtotal of the Order
Shipping Total of the Order
Tax Total of the Order
Discount Total of the Order
Total of the Order
App Customer ID
App Order ID
Status of the Order
in_progress
, processing
, completed
, canceled
, partially_refunded
, refunded
, requires_action
Order is Guest
Date of order creation
Date of last order update
Is the cart priced
Is this cart going to be placed through wallet-based checkout
Base currency of cart
Optional value used to represent an identifier in your system.
Errors on the Order
Symbol representing the desired currency
Name of app that originated the order.
Stripe publishable key. Use for tokenizing payment methods.
Payment intent client secret
IN_PROGRESS
, PROCESSING
, COMPLETED
, CANCELED
, PARTIALLY_REFUNDED
, REFUNDED
, REQUIRES_ACTION
Was this page helpful?
curl --request POST \
--url https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/customer \
--header 'Content-Type: application/json' \
--data '{
"user_id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"external_id": "<string>",
"shipping_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"billing_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"same_address": true,
"name": "<string>"
}'
{
"id": 123,
"token": "<string>",
"user_id": 123,
"app_id": 123,
"developer_id": 123,
"customer": {
"user_id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"external_id": "<string>",
"shipping_address": {
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"type": "shipping",
"address_1": "<string>"
},
"billing_address": {
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"type": "shipping",
"address_1": "<string>"
},
"same_address": true,
"name": "<string>"
},
"bags": [
{
"id": 123,
"order_id": 123,
"merchant_id": 123,
"app_id": 123,
"external_id": "<string>",
"status": "IN_PROGRESS",
"fulfillment_status": "PROCESSING",
"financial_status": "UNPAID",
"skus": [],
"shipping_method": {
"price": 123,
"shipping_method_id": "<string>",
"bag_id": 123,
"merchant_id": 123
},
"taxes": [],
"sub_total": 123,
"shipping_total": 123,
"tax_total": 123,
"discount_total": 123,
"total": 123,
"taxes_included": true,
"transactions": [],
"external_checkout": true,
"commission_rate": 123,
"date_created": "2023-11-07T05:31:56Z",
"remorse_period_ends": "2023-11-07T05:31:56Z",
"currency": "<string>",
"external_currency": "<string>",
"currency_exchange_rate": 123,
"channel": "APP",
"app_order_id": "<string>",
"platform": "OTHER",
"fulfillments": [],
"discounts": [],
"wallet_based_checkout": true,
"app_name": "<string>",
"bag_id": 123,
"bag_status": "IN_PROGRESS",
"merchant_name": "<string>"
}
],
"shipping_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"billing_address": {
"name": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postal_code": "<string>",
"phone": "<string>",
"type": "shipping",
"email": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"address_2": "<string>"
},
"payment_method": {
"brand": "<string>",
"last_four": "<string>",
"exp_month": 123,
"exp_year": 123,
"cardholder_name": "<string>",
"payment_method_id": 123,
"default": true
},
"sub_total": 123,
"shipping_total": 123,
"tax_total": 123,
"discount_total": 123,
"total": 123,
"app_customer_id": "<string>",
"app_order_id": "<string>",
"status": "in_progress",
"is_guest": true,
"date_created": "2023-11-07T05:31:56Z",
"date_last_modified": "2023-11-07T05:31:56Z",
"priced": true,
"wallet_based_checkout": true,
"currency": "<string>",
"referral_id": "<string>",
"errors": [
{
"id": 123,
"order_id": 123,
"bag_id": 123,
"entity_id": "<string>",
"type": "EXTERNAL_CREATE_CART",
"message": "<string>",
"date_created": "2023-11-07T05:31:56Z",
"platform": "OTHER"
}
],
"currency_symbol": "<string>",
"app_name": "<string>",
"stripe_key": "<string>",
"payment_intent_client_secret": "<string>",
"guest": true,
"order_status": "IN_PROGRESS",
"intent_based_checkout": true,
"order_id": 123
}