2026-12-02 Author : ZCS
Payment gateway integration should make a sale easy to follow from the customer's first payment attempt to the merchant's final records. The wider payment processing flow explains how the financial institutions handle the transaction. The integration connects that process to the merchant's checkout and order system.
Payment gateway integration is the connection between a website, app or POS system and a service that accepts payment requests and returns payment information. The connection creates payment attempts, supplies customer checkout instructions, receives status updates and links later actions such as refunds to the original transaction.
The first decision is where payment details are collected. A hosted checkout sends the customer to the provider's page. Embedded components place provider-controlled payment fields inside the merchant's checkout. A terminal integration collects card details at the physical payment device. Direct handling places more payment-data responsibility inside the merchant's own systems.
The gateway account must support the business before development becomes useful. Confirm the sales channel, countries, currencies and payment methods in the intended service arrangement. Software access and merchant approval are separate steps. The guide to merchant services and payment setup explains how providers, accounts and acceptance equipment fit together.
| Architecture | Where the customer enters or presents payment details | What the merchant connects |
|---|---|---|
| Hosted checkout | Provider-hosted page | Order creation, redirect and payment confirmation |
| Embedded components | Provider-controlled fields inside checkout | Page integration, backend request and result handling |
| Direct handling | Merchant-controlled payment capture | Payment-data handling and processing connections |
| POS terminal | Supported physical payment device | Amount, device selection, result and receipt data |
Draw the payment-data path before choosing the interface. Mark which system receives the card details and which receives only a session or transaction reference. That distinction drives the security design.
Hosted checkout is a straightforward starting point for a standard online purchase. The provider supplies the payment interface while the merchant focuses on its order. Embedded components give more control over page layout. Direct handling needs a clear business reason because it adds security work to the merchant's application.
An embedded form still depends on the page around it. PCI SSC's embedded payment-page guidance explains the script-protection eligibility criterion for merchants using embedded provider forms. Using an iframe does not automatically settle the merchant's PCI obligations. The implemented architecture determines which systems and responsibilities remain in scope.

The merchant backend should calculate the amount before requesting payment. Take a fictional order, ORD-1048, worth $48 in the selected currency. The backend calculates the basket, applies the valid discount and tax rules, and stores the total. It then creates a payment attempt for that amount.
| Reference | Illustrative value | Purpose |
|---|---|---|
| Order ID | ORD-1048 | Identifies the customer's purchase |
| Payment attempt ID | ATT-01 | Identifies this attempt to pay |
| Provider transaction reference | PAY-8621 | Finds the payment in the provider's system |
| Refund reference | REF-12 | Tracks a later refund separately |
The order ID should survive a failed payment attempt. A customer can try another method without creating another purchase. Keep each attempt's outcome so a support team can distinguish a declined card from a successful second attempt. This also prevents two successful payments from disappearing inside one order status.
The customer-facing page is not the final payment record. A customer can pay and lose connectivity before returning to the store's confirmation page. Stripe's server-side fulfillment guidance explains why automatic fulfillment needs webhook-based confirmation rather than depending only on a landing page.
A webhook is a message the provider sends to the merchant's server when a payment event occurs. The receiving service verifies the message using the provider's prescribed mechanism, connects it to the stored payment reference and updates the order. The customer interface can then show the same recorded result.
The order needs a defined point at which goods can be released. Some businesses capture an authorized payment immediately; others capture later when goods ship. Payment methods can also confirm asynchronously. Define the release rule for each supported method instead of treating every successful API response as a completed sale.
A timeout means the response is missing, not that the payment failed. The provider may have processed the request before the connection broke. Creating another charge with a new identity can charge the customer again.
An idempotency key identifies one intended operation across supported retries. Adyen's API idempotency documentation describes resending a request with the same key so an already processed operation returns its result without repeating the charge. Key scope, retention and retryable errors follow the provider's rules.
A changed purchase requires a new decision, not an accidental retry. Reusing an operation identity for a different amount mixes two intentions. Keep the original request tied to its original amount and currency. After a confirmed decline, a new customer payment attempt receives its own identity while remaining attached to the existing order.

Repeated events should not repeat business actions. A webhook may be delivered again after a temporary delivery problem. Processing it twice must not ship the order twice, add duplicate loyalty credit or create another receipt record. Store processed event identities and apply order changes through controlled status transitions.
A status lookup provides a recovery path when responses disagree or go missing. Query the provider using the stored transaction reference and record the resolved result. Delayed events should not overwrite a newer refund or cancellation simply because they arrived later.
API calls and SDKs play different roles in that workflow. The guide to payment API and SDK roles explains the interface and device-control boundaries. The gateway integration uses those tools to keep one purchase coherent across the checkout, provider and order database.
Assign each store device a stable reference. The checkout must identify the intended terminal so a request reaches the customer standing at that register.
A POS integration sends an amount to a selected payment device and receives the result for the correct order. The cashier builds the basket, the application starts payment, the customer presents a card or wallet, and the result returns to the merchant system. The device reference matters when several terminals share one store.
Local and cloud communication place the connection in different locations. A local setup communicates with the terminal through the supported local route. A cloud setup sends the request through the provider's service to the selected device. Network design and recovery follow the chosen architecture.
A cloud response still needs a transaction-recovery path. Adyen's cloud terminal integration guide describes payment-result handling and status requests when a response is missing. Its architecture is a provider example, not a universal endpoint design for every gateway.
Receipt output should use the recorded transaction result. The amount, order reference and payment reference must stay connected whether staff print immediately or reprint later. A paper-out event should affect printing, not create another payment request. Likewise, an application restart should recover the open order and its known transaction state.
Split payments need more than one payment reference. A customer paying partly in cash and partly by card still has one purchase. The POS records each tender against that order and calculates the outstanding amount. A failed card portion should leave the confirmed cash portion intact.
ZCS Z90 combines payment-capture hardware and receipt output in one Android handheld. Its contact-chip, magnetic-card and NFC interfaces support physical checkout inputs, while the built-in printer uses 58mm thermal paper. Integrators can use the ZCS Z90 payment terminal as the hardware side of a merchant payment deployment.
The backend and terminal application have different jobs around that hardware. The terminal application manages customer interaction and device operations. The backend associates the transaction with the order, receives provider updates and maintains the business record. The payment service supplies the supported processing route. An internet payment API does not turn every connected reader into an activated payment terminal.
A refund is a new operation linked to the original payment. Suppose ORD-1048 was paid and captured for $48, and one returned item costs $12. Create a refund against PAY-8621, retain its own reference and update the refund result when confirmed. The order now shows the original $48 payment and a $12 refund, leaving $36 net payment value before fees.
The refund record should preserve what happened rather than replace the original sale. Staff need the item returned, refund amount, payment reference and final outcome. A refund request awaiting confirmation must remain distinguishable from a completed refund. Duplicate refund events should update the same operation.
Uncaptured authorizations and captured payments require different actions. Cancelling an authorization releases or reverses an existing hold through the supported provider process. Refunding a captured transaction returns funds through the payment service. The integration should select the action from the actual payment state.
Merchant payouts need a separate reconciliation record. A provider can combine transactions, deduct fees and apply other adjustments before paying the bank account. Preserve payment, refund and payout references so accounting can explain the difference between sales and deposits. Gateway approval is not a bank-deposit timestamp.
Launch testing should prove the order remains correct when a payment behaves unexpectedly. One successful purchase demonstrates only the easiest path. Use the provider's test environment for supported scenarios, then complete the required live activation steps with separate production credentials.
| Scenario | Required business outcome |
|---|---|
| Successful purchase | One confirmed payment linked to the correct order |
| Customer cancels checkout | Order remains unpaid and can resume appropriately |
| Timeout after submission | Original payment is looked up or retried safely |
| Duplicate webhook | One state change and one fulfillment action |
| Delayed payment confirmation | Order waits for the method's defined result |
| Partial refund | Original payment and refund remain traceable |
| Printer interruption | Receipt recovery without another charge |
| Payout review | Deposits can be matched to provider records |
Production credentials belong in protected server-side configuration. Keep secret keys out of browser code, public apps and support logs. Use the provider's intended public credentials or session mechanism on customer devices. Log transaction references and operational errors without copying full card data into the order system.
A finished integration gives each team a record it can use. Customers see the correct order status, staff can find an unresolved transaction, developers can trace the request and accounting can match payments with refunds and payouts. That is the practical measure of payment gateway integration.
A gateway is the payment service or service component. Its API is a software interface used to request actions and retrieve results. Providers can package gateway and processing functions together.
Keep the order number as the purchase reference and give each payment attempt a separate identity. This preserves the history when a customer changes methods or tries again after a decline.
Hosted capture can reduce the merchant's payment-data exposure. PCI responsibilities and assessment eligibility depend on the full implementation. Embedded forms and redirected hosted pages have different security considerations.
The payment provider must support the device, payment application and connection method. A general web payment API and a terminal integration solve different capture tasks, even when the same provider offers both.