Agent Wranglers

ECM-20Recommended

Authorise at checkout and capture when the goods ship

For physical goods paid by card, authorise the payment at checkout and capture it when the shipment leaves. Capture only the lines you ship, and release the rest.

How to do it

Capturing at shipment means a cancelled or unshippable order needs no refund, and refund fees and disputes go down. An online card authorisation usually lasts about 7 days, and Visa's lasts 5 days for payments the merchant starts. Capture or release before the authorisation expires, and alert when one is a day from expiry. When a delay is longer than the authorisation, capture the lines ready now, or take a new payment with consent. Capture only on a verified event from your own system that the parcel left. The payment events that move the order are in Let provider events move the order. Some payment methods cannot capture later, such as bank debits, so capture those at checkout.

Examples

TypeScript example

export async function onShipmentLeft(shipment: Shipment) {
  const amountMinor = shipment.lines.reduce((sum, line) => sum + line.totalMinor, 0);
  await stripe.paymentIntents.capture(shipment.order.paymentIntentId,
    { amount_to_capture: amountMinor }, { idempotencyKey: `capture-${shipment.id}` });
}

Python example

def on_shipment_left(shipment) -> None:
    amount_minor = sum(line.total_minor for line in shipment.lines)
    stripe.PaymentIntent.capture(shipment.order.payment_intent_id,
                                 amount_to_capture=amount_minor, idempotency_key=f"capture-{shipment.id}")

How to check

A test places an order for two items, ships one and cancels the other. The provider shows one capture for the shipped line and the remaining amount released. A daily query finds no uncaptured authorisation older than its expiry.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ecommerce/orders-and-fulfilment/capture-on-shipment">Agent Wranglers e-commerce and fulfilment playbook</a>. In code you write, add a comment next to it with the same link.