Apply Guest Customer to Cart
/v1/checkout/cart/{cart_id}/customer
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.
Though for the sake of ease in this Recipe we will simply address handling and use the same address for billing and shipping and pass this through 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 different and need to be updated in the request below.
Using same_address: true
we can set the shipping and billing address simultaneously.
Params
HEADER PARAMETERS
Token
App Secret from Dashboard
Your app ID
curl --location --request POST 'https://sandbox-api.violet.io/v1/checkout/cart/20956/customer' \
--header 'X-Violet-Token: TOKEN' \
--header 'X-Violet-App-Secret: APPSECRET' \
--header 'X-Violet-App-Id: APPID' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "dorythefish@disney.com",
"first_name": "Paul",
"last_name": "Sherman",
"shipping_address": {
"address_1": "42 Wallaby Way",
"city": "Sydney",
"country": "Australia",
"postal_code": "2000",
"state": "NSW",
"type": "SHIPPING"
},
"same_address": true
}'
{
"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
}
Headers
Path Parameters
Query Parameters
Body
The shipping or billing address of a user placing an order
Email Address of Customer
ID of the Customer on the External Platform
First Name
Last Name
Use Same Address for Both
The shipping or billing address of a user placing an order
ID of the User the Order Customer references
Response
App Customer ID
ID of the App creating the order
Name of app that originated the order.
App Order ID
Bags in the Order
The shipping or billing address of a user placing an order
Base currency of cart
Symbol representing the desired currency
The Customer Placing the Order
Date of order creation
Date of last order update
ID of the Developer who placed
Discount Total of the Order
Errors on the Order
Order is Guest
IN_PROGRESS
, PROCESSING
, COMPLETED
, CANCELED
, PARTIALLY_REFUNDED
, REFUNDED
, REQUIRES_ACTION
Payment intent client secret
Payment Method belonging to an Order
Is the cart priced
Optional value used to represent an identifier in your system.
The shipping or billing address of a user placing an order
Shipping Total of the Order
Status of the Order
in_progress
, processing
, completed
, canceled
, partially_refunded
, refunded
, requires_action
Stripe publishable key. Use for tokenizing payment methods.
Subtotal of the Order
Tax Total of the Order
Total of the Order
ID of the User placing the order
Is this cart going to be placed through wallet-based checkout
curl --location --request POST 'https://sandbox-api.violet.io/v1/checkout/cart/20956/customer' \
--header 'X-Violet-Token: TOKEN' \
--header 'X-Violet-App-Secret: APPSECRET' \
--header 'X-Violet-App-Id: APPID' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "dorythefish@disney.com",
"first_name": "Paul",
"last_name": "Sherman",
"shipping_address": {
"address_1": "42 Wallaby Way",
"city": "Sydney",
"country": "Australia",
"postal_code": "2000",
"state": "NSW",
"type": "SHIPPING"
},
"same_address": true
}'
{
"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
}