docs

Address handling (hidden)

Introduction

This section explains how to set billing and shipping addresses in the SCAYLE Headless Checkout.

If you want to set a collection point delivery address, please refer to Shipping Options. Collection Point addresses are not created manually, instead, when selecting a collection point delivery option, the delivery address is created automatically based on the Collection Point address.

Address changeSelected address
image (207).png

The Checkout API supports flexible address management with three main approaches:

  1. Set Billing and Shipping Address Separately
    Use separate API calls to provide distinct billing and shipping addresses.
  2. Set Shipping Address First
    If you set a home delivery shipping address and no billing address has been defined yet, it will be copied automatically to billing.
  3. Explicitly Copy Address
    You can manually copy the shipping address to billing or billing to shipping using the address copy endpoint.

Showing addresses

Customer addresses are included in the state response if they have already been provided.

Location in State

  • Billing Address:
    Available under orderState.addresses.billing
  • Shipping Address:
    Available under orderState.addresses.shipping

Each address includes standard customer and location information such as:

  • First and last name
  • Street and house number
  • Zip code and city
  • Country
  • Salutation
  • Collection Point information in case of none Home Delivery

Use these fields to pre-fill address forms or display selected address details during checkout.

Set Billing or Shipping Address

This endpoint allows you to create or update either billing or shipping address for a customer’s order. The address information will be saved alongside the customer profile and the ongoing order.

Key Features:

  • Billing Address & Shipping Address Sync:
    If the shipping address is set but no billing address has been provided, the shipping address will be automatically used as the billing address.
  • Address Validation:
    If address validation is enabled, an invalid address may result in a 460 status code along with address suggestions in the response.

Address Validation Flow

If address validation is active, and an invalid address is provided, the following will occur:

  1. 460 Status Code
    The endpoint will return a 460 status code to indicate that the provided address is invalid.
  2. Address Suggestions
    The state response will contain address suggestions that can be presented to the customer.
  3. Customer Interaction
    The frontend should display the address suggestions to the customer for review. Once the customer selects an appropriate address, the client should send an updated request to set the valid address.

Copy Address

The Copy Address endpoint allows you to duplicate one address type (billing or shipping) to the other, simplifying the checkout process for customers.

Copying Behavior

You can copy in either direction:

  • Billing ➝ Shipping
  • Shipping ➝ Billing (only if the shipping address is of type home delivery)

Important Considerations

  • ✅ You can copy a home delivery shipping address to billing.
  • ❌ You cannot copy a collection point shipping address to billing.
  • ⚠️ If you copy a billing address to shipping while collection point delivery is selected, the delivery type will be reset to home delivery.

Address Book

The Address Book feature allows customers to view and manage their saved addresses, enhancing convenience and personalization during checkout.


Get Addresses

Endpoint: GET /api/co/v3/addresses

This endpoint retrieves all saved addresses associated with the customer’s account.

Use Cases:

  • Display a list of previously used billing and shipping addresses
  • Allow quick selection of saved addresses during checkout

Delete Address

This endpoint allows the deletion of a specific address from the address book.

Use Cases:

  • Remove outdated or incorrect addresses
  • Allow users to manage and clean up their saved data