---
title: "Keep one open payment per order · Agent Wranglers"
url: https://agentwranglers.se/playbook/payments/amounts-and-orders/one-open-payment-per-order
updated: 2026-10-20
licence: "All rights reserved"
---

# Keep one open payment per order

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Amounts and orders](https://agentwranglers.se/playbook/payments/amounts-and-orders)
- Rule: Allow at most one open payment attempt per order, and reuse it when the customer comes back to checkout.
- How: Customers double-click, open two tabs and press back. Store the provider's payment ID on the order. When checkout opens again, fetch that payment and reuse it while it can still succeed. If the amount changed, cancel the old payment before you create a new one. A partial unique index enforces the rule in the database.
- Check: Open checkout for one order in two tabs and pay in both with a test card. One payment succeeds, and the provider shows no second charge.

Example:

```sql
CREATE UNIQUE INDEX one_open_payment_per_order
  ON payment_attempts (order_id)
  WHERE status IN ('created', 'requires_action', 'processing');
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers payments playbook: https://agentwranglers.se/playbook/payments/amounts-and-orders/one-open-payment-per-order`.

- Previous: [Create each charge with an idempotency key](https://agentwranglers.se/playbook/payments/amounts-and-orders/idempotent-charge-creation)
- [Amounts and orders](https://agentwranglers.se/playbook/payments/amounts-and-orders)
