Payment resubmission and cart-change invalidation in checkout
Key Takeaway
Submitting payment again reverses, refunds or replaces the earlier payment, depending on its state. Changing the cart after the billing address is set invalidates the payment and clears the billing address.
In a B2B Commerce checkout, a POST to the Checkout Payments resource submits the buyer's payment. A separate call places the order. What happens between those calls matters, because a new payment submission or a cart change can affect the payment already in the checkout. Custom code that edits the cart or billing address at the wrong time often causes payment and order placement errors.
How to submit payment and place the order
- Submit the buyer's payment with a POST to the Checkout Payments resource:
/commerce/webstores/webstoreId/checkouts/activeOrCheckoutId/payments. - Place the order with a separate POST to
/commerce/webstores/webstoreId/checkouts/activeOrCheckoutId/orders. The orders POST takes no request parameters and no request body.
The activeOrCheckoutId value is either a checkout ID or the value active, which means the active checkout.
The Checkout Payments resource takes a tokenized payment from a payment provider. The resource works for both Salesforce Payments and custom payment adapters.