Skip to content
Blog

E-commerce

Payment gateway integration checklist

From Stripe to regional processors, the integration, security, and edge-case checklist for accepting payments without surprises in production.

By Pykero Agency · Engineering teamJul 8, 20265 min read

TL;DR

Payment gateway integration is easy in the quickstart and hard in production. This checklist covers the webhook handling, edge cases, and security details that separate a demo from something you can trust with real revenue.

Secure payment flow with card and lock iconography

Payment gateway integration looks straightforward in the quickstart and gets complicated the moment real money flows. The demo takes a card and returns success. Production has failed charges, disputes, partial refunds, currency rounding, and a webhook that arrives twice. This checklist covers what separates a working demo from an integration you can trust with revenue.

Never let the card touch your server

Card data should go straight from the browser to the processor, not through your backend. Use hosted fields or a hosted checkout: Stripe's Payment Element, Stripe Checkout, or the equivalent from whichever processor you're working with. This keeps you in the lightest PCI compliance tier (SAQ A) and removes an entire class of breach risk from your architecture.

If your current setup stores raw card numbers, stop and redesign before going further. There is almost never a legitimate reason to hold that data yourself.

Treat webhooks as the source of truth

The browser redirect after payment is not confirmation. The user can close the tab, the network can drop, the redirect URL can be misconfigured. The webhook is the authoritative signal that a charge actually succeeded. Build your fulfillment logic around it.

Three things matter here. First, verify the signature on every incoming webhook event. Processors sign them so you can confirm the payload came from them, not from someone forging a "payment succeeded" event against your endpoint. Second, make handlers idempotent. Processors retry on network failures, so the same event will sometimes arrive more than once. Key your handler on the event ID and no-op on duplicates. Third, return a fast 2xx immediately and do any slow work asynchronously. If your handler times out, the processor retries, and you get duplicates.

Fulfilling orders from the redirect is the single most common way integrations double-fulfill or miss orders entirely.

Handle the money edge cases

Most integrations think about the happy path and discover the rest in production.

Failed and retried payments need clear error messaging so the user understands what happened and can try a different method. Vague errors cause drop-off. Refunds and partial refunds should be modeled from day one: the data model that works for a full refund often breaks when you need to refund one line item in an order. Disputes and chargebacks arrive as webhook events. Listen for them, store the evidence you need to respond, and handle them programmatically rather than discovering them in the processor dashboard weeks later.

On amounts: store money as integer minor units. Cents for USD, fils for AED, pence for GBP. Floats introduce rounding errors that compound across aggregations and are genuinely painful to debug. An integer is never ambiguous.

Design for the strong-auth flow

Regulations like SCA in Europe require additional authentication on many card payments. Modern SDKs handle 3-D Secure for you, but only if you use the payment-intent flow correctly. The failure mode is subtle: a payment that silently fails the SCA step looks to the customer like a broken checkout, not an auth challenge. Test the challenge flow explicitly with the processor's test cards for 3DS. Confirm the UI presents it properly and that a completed challenge actually fulfills the order.

Test with the tools, not with production

Every major processor ships test card numbers that simulate specific outcomes: success, generic decline, insufficient funds, disputed transaction. Use them. Fire test webhooks from the processor's CLI. Confirm your idempotency logic actually holds by sending the same event ID twice and checking that no duplicate is created. These paths are cheap to test before launch and expensive to discover after.

Before you go live

  • Signature verification on all incoming webhooks
  • Idempotent handlers keyed on event ID
  • Refund and dispute webhook events handled and tested
  • All monetary amounts stored as integer minor units
  • API keys and secrets in environment config, never in the client bundle or committed to the repo

For a broader look at securing the application around your payment integration, see the secure your web app guide.

At Pykero we integrate Stripe and regional processors into products where a missed edge case means lost revenue. If payments are on your roadmap, let's talk.

payment gateway integrationstripe integration checklistpayment webhook idempotencypci compliance hosted fields3d secure sca paymentshandle refunds chargebacks stripe

Frequently asked questions

Should card data go through my backend?

No. Card data should go straight from the browser to the processor using hosted fields or a hosted checkout like Stripe's Payment Element. This keeps you in the lightest PCI compliance tier and removes an entire class of breach risk.

Why use webhooks instead of the redirect after payment?

The browser redirect is not a reliable confirmation because users can close the tab before it fires. The webhook is the authoritative signal that a charge succeeded. Build your fulfillment logic around that, not the redirect.

How should I store money in a database?

Always store monetary amounts as integer minor units, cents for USD, fils for AED, and so on. Floats introduce rounding errors that compound over time and are genuinely difficult to debug.

What is the most common mistake in Stripe integrations?

Fulfilling orders from the post-payment redirect instead of the webhook. The redirect can be missed or duplicated. The webhook, verified and handled idempotently, is the correct trigger for any downstream action.

How Pykero can help

Services related to this article.

Building something like this?

Pykero Agency designs and ships production web, mobile, SaaS, and AI products.

Talk to us

Discussion

Be the first to comment.

Related reading