Customers are applied to Violet at the Order level and shared across all Bags. The model that Violet accepts for customers includes both Billing and Shipping addresses in the same request, as seen below:

{
        "first_name": "First",
        "last_name": "Last",
        "email": "first.last@violet.com",
        "shipping_address": {
            "phone": "+19171111111",
            "address_1":"123 Brooklyn Street",
            "city":"Brooklyn",
            "country":"US",
            "postal_code":"11206",
            "state":"NY",
            "type":"SHIPPING"
        },
        "same_address": true //This denotes that Billing and Shipping addresses are the same
}

The phone field is a part of the OrderAddress object because many e-commerce platforms require it as a shipping field, not a customer field. This is to assist during order delivery.

Violet currently only operates on the Guest Customer model and does not let you save these customers on our end for re-use. If you’re looking to power repeat customers, we recommend saving this information on your end and passing it in during cart creation.


Apply Customer Details to a Cart

You can also add customer details, including address details, if desired, to a Violet Cart independent of Order Addresses using the Apply Customer Details to Cart endpoint, as seen below:

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"}'

Apply Shipping and Billing Addresses to Cart

If Customer Details are added without an address, you’ll be required to add in addresses using the Apply Address to Cart endpoint before requesting shipping methods, as seen below:

curl -X POST https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/shipping_address \
-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 '{"phone": "+19171111111", "city": "Seattle", "state": "WA", "country": "US", "postal_code": "98104", "address_1": "925 4th Ave"}'

Apply Shipping and Billing Addresses to Cart (Apple Pay)

When using Apple Pay, Apple does not provide a complete shipping and billing address until after payment authorization. In order to accommodate for this, Violet allows you to leave certain fields, such as address_1, blank. This can only be done if the Order has been marked with the field wallet_based_checkout: true. You can learn more about how to use Apple Pay and other wallet based payment methods, here.


Blocked Addresses

Violet maintains a list of blocked addresses that cannot be used for new carts or orders. These are addresses that have historically been used to place fraudulent orders through Violet using stolen card numbers. This list consists primarily of private/residential addresses however freight forwarders may also be included after they’ve handled multiple fraudulent orders.

When an attempt is made to apply a blocked address to a cart the following error will be returned.

{
  "message": "The provided address has been blocked due to a history of being used for fraudulent orders.",
  "error": "blocked_address",
  "code": 4236
}

For testing purposes you can trigger this error using the postal code 99999 with the street address 10001 Purple Way.

If you wish to disable the address block list please open a ticket and request that it is disabled for your app(s).