Checkout
Apply Customer to Cart
This API lets you apply customer information to the cart. The primary purpose of the customer data is to provide the merchant with enough information to communicate with the customer once the order has been submitted.
POST /checkout/cart/{cart_id}/customer
Apply customer details to a given cart. API Reference: Apply Guest Customer to Cart
Request
cart_id
the ID of the cart you would like to add this SKU to.
Required Body Parameters:
first_namerequired
the first name of the customer.
last_namerequired
the last name of the customer.
emailrequired
the email address of the customer.
Optional Query Parameters:
shipping_address
the shipping address of the customer.
billing_address
the billing address of the customer.
same_address
use same address for both.
If only one one address is applied and the same_address property is not set to true only one address will be applied to the cart. The remaining address will still need to be applied before the cart can be completed.
Curl
curl -X POST https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/customer \
-H "X-Violet-App-Id: your-app-id-here" \
-H "X-Violet-App-Secret: your-app-secret-here" \
-H "X-Violet-Token: your-token-here" \
-H "Content-type: application/json" \
-d '{"first_name": "Ultra", "last_name": "Violet", "email": "example@example.com"}'
Response
JSON
{
"id": 20956,
"token": "c8f17e9e6fec4268bc9188f039ec68ad",
"user_id": 10397,
"app_id": 10382,
"developer_id": 10292,
"customer": {
"user_id": 10397,
"first_name": "Paul",
"last_name": "Sherman",
"email": "dorythefish@disney.com",
"name": "Paul Sherman"
},
"bags": [
{
"id": 20440,
"order_id": 20956,
"merchant_id": 10000,
"app_id": 10382,
"status": "IN_PROGRESS",
"fulfillment_status": "PROCESSING",
"financial_status": "UNPAID",
"skus": [
{
"id": 24987,
"merchant_id": 10000,
"app_id": 10382,
"product_id": "0ff55c5cda7447118d6ae1c8395f8f11",
"sku_id": 10064,
"external_id": "13884047425654",
"name": "GoPro - Karma Quadcopter with HERO6 Black - White - White",
"brand": "GoPro",
"thumbnail": "https://cdn.shopify.com/s/files/1/0057/6467/7750/products/6029300_ra.jpg",
"quantity": 1,
"price": 84999,
"weight": 13.45,
"available": true,
"status": "IN_PROGRESS",
"line_price": 84999
}
],
"taxes": [],
"sub_total": 84999,
"transactions": [],
"external_checkout": true,
"commission_rate": 15.0,
"date_created": "2022-05-11T16:17:16+0000",
"remorse_period_ends": "2022-06-10T16:17:16+0000",
"currency": "USD",
"external_currency": "USD",
"channel": "APP",
"platform": "SHOPIFY",
"fulfillments": [],
"merchant_name": "Violet-Besties"
}
],
"shipping_address": {
"city": "Sydney",
"state": "NSW",
"country": "AU",
"postal_code": "2000",
"type": "SHIPPING",
"address_1": "42 Wallaby Way"
},
"billing_address": {
"city": "Sydney",
"state": "NSW",
"country": "AU",
"postal_code": "2000",
"type": "BILLING",
"address_1": "42 Wallaby Way"
},
"sub_total": 84999,
"status": "IN_PROGRESS",
"date_created": "2022-05-11T16:17:16+0000",
"date_last_modified": "2022-05-11T16:50:14+0000",
"priced": false,
"currency": "USD",
"errors": [],
"channel": "APP",
"currency_symbol": "$",
"stripe_key": "pk_test_UHg8oLvg4rrDCbvtqfwTE8qd",
"guest": true
}