From 77f26f7b068872925b42d73f6cf180ad2dcc39d7 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 13 Aug 2026 21:50:35 +0800 Subject: [PATCH] fix(storefront): capture the checkout id and payment intent from Before MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before is the only request that returns them, and nothing was capturing either, so two requests were sent literal unresolved variables: Get Checkout Status ?checkout={{checkout_id}} -> 404 "Checkout not found" Update Stripe Payment Intent payment_intent_id -> 400 "No such payment_intent: '{{payment_intent_id}}'" {{checkout_id}} is the chkt_* public id, NOT the checkout_* token — /checkouts/status matches on both and they are different values. Capturing the token into it would look right and still 404. The id only became available on the card path in fleetbase/storefront@dev-v0.4.19, which adds `checkout` to the three initialization responses that returned the token alone; the QPay path already returned it. The payment-intent capture is guarded rather than assumed, because only the card gateway returns one — a cash or pickup checkout answers with the ids alone. Also unblocks the two QPay callbacks, which address {{checkout_id}} as well. Co-Authored-By: Claude Opus 5 --- .../Before \342\235\227.request.yaml" | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git "a/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" "b/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" index d898386..14c2f3c 100644 --- "a/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" +++ "b/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" @@ -14,12 +14,29 @@ queryParams: scripts: - type: afterResponse code: |- - // Capture checkout as order and Get Checkout Status both address - // {{checkout_token}}; nothing set it. + // This response is the only source for three variables the rest of Checkout + // addresses, and nothing set any of them. + // + // {{checkout_token}} Capture checkout as order, Get Checkout Status + // {{checkout_id}} Get Checkout Status, both QPay callbacks. This is the + // chkt_* public id, NOT the token — /checkouts/status + // matches on both and they are different values. + // {{payment_intent_id}} Update Stripe Payment Intent + // + // Only the card gateway returns a payment intent, so that capture is guarded + // rather than assumed: a cash or pickup checkout answers with the ids alone. var json_response = pm.response.json(); if (json_response && json_response.token) { pm.environment.set("checkout_token", json_response.token); } + + if (json_response && json_response.checkout) { + pm.environment.set("checkout_id", json_response.checkout); + } + + if (json_response && json_response.paymentIntent) { + pm.environment.set("payment_intent_id", json_response.paymentIntent); + } language: text/javascript order: 1000