HesabPay Payment Gateway Overview
The HesabPay Payment Gateway is a hosted payment infrastructure for accepting digital payments through a single merchant integration. It supports online payments in Afghanistan, including AFN payment gateway flows, AfPay card payment gateway flows, international card payments Afghanistan use cases, and server-to-server payment notifications without requiring merchants to build payment processing logic from scratch.
What is HesabPay Payment Gateway?
Section titled “What is HesabPay Payment Gateway?”HesabPay provides the payment layer between a merchant application and the customer payment experience. For merchants looking for a payment gateway in Afghanistan, payment gateway in Kabul, or Afghani currency payment gateway, your application creates a payment request from the server, sends the customer to HesabPay checkout, and receives the final payment status through redirects and webhooks.
The hosted checkout handles the customer-facing payment flow. The API handles session creation, authentication, and backend communication. Together, they form one integration pattern: your backend creates the payment session, and HesabPay hosts the checkout.
Why use the gateway?
Section titled “Why use the gateway?”Building a payment flow requires secure payment handling, transaction status tracking, customer redirects, and reliable backend confirmation. HesabPay centralizes those responsibilities so merchants can focus on their own product and order flow.
| Benefit | Description |
|---|---|
| Hosted checkout | Customers complete payment on a secure HesabPay checkout page. |
| API-first integration | Merchant backends create payment sessions using a simple server-side API call. |
| Multiple payment methods | Checkout can support HesabPay wallet, AfPay cards, and international cards based on merchant configuration. |
| Multi-vendor distribution | Marketplace payments Afghanistan and multi-vendor payment distribution Afghanistan flows can distribute funds to multiple vendor accounts after a successful checkout. |
| Webhook notifications | Merchant systems can receive reliable server-to-server payment status updates. |
| Dashboard operations | Merchants can manage API keys, webhook settings, transactions, and refunds from the dashboard. |
Core Concepts
Section titled “Core Concepts”Understanding these concepts is enough to start integrating the gateway.
Payment Session
Section titled “Payment Session”A payment session represents one checkout attempt. It contains the amount, items, optional customer information, and redirect URLs. After creating the session, the merchant redirects the customer to the returned checkout URL.
Hosted Checkout
Section titled “Hosted Checkout”Hosted checkout is the secure customer-facing page where the payment is completed. It keeps the payment experience consistent and reduces the amount of payment UI and sensitive handling required inside the merchant application.
API Key
Section titled “API Key”An API key authenticates merchant backend requests. API keys must be stored on the server and must never be exposed in browser JavaScript, mobile apps, or public repositories.
Webhooks
Section titled “Webhooks”Webhooks notify the merchant backend when payment status changes. Redirects improve customer experience, but webhooks should be used for reliable order fulfillment and reconciliation.
Multi-Vendor Distribution
Section titled “Multi-Vendor Distribution”Multi-vendor distribution is an optional setup for marketplace scenarios where one customer payment needs to be split between multiple vendor accounts. The customer still completes one normal checkout, while the merchant system can distribute the confirmed payment amount to the vendors that own the purchased items.
For example, if a customer buys items worth 80 from three different vendors in one order, the marketplace can split the successful payment between those vendors instead of processing each vendor separately. This keeps the customer experience simple while allowing the marketplace to handle vendor settlement after payment confirmation.
Dashboard
Section titled “Dashboard”The dashboard is the operational control panel for managing credentials, webhook endpoints, transactions, refunds, and account-specific integration settings.
Supported Payment Methods
Section titled “Supported Payment Methods”- HesabPay wallet payments.
- AFN payments for Afghani currency payment gateway use cases.
- AfPay card payments.
- International card payments.
Integration Flow
Section titled “Integration Flow”- Customer starts checkout in the merchant website or app.
- Merchant backend creates a payment session with the HesabPay API.
- HesabPay returns a hosted checkout URL.
- Customer completes payment on the hosted checkout page.
- HesabPay redirects the customer to the merchant success or failure URL.
- HesabPay sends a webhook event to the merchant backend.
- Merchant backend verifies the webhook and updates the order status.
Optional Multi-Vendor Flow
Section titled “Optional Multi-Vendor Flow”Use this flow when your platform operates as a marketplace and needs to distribute one successful customer payment across multiple vendor accounts.
- Customer completes payment through the regular payment session.
- HesabPay sends payment confirmation to your backend through webhook.
- Your backend verifies the webhook and confirms the order is paid.
- Your backend calls the multi-vendor transfer API with the vendor distribution.
- Each vendor receives their assigned portion automatically.
The regular payment session remains the starting point. Multi-vendor transfer happens after payment confirmation, so vendor distribution should be triggered from your backend after the payment status is trusted.
Get Started
Section titled “Get Started”Start with the quickstart guide to create your first payment session, then add webhook handling before going live.