For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

Auth Token can be retrieved in your portal dashboard under API page.

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-page

Query

Query
Type
Description

invoice_no

String

Your bill number

Request Body

Attributes

Property
Type
Description

collection_uuid*

String

Your Collection UUID

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.

Payment Service? Go to Payment Service to learn more about them and how to get their values.

HTTP Method: POST

Request Body

Request Attributes

Property
Type
Description

collection_uuid*

String

Your Collection UUID

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

payment_service_id*

Number

invoice_ref*

String

Merchant Invoice Reference

Response

Response Attributes

Property
Type
Description

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.

Duitnow QR payment_service_id must be provided in request body (example for duitnow QR: 114) For more details please refer to Payment Service.

Response

Response Attributes

Property
Type
Description

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:

Make sure to follow all the DuitNow QR guidelines. For more details, you can refer to this official DuitNow documentshttps://drive.google.com/file/d/16zu1efl7gI2vv_FExx8EoBVNHraAOkLk/view?usp=drive_link.

Last updated