Create Bill
There are 2 ways when creating a bill. Both ways will generate a bill under a collection of your choice.
Authentication
LeanX uses Auth Token to authenticate in each request's header.
Request Header
{
"auth-token": "LP-0D7C06DE-MM|7394e58e-edee-4c42-9ca5-bcbc449f1b9f|2141df4a3cb633d5ce8683bb0c55067e5caebfbe07390dde277dc455bcc95c91723a81b5e565c7c02d68fb84e396722563016bf99e576a4b8cdbe4423fbf226b"
}Option 1 : Payment Page
This will create a bill and return a link to our LeanX Payment page.
HTTP Method: POST
https://api.leanx.dev/api/v1/merchant/create-bill-pageQuery
invoice_no
String
Your bill number
Request Body
Attributes
amount*
Decimal (10,2)
Total amount to be paid in MYR
callback_url
String
Your callback URL
redirect_url*
String
Your redirect URL
full_name*
String
Name of the payer
email*
String
Email of the payer
phone_number*
String
Mobile number of the payer
Response
Option 2 : Without Payment Page
This will create a bill and return a link straight to the payment service that you chose through payment_service_id.
HTTP Method: POST
Request Body
Request Attributes
amount*
Decimal (10,2)
Total amount to be paid in MYR
callback_url*
String
Your callback URL
redirect_url
String
Your redirect URL
full_name*
String
Name of the payer
email*
String
Email of the payer
phone_number*
String
Mobile number of the payer
invoice_ref*
String
Merchant Invoice Reference
Response
Response Attributes
bill_no
String
System generated bill number
invoice_ref
String
Merchant Invoice Reference
payment_url
String
URL where the customer completes payment
metadata
Object
QR code data. Empty for non-DuitNow QR payments.
Duitnow QR Payment Integration
There is two integration flows that are supported:
1. Redirect the customer to the LeanX-hosted QR payment page using payment_url.
2. Build and host your own QR payment page using the QR information returned in metadata.
Using the same endpoint and request body as other payment method.
Response
Response Attributes
bill_no
String
System generated bill number
invoice_ref
String
Merchant Invoice Reference
payment_url
String
URL where the customer completes payment
metadata
Object
QR code data. Empty for non-DuitNow QR payments.
metadata.qr_data
String
QR data returned according to qr_type.
metadata.qr_type
String
QR data format. Possible values are emv and png.
Option 1: LeanX-Hosted DuitNow QR Page
In the response, use the payment_url to redirect the user into our LeanX-Hosted DuitNow QR Payment page.
Status Check:
QR payment status check is handled automatically by our payment page. When payment is received, our payment page will redirect the user into page that you send in redirect_url.
Flow:
Option 2: Self-Hosted DuitNow QR payment page.
Use the raw QR Code metadata to display the payment QR directly, instead of redirecting to payment_url. The format varies by provider:
PNG — a base64-encoded image. Render it as-is (e.g.
<img src="data:image/png;base64,...">).EMV — a raw EMVCo QR string. Generate the QR code yourself using any QR library, then display it.
Check the format field in the metadata before rendering.
Status Check: To check whether the customer have completed the payment through QR Code, you can polling to our API https://api.leanx.dev/api/v1/merchant/manual-checking-transaction every 3 seconds, For more details, please refer to this sectionTransaction Status.
Flow:
Details Implementation
QR Type EMV Response Example:
QR Type PNG Response Example:
Code Implementation Example:
Last updated