Place Order API versus Place Order Action API for webhook-confirmed payments
Key Takeaway
When a payment provider confirms payments through a webhook, use the Place Order Action API. The Place Order API doesn't wait for webhook confirmation, so it can create orders for failed payments.
B2B Commerce has two APIs for placing an order at checkout. The older Place Order API (v1) does everything in one call. The newer Place Order Action API (v2) splits the work into a Prepare step and a Submit step. The difference matters most when a payment provider confirms payments later through a webhook, because only the Place Order Action API waits for that confirmation before it creates the order.
How the two APIs differ
The two APIs divide the checkout work differently around payment.
| Place Order API | Place Order Action API | |
|---|---|---|
| Full name | Commerce Webstore Checkout Orders API (v1) | Commerce Webstore Checkout Place Order Action API (v2) |
| Endpoint | /orders | /orders/actions |
| Steps | A single-step call, made after payment | Two actions: Prepare runs before payment, and Submit runs after payment |
| Validations, inventory handling and coupon processing | In the single call | In Prepare |
| Order placement | In the single call | In Submit |
| Successful call returns | 201 Created | 200 OK |
| Cart-to-order processing | Runs asynchronously after the call | Runs asynchronously after Submit |