What it is
A payment gateway integration connects your website or application to a payment provider so customers can pay by card, wallet or other methods. A complete integration covers much more than the checkout button: authorization and capture, refunds, disputes, subscriptions, payouts, webhooks and reconciliation with your accounting records.
When you need it
- You are launching online sales, bookings or subscriptions.
- Your current checkout sends card data through your own servers.
- Payments sometimes go missing, get duplicated or need manual matching.
- You are adding a new region, currency or payment method.
How we approach it
We start by mapping every path a payment can take, including the unhappy ones: declines, timeouts, partial refunds, chargebacks and expired cards. Then we choose an integration style. In most cases, hosted fields or a redirect let the gateway collect card details directly. The gateway returns a token, and your system stores only that.
Reliability comes from a few disciplines:
- Idempotency keys. Each create-payment or refund request carries a unique key. If a network timeout causes a retry, the gateway recognizes the key and returns the original result instead of charging twice.
- Webhooks as the source of truth. Payment outcomes often arrive asynchronously. We verify each webhook’s signature, store the raw event, process it through a queue and make handlers safe to run more than once.
- A local payment record. Your database keeps a state machine for each payment, updated only by verified events, with the gateway’s reference stored alongside your order.
- Reconciliation. A scheduled job compares your records with the gateway’s settlement reports, accounting for fees and refunds, and flags mismatches for review.
We test every flow in the gateway’s sandbox, including the provider’s test cards for declines and authentication challenges, before going live.
Common pitfalls to avoid
- Trusting the browser redirect. A customer landing on a success page does not prove payment. Confirm it from the gateway.
- Using floating-point amounts. Store money as integers in minor units or exact decimals.
- Ignoring webhook ordering. Events can arrive late or out of order. Handlers must check current state before changing it.
- Logging sensitive data. Request logs must never contain card numbers, security codes or full tokens.
- Forgetting disputes. Chargebacks need evidence and deadlines. Plan the process before the first one arrives.