When a checkout declines and the customer corrects their billing address, update the customer before you retry the order. The BillingAddress sent with Add Order is only saved for a customer who does not have one yet, so update the existing customer first.
Step 1: Update the Billing Address
PUT https://openapi.admoji.com/api/v2/open/customers/{customerId}/billing-address
$ curl -X PUT 'https://openapi.admoji.com/api/v2/open/customers/16342842/billing-address' \
-H "Authorization: ApiKey secret_492796e421a34666a5695d53cd311111" \
-H "Content-Type: application/json" \
-d '{
"Address1": "13306 SW 58th Court",
"City": "Miami",
"State": "FL",
"ZipCode": "33156",
"CountryISO": "us"
}'
Accepted fields:
FirstName,LastName,Address1,Address2,City,State,ZipCode, andCountryISO.It is a partial update: only the fields you send are changed, so send just what the customer edited.
A successful call returns
{"Status": 0, "Good": true}.This endpoint needs a Full Access API key.
Step 2: Retry the Order
Send the same Add Order call again with the customer's payment details. There is no need to include BillingAddress — Admoji reads the updated address from the customer.
Idempotency-Key for the retry. Reusing the key from the declined attempt returns the cached decline instead of running the order again. See How do I generate Idempotency IDs?.Related articles