{"section":"known-issues","requestedLocale":"en","requestedSlug":"gift-card-balance-changed-even-though-the-transaction-request-failed","locale":"en","slug":"gift-card-balance-changed-even-though-the-transaction-request-failed","path":"docs/en/known-issues/Payments/gift-card-balance-changed-even-though-the-transaction-request-failed.md","branch":"main","content":"## Summary\n\nWhen a transaction is created on a using gift card (debit or credit), the API can return an error even though the gift card balance has already been changed.\n\nThis happens because the transaction is registered in two steps:\n\n1. The gift card balance is updated (debit or credit).\n2. The transaction record is saved.\n\nIf the second step fails, the API returns an error (usually HTTP 400 with `A task was canceled.`), but the balance change from the first step is not rolled back.\n\n\n- **Order placement:** the gift card is debited, the payment fails and the order stays incomplete, but the balance is not refunded after the transaction is cancelled.\n- **Retry:** When the transaction is retried after this error, even with the same `requestId`, it is processed again and the gift card is credited or debited more than once.\n- **Transaction list:** transactions affected by this issue affect gift card balance, but are not returned by `GET /api/giftcards/{giftCardId}/transactions`.\n\n## Simulation\n\nIt's not possible to simulate\n\n## Workaround\n\n- **Debit:** refund manually via the Gift Card UI. If the gift card has `Reloadable: No`, the refund must be made through the GiftCard Transaction API.\n- **Credit:** do not automatically retry when a transaction request returns an error or times out. Check the gift card balance before retry, and reverse duplicate credits that were already applied."}