comecerodocs

Update a browser payment request

POST
/carts/{cart_id}/user_agent_payment_request/{payment_method_type}

Sends a change from the Apple Pay sheet (a new shipping address or shipping option) to the cart. The cart's customer and shipping method change, tax and shipping are worked out again, and the new payment request comes back for updateWith(). Only apple_pay is supported. A closed cart is 422. Any token type may call it; a limited token only for a bound cart.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Path Parameters

cart_id*string

The id of the cart.

payment_method_type*"apple_pay"

The payment method type. Only apple_pay is supported; another valid type is 404, an unknown one 400.

Value in"apple_pay"

Request Body

application/json
  1. body

What changed on the browser's payment sheet. Send it from the shippingaddresschange and shippingoptionchange handlers. The field names follow the W3C Payment Request API.

shippingAddress?

The address the shopper picked. It becomes the customer's shipping address, so tax and shipping are worked out again.

shippingOption?string

The id of the shipping option the shopper picked. It becomes the cart's shipping_method_id.

details?

Read but not used.

Response Body

The browser payment request for the changed cart.

application/json
  1. response

The arguments for the browser's Payment Request API (new PaymentRequest(methodData, details, paymentOptions)) for this cart, built from its items, tax, shipping quotes and required customer fields. Only Apple Pay (apple_pay) is built this way. The field names inside follow the W3C Payment Request API, so they are camel case.

url*string

The URL of this payment request.

Formaturi
payment_url*string

Where to send the payment when the shopper approves, POST /carts/{cart_id}/payments.

Formaturi
methodData*array<>

The payment methods the browser may offer.

details*

What the payment sheet shows.

paymentOptions*

Which shopper details the sheet asks for, from the cart's required customer fields.

merchant_validation_url?string

Present for Apple Pay. Send the browser's validation URL here from the onmerchantvalidation handler.

Formaturi
curl -X POST 'https://api.comecero.com/api/v1/carts/string/user_agent_payment_request/apple_pay' \  -H 'Content-Type: application/json' \  -d '{  "shippingAddress": {    "recipient": "John Smith",    "addressLine": [      "1 Main St"    ],    "city": "High Point",    "region": "NC",    "postalCode": "27265",    "country": "US"  },  "shippingOption": "standard-us"}'
Example Response
{  "url": "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1/user_agent_payment_request/apple_pay",  "payment_url": "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1/payments",  "methodData": [    {      "supportedMethods": "https://apple.com/apple-pay",      "data": {        "version": 1,        "merchantIdentifier": "merchant.com.example.shop",        "merchantCapabilities": [          "supports3DS",          "supportsCredit",          "supportsDebit"        ],        "supportedNetworks": [          "visa",          "masterCard",          "amex"        ],        "countryCode": "US",        "requiredBillingContactFields": [          "postalAddress"        ]      }    }  ],  "details": {    "displayItems": [      {        "label": "PDF Viewer Pro",        "amount": {          "currency": "USD",          "value": "199.90"        },        "pending": false      },      {        "label": "Tax",        "amount": {          "currency": "USD",          "value": "14.99"        },        "pending": false      }    ],    "shippingOptions": [      {        "id": "digital",        "label": "Digital",        "amount": {          "currency": "USD",          "value": "0.00"        },        "selected": false      }    ],    "modifiers": [],    "total": {      "label": "Total",      "amount": {        "currency": "USD",        "value": "214.89"      },      "pending": false    }  },  "paymentOptions": {    "requestPayerName": true,    "requestPayerEmail": true,    "requestPayerPhone": false,    "requestShipping": true  },  "merchant_validation_url": "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1/user_agent_payment_request/apple_pay/merchant_validate"}