iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
This checkout wrapper retries only when two conditions are met: the optional managed-payments fields were added to the request, and Stripe’s error specifically identifies those fields as invalid. Otherwise, it returns the original error. The second attempt removes only the three optional fields the feature added; it is not a general retry for declines, connection failures, or other API errors.
When should a checkout retry?
In Daniel Pertu’s example, the checkout is for a one-time £20 licence. EU customers are routed through Stripe as merchant of record, while the UK and other regions are intentionally outside that route. When the EU route applies, the code adds managed-payments settings and tax data to the Checkout Session request. Those optional fields can be rejected if merchant-of-record activation, terms acceptance, or an eligible tax code is missing. Because the fields are added by region, a configuration error can break EU checkout while other regions appear to work. Pertu’s implementation describes this as a targeted fallback, not a general retry policy.
The wrapper makes a second stripe.checkout.sessions.create call only when both gates pass:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →- The feature was applied. The caller confirms that the managed-payments fields were actually added to this request.
- The rejection points to that feature. The error predicate recognizes a structured
parambeginning withmanaged_payments, or a matching message after confirming the error is aStripeInvalidRequestError. Known non-validation error types are rejected by the predicate.
If either gate fails, the code rethrows the original error. That distinction matters: a card decline, connection failure, or unrelated API problem does not show that the optional fields caused the failure.
#1 Best Overall
- Get your money as soon as the next business day.
- Get set up quickly with no long-term commitments. Download the Square Point of Sale app for free, create an account, and start taking payments anywhere.
- Run your business all in one place with the free Square Point of Sale app. Track your sales, manage inventory, accept tips, send receipts digitally, and more.
- Works with Apple devices with a Lightning connector.
What changes in the fallback request?
The fallback removes exactly the fields the managed-payments feature added, at their known locations:
- The session-level
managed_paymentsfield. - The line-item
price_data.tax_behaviorfield. - The line-item
price_data.product_data.tax_codefield.
Removing known paths is safer than recursively deleting every property with those names: another part of a request could legitimately use a similarly named field. The retry should be a deliberate transition to the unoptimised request shape, not a broad rewrite of the payload.
Rank #2
- Pay one transparent rate per swipe for Visa, Mastercard, Discover and American Express.
- Works in conjunction with most downloadable Square point-of-sale apps on your device. Customers can pay, tip and sign directly on your device. Track payments in cash, gift cards and more. Also lets you send receipts via e-mail or text message, makes it easy to apply discounts, keeps a data and sales history log and more.
- Accepts magstripe credit card payments, including those from Visa, Mastercard, Discover and American Express (fees apply).
- App sends deposits to your bank account within 1 to 2 business days, or enjoy instant deposits (fees apply).
Which failures are deliberately not retried?
The implementation uses separate buyer-facing responses for several failures. This is the author’s chosen error taxonomy, not a Stripe requirement:
- Card decline: return an actionable 402 response, using Stripe’s message when available.
- Rate limit: return 429 and suggest trying again shortly.
- Connection or API availability error: return 503.
- Invalid request, authentication, or unknown error: return a generic 500 response while retaining diagnostic details server-side.
Only the narrow optional-field validation case takes the fallback path. For other errors, preserve the failure’s meaning and keep enough server-side detail to diagnose it.
Rank #3
- USB interface, keyboard emulation, no need to install software to read, configuration software for changing settings available.
- Read data from all 3 tracks, high and low coercivity cards, ISO7811, AAMVA, CA DMV and most magnetic card data formats.
- Work on Windows, Mac and other USB capable systems. Work with TXT, notepad, Word, Excel, POS systems and son on.
- Compact size, with 145cm USB cord, two 3mm-diameter screw holes for fixing at the bottom, a LED indicator light
- Perfect for POS, Banking, Loyalty, Access Control, ID verification and other applications.
What does a successful fallback mean for tax?
A fallback can restore checkout availability while completing a sale without the expected VAT collection. It does not fix the underlying managed-payments configuration or remove any possible tax liability.
Pertu says the implementation logs this degraded success, sends it to Sentry at error level, and checks completed sales in a webhook. The check flags a billing country on the EU allowlist when tax is zero. That is a useful review signal rather than proof of an error: a legitimate EU business purchase using reverse charge can also have zero tax.
Rank #4
- Accept all major credit and debit cards for one low rate.
- Accepts Visa, Mastercard, Discover, and American Express—no hidden fees.
- Track your earnings and view your complete sales history from the free Square Point of Sale app.
- Works with Apple and Android devices that have a 3.5 mm headphone jack. No charging needed
How is this different from an idempotent retry?
These are two different retry problems:
| Case | Trigger | Request sent again | Main concern |
|---|---|---|---|
| Targeted validation fallback | A confirmed rejection of optional fields that were added to the request. | A changed request with those specific fields removed. | Checkout may complete without the intended tax behavior, so record and review degraded success. |
| Replay after an uncertain connection failure | The caller cannot tell whether the first request executed. | The same operation, using the same idempotency key when supported. | A stable key helps avoid accidentally performing the same operation twice. |
Stripe’s idempotency documentation says it saves the first result for a key and returns that result for subsequent requests using the same key. It also says keys may be pruned after they are at least 24 hours old. That mechanism is for safely replaying the same operation; it does not make a fallback request with changed parameters identical to the original. Pertu’s sample wrapper does not show an idempotency key.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchThe practical rule is to require evidence for the retry that matches the failure: a feature-specific validation rejection for a changed fallback, or an idempotency key for replaying the same operation when the outcome of the first request is uncertain.
Quick Recap
Best Value
- MSR90 is a USB emulation keyboard interface that not need any driver or software,USB simply plug and play
- Reads up to 3 tracks of information,can reads ISO7811, AAMVA, CA DMV and most other card data formats
- Threaded inserts for mounting. LED indicator, green light is on when connecting,green light blinks when cards swiped
- Bi-directional swipe reading, superior reading of high jitter, scratched, and worn magstripe cards, reliable for over 1,000,000 card swipes
- Configuration software makes configuration changes easy,works with: Windows OS and Mac OS
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

