Skip to content

Set Billing Address

Set the billing address for a cart.

Authentication

This query requires a valid customer authentication token in the Authorization header. Use the Customer Login API to retrieve the token. If the customer is a guest, use the guest cart token generated by the Create Guest Cart mutation.

Authorization: Bearer <accessToken>

Arguments

NameTypeRequiredDescription
billingFirstNameString✅ YesBilling first name
billingLastNameString✅ YesBilling last name
billingEmailString✅ YesBilling email address
billingAddressString✅ YesBilling street address
billingCityString✅ YesBilling city
billingCountryString✅ YesBilling country code
billingStateString✅ YesBilling state/province
billingPostcodeString✅ YesBilling postal/zip code
billingPhoneNumberString✅ YesBilling phone number
useForShippingBoolean❌ NoUse billing address as shipping address

Response

FieldTypeDescription
checkoutAddress._idStringInternal ID
checkoutAddress.successBooleanSuccess status
checkoutAddress.messageStringSuccess or error message
checkoutAddress.idStringAddress ID
checkoutAddress.cartTokenStringCart token
checkoutAddress.billingFirstNameStringBilling first name
checkoutAddress.billingLastNameStringBilling last name
checkoutAddress.billingAddressStringBilling street address
checkoutAddress.billingCityStringBilling city
checkoutAddress.billingStateStringBilling state/province
checkoutAddress.billingPostcodeStringBilling postal/zip code
checkoutAddress.billingPhoneNumberStringBilling phone number
checkoutAddress.shippingFirstNameStringShipping first name (if useForShipping is true)
checkoutAddress.shippingLastNameStringShipping last name (if useForShipping is true)
checkoutAddress.shippingCityStringShipping city (if useForShipping is true)

Validation Rules

  • All required billing address fields must be provided
  • billingEmail must be a valid email address
  • billingCountry must be a valid country code
  • billingPhoneNumber should be in valid format
  • If useForShipping is true, the billing address will also be used as the shipping address

Error Responses

json
{
  "errors": {
    "billingEmail": ["The billing email must be a valid email address."],
    "billingCountry": ["Invalid country code."]
  }
}

Released under the MIT License.