POST
/
checkout
/
cart
/
{cart_id}
/
customer
Header
Path
Query
Body
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

X-Violet-Token
string
X-Violet-App-Secret
string
X-Violet-App-Id
integer

Path Parameters

cart_id
integer
required

Query Parameters

async
boolean
default: false

Body

application/json
user_id
integer

ID of the User the Order Customer references

first_name
string
required

First Name

last_name
string
required

Last Name

email
string

Email Address of Customer

external_id
string

ID of the Customer on the External Platform

shipping_address
object

The shipping or billing address of a user placing an order

billing_address
object

The shipping or billing address of a user placing an order

same_address
boolean

Use Same Address for Both

name
string

Response

200 - application/json
id
integer
token
string
user_id
integer

ID of the User placing the order

app_id
integer

ID of the App creating the order

developer_id
integer

ID of the Developer who placed

customer
object

The Customer Placing the Order

bags
object[]

Bags in the Order

shipping_address
object

The shipping or billing address of a user placing an order

billing_address
object

The shipping or billing address of a user placing an order

payment_method
object

Payment Method belonging to an Order

sub_total
integer

Subtotal of the Order

shipping_total
integer

Shipping Total of the Order

tax_total
integer

Tax Total of the Order

discount_total
integer

Discount Total of the Order

total
integer

Total of the Order

app_customer_id
string

App Customer ID

app_order_id
string

App Order ID

status
enum<string>
required

Status of the Order

Available options:
in_progress,
processing,
completed,
canceled,
partially_refunded,
refunded,
requires_action
is_guest
boolean

Order is Guest

date_created
string

Date of order creation

date_last_modified
string

Date of last order update

priced
boolean

Is the cart priced

wallet_based_checkout
boolean

Is this cart going to be placed through wallet-based checkout

currency
string

Base currency of cart

referral_id
string

Optional value used to represent an identifier in your system.

errors
object[]

Errors on the Order

currency_symbol
string

Symbol representing the desired currency

app_name
string

Name of app that originated the order.

stripe_key
string

Stripe publishable key. Use for tokenizing payment methods.

payment_intent_client_secret
string

Payment intent client secret

guest
boolean
order_status
enum<string>
Available options:
IN_PROGRESS,
PROCESSING,
COMPLETED,
CANCELED,
PARTIALLY_REFUNDED,
REFUNDED,
REQUIRES_ACTION
intent_based_checkout
boolean
order_id
integer