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
| Name | Type | Required | Description |
|---|---|---|---|
billingFirstName | String | ✅ Yes | Billing first name |
billingLastName | String | ✅ Yes | Billing last name |
billingEmail | String | ✅ Yes | Billing email address |
billingAddress | String | ✅ Yes | Billing street address |
billingCity | String | ✅ Yes | Billing city |
billingCountry | String | ✅ Yes | Billing country code |
billingState | String | ✅ Yes | Billing state/province |
billingPostcode | String | ✅ Yes | Billing postal/zip code |
billingPhoneNumber | String | ✅ Yes | Billing phone number |
useForShipping | Boolean | ❌ No | Use billing address as shipping address |
Response
| Field | Type | Description |
|---|---|---|
checkoutAddress._id | String | Internal ID |
checkoutAddress.success | Boolean | Success status |
checkoutAddress.message | String | Success or error message |
checkoutAddress.id | String | Address ID |
checkoutAddress.cartToken | String | Cart token |
checkoutAddress.billingFirstName | String | Billing first name |
checkoutAddress.billingLastName | String | Billing last name |
checkoutAddress.billingAddress | String | Billing street address |
checkoutAddress.billingCity | String | Billing city |
checkoutAddress.billingState | String | Billing state/province |
checkoutAddress.billingPostcode | String | Billing postal/zip code |
checkoutAddress.billingPhoneNumber | String | Billing phone number |
checkoutAddress.shippingFirstName | String | Shipping first name (if useForShipping is true) |
checkoutAddress.shippingLastName | String | Shipping last name (if useForShipping is true) |
checkoutAddress.shippingCity | String | Shipping city (if useForShipping is true) |
Validation Rules
- All required billing address fields must be provided
billingEmailmust be a valid email addressbillingCountrymust be a valid country codebillingPhoneNumbershould be in valid format- If
useForShippingis 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."]
}
}
