Introduction
Embedded QR Code Payments allow seamless integration of QR payments directly into your platform without redirecting the users away.Core Concept
At a high level, integrating payments into your system involves a 4-step process:Create a Payment Request
The first step is to create a payment request in your system
Generate and Present the QR Code
Once the payment request is ready, generate and present the QR code to the user.
Client Scans and Initiates Payment
The client scans the QR code and initiates the payment through their banking app.
Handle Webhooks and Server Communication
After the payment is processed, handle webhooks to receive payment notifications and manage server-client communication.
Supported Methods
Please note that not all payment methods support embedded QR Codes. Here is the list of methods that support QR Codes:| Payment Method | Code |
|---|---|
| PayNow | paynow_online |
| ShopeePay | shopee_pay |
| QRIS | doku_qris (Indonesia merchants), ifpay_qris (other merchants) |
| WeChatPay | wechat_pay |
| VietQR | vietqr_payme |
| PromptPay | opn_prompt_pay |
| TrueMoney | opn_true_money_qr |
| GrabPay | grabpay_direct |
| GrabPay PayLater | grabpay_paylater |
| UPI | upi_qr |
| Gcash | gcash_qr |
| QRPH | qrph_netbank |
| Touch ‘n Go | touch_n_go |
| ShopBack | Coming Soon |
Authentication
Before integration, it’s essential to understand how Hitpay APIs are authenticated. Hitpay utilizes API keys to grant access to the API. You can locate this key in your dashboard under “API keys.” Hitpay requires the API key to be included in all API requests to the server. This key should be placed in a header that follows the format shown below:X-BUSINESS-API-KEY: meowmeowmeow
Step 1: Create a Payment Request
This is the first step of the payment flow. Once you have all the details from the user and are ready to collect payments, use this API to create a payment request.Endpoint
POST /v1/payment-requests Creates a payment request and generates a QR code for thepaynow_online payment method.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| amount | string | Required. The amount to be paid. |
| currency | string | Required. The currency of the payment (e.g., “sgd”). |
| payment_methods[] | array | Required. Specify paynow_online as the payment method. |
| generate_qr | boolean | Required. Set to true to generate the QR code. |
| name | string | Optional. The name of the customer. |
| string | Optional. The email of the customer. | |
| phone | string | Optional. The phone number of the customer. |
| purpose | string | Optional. The purpose of the payment. |
| reference_number | string | Optional. A reference number for the payment. |
Example Request
Response
The response will include a qr_code_data object, which contains the data to be converted into a scannable QR code (qr_code).Example Response for Embedded QR Code Payment Request
Example Response for Embedded QR Code Payment Request
Step 2: Generate and Present the QR Code
Once the payment request is created, generate the QR code using the response data and present it to the user.Step 3: Client Scans and Initiates Payment
The client scans the presented QR code with their banking app and initiates the payment process.Step 4: Handle Webhooks and Server Communication
After the payment is processed, handle webhooks to receive payment notifications and manage server-client communication to update the payment status in your system.What is a Webhook?
A webhook is a POST request sent from HitPay’s server to your server about the payment confirmation. You must mark your order as paid ONLY after the webhook is received and validated.Register Your Webhook
To receive payment notifications, register a webhook URL from your HitPay Dashboard:- Navigate to Developers > Webhook Endpoints in your dashboard
- Click on New Webhook
- Enter a name and your webhook URL
- Select the
payment_request.completedevent - Save your webhook configuration

Webhook Payload
When a payment is completed, HitPay sends a JSON payload to your registered webhook URL with the following headers:| HTTP Header | Description |
|---|---|
| Hitpay-Signature | HMAC-SHA256 signature of the JSON payload, using your salt value |
| Hitpay-Event-Type | completed |
| Hitpay-Event-Object | payment_request |
| User-Agent | HitPay v2.0 |
Sample Webhook Payload
Validating the Webhook
To ensure the webhook is authentic, validate theHitpay-Signature header:
- Receive the JSON payload and
Hitpay-Signaturefrom the request - Use your salt value (from the dashboard) as the secret key
- Compute HMAC-SHA256 of the JSON payload using your salt
- Compare the computed signature with
Hitpay-Signature- they must match
FAQs
What about the 'webhook' parameter in the API?
What about the 'webhook' parameter in the API?
The
webhook parameter in the payment request API is deprecated and will be removed in a future version.Why the change?- The new registered webhook system supports JSON payloads with richer data
- You can subscribe to multiple event types (not just payment completion)
- Centralized management from your dashboard
- Better scalability - one webhook URL handles all your payment requests
- Register your webhook URL in Settings > API Keys
- Subscribe to
payment_request.completedevent - Update your webhook handler to accept JSON payloads
- Remove the
webhookparameter from your API calls
Webhook Signature Mismatch?
Webhook Signature Mismatch?
Possible reasons for signature mismatch:
- Ensure you are using the correct salt value from the correct environment (Sandbox or Production)
- Make sure you are computing the HMAC-SHA256 of the raw JSON payload
- Verify the signature is being read from the
Hitpay-Signatureheader
Facing Invalid Business API Key Error?
Facing Invalid Business API Key Error?
Possible reasons for this error:
- You are using a production key in the sandbox or a sandbox key in production. Make sure the API base URL is correct.
- You are missing headers. Ensure that you include both the ‘Content-Type’ and ‘X-Requested-With’ headers.
Production Checklist
Production Checklist
Ensure the following before moving to production:
- Change the base URL for all API calls to
https://api.hit-pay.com/v1/ - Complete payment method setup in production
- Update API keys and Salt values from the production dashboard
- Register your webhook URL in production
Why does my charges `webhook status` show as failed?
Why does my charges `webhook status` show as failed?
If you are using a payment plugin, after every successful payment, a webhook is sent to your store to acknowledge the payment confirmation. Your order is marked as paid through this webhook.A webhook status showing as "failed" indicates that Hitpay failed to communicate with your server. This can happen for the following reasons:
- Your store may have a security feature that blocked Hitpay's request.
- Your server was unavailable during this time.
- Production:
3.1.13.32,52.77.254.34 - Sandbox:
54.179.156.147