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

Request Body

{
    "collection_uuid": "CL-C0D7F54A90-LNP",
    "amount": 10.00,
    "redirect_url": "https://www.yourdomain.com/return-page",
    "callback_url": "https://www.yourdomain.com/api-callback-url",
    "full_name": "John Doe",
    "email": "johndoe@email.com",
    "phone_number": "0123456789",
}

Attributes

Response

{
    "response_code": 2000,
    "description": "SUCCESS",
    "app_version": "/api/v1",
    "talk_to_server_before": "2024-03-27T21:46:07.403797",
    "data": {
        "collection_uuid": "CL-AUTH-35775712FA-LNP",
        "redirect_url": "https://payment.leanx.dev/collection?id=CL-AUTH-35775712FA-LNP&fullname=puteri balqis&email=puteri.balqis@gmail.com&phone_number=0112459822&invoice_no=speedmart-87654432&description=test description&amount=119.0&redirect_url=aHR0cHMlM0EvL2xlYW5pcy5jb20ubXk=&callback_url=https%3A//api.leanx.dev/api/v1/callback-url/callback-redirect%3F_uuid%3D2f49c906-4a1f-4cb4-bf46-949f9f77a6ce%26order_id%3DNone",
        "old_redirect_url": "https://portal.leanx.dev/pay/collections/CL-AUTH-35775712FA-LNP?fullname=puteri balqis&email=puteri.balqis@gmail.com&phone_number=0112459822&invoice_no=speedmart-87654432&description=test description&amount=119.0&redirect_url=aHR0cHMlM0EvL2xlYW5pcy5jb20ubXk=&callback_url=https%3A//api.leanx.dev/api/v1/callback-url/callback-redirect%3F_uuid%3D2f49c906-4a1f-4cb4-bf46-949f9f77a6ce%26order_id%3DNone",
        "bill_no": "speedmart-87654432"
    },
    "breakdown_errors": "",
    "token": ""
}

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

https://api.leanx.dev/api/v1/merchant/create-bill-silent

Request Body

{
    "collection_uuid": "CL-C0D7F54A90-LNP",
    "amount": 10.00,
    "redirect_url": "https://www.yourdomain.com/return-page",
    "callback_url": "https://www.yourdomain.com/api-callback-url",
    "full_name": "John Doe",
    "email": "johndoe@email.com",
    "phone_number": "0123456789",
    "payment_service_id": 33,
    "invoice_ref" : "INV202311280001"
}

Attributes

Response

{
  "response_code": 2000,
  "description": "SUCCESS",
  "app_version": "/api/v1",
  "talk_to_server_before": "2023-01-31T14:28:30.842232",
  "data": {
    "bill_no": "EXAMPLE-BILL-001",
    "transaction_invoice_no": "FPX1700639540AlnAnAy0",
    "redirect_url": "https://www.yourdomain.com/return-page"
  }
}

Last updated