Recurring
Create a Subscription
Request URL
- Sandbox
- Production
POST https://sandbox-th.lianlianpay-inc.com/gateway
POST https://api.lianlianpay.co.th/gateway
Request Parameters
Field | Type | Required | Description |
---|---|---|---|
version | String | Interface version number, fixed value: v1 | |
service | String | Fixed value: llpth.recurring.create | |
merchant_id | String(20) | Unique ID for merchant assigned by LianLian | |
store_id | String(20) | Store ID. Unique identifier of the store | |
merchant_subscribe_id | string(64) | Unique ID of subscription created by merchant | |
plan_name | string(255) | Specify plan name for reference | |
plan_desc | string(256) | Description of the plan | |
interval_type | string(10) | The type of interval for a plan: DAILY, WEEKLY, MONTHLY, YEARLY | |
interval | string(2) | Used together with interval_type to define how often the customer should be charged. For example, if you billing customer every 2 month, then interval_type = MONTHLY, interval = 2. Value limit note: | |
total_terms | string(10) | The number of billing cycles for which the customer should be charged. For example, if a customer is buying a 1-year subscription billed on a monthly basis, this value should be 12. Minimum value is 2. | |
billing_amount | string (8, 2) | Amount to be charged of each billing cycle | |
billing_currency | string (3) | Currency | |
retry | string (1) | Y or N. If you pass Y, when a charge fails, it will be automatically retried on the following day. Charges have a maximum of 3 retry attempts. If it fails 3 consecutive times, it will change to SUSPEND status | |
start_date | string(10) | Format: yyyy-MM-dd Date of the subscription should start. For example, if you set a trial period, provide a future start date. Default is current date, which is start immediately. Note: for monthly billing cycle, for start date is 29th, 30th, 31st, If a month doesn’t have the date, the subscription will be billed on the last day of the month. | |
customer | Customer | Customer information | |
notify_url | string(256) | Subscription result notification URL | |
redirect_url | string(256) | URL that user is redirected when subscription is successful. |
Response Parameters
Field | Type | Required | Description |
---|---|---|---|
merchant_id | string(20) | Unique ID for merchant assigned by LianLian | |
merchant_subscribe_id | string(64) | Unique ID of subscription created by merchant | |
recurring_bill_id | string(20) | Recurring Billing ID generated by LianLian | |
recurring_bill_status | string(8) | Recurring billing status | |
create_time | string(19) | Subscription created time | |
link_url | string(256) | Checkout page URL of a subscription |
see General Response Message for generic response field
Request & Response sample
- Request
{
"version": "v1",
"service": "llpth.recurring.create",
"merchant_id": "142019050800009001",
"merchant_subscribe_id": "test_020",
"plan_name": "plan name",
"plan_desc": "plan desc",
"interval_type": "DAILY",
"interval": "7",
"billing_amount": "100.00",
"billing_currency": "THB",
"retry": "Y",
"start_date": "2022-02-28",
"total_terms": "10",
"customer": {
"merchant_user_id": "m_user_01",
"full_name": "coba"
},
"notify_url": "https://www.lianlianpay.co.th/sample/callback",
"redirect_url": "https://www.lianlianpay.co.th/sample/redirect"
}
- Response
{
"code": 200000,
"data": {
"merchant_id": "142019050800009001",
"merchant_subscribe_id": "test_020",
"recurring_bill_id": "122020040700160021",
"recurring_bill_status": "CREATED",
"create_time": "2020-02-28 13:19:02",
"link_url": "checkout_url"
},
"message": "Success",
"trace_id": "54e2983e66b738e6"
}
Update a Subscription
Request URL
- Sandbox
- Production
POST https://sandbox-th.lianlianpay-inc.com/gateway
POST https://api.lianlianpay.co.th/gateway
Request Parameters
Field | Type | Required | Description |
---|---|---|---|
version | string | Interface version number, fixed value: v1 | |
service | string | Fixed value: llpth.recurring.update. Recommended for merchant already integrated with multiple payment methods | |
merchant_id | string(20) | Unique ID for merchant assigned by LianLian | |
merchant_subscribe_id | string(64) | Unique ID of subscription created by merchant | |
plan_name | string(255) | Specify plan name for reference | |
plan_desc | string(256) | Description of the plan | |
interval_type | string(10) | The type of interval for a plan: DAILY, WEEKLY, MONTHLY, YEARLY | |
interval | string(2) | Used together with interval_type to define how often the customer should be charged. For example, if you billing customer every 2 month, then interval_type = MONTHLY, interval = 2. Value limit note: | |
total_terms | string(10) | The number of billing cycles for which the customer should be charged. For example, if a customer is buying a 1-year subscription billed on a monthly basis, this value should be 12. Minimum value is 2. | |
billing_amount | string (8, 2) | Amount to be charged of each billing cycle | |
billing_currency | string (3) | Currency | |
retry | string (1) | Y or N. If you pass Y, when a charge fails, it will be automatically retried on the following day. Charges have a maximum of 3 retry attempts. If it fails 3 consecutive times, it will change to SUSPEND status | |
start_date | string(10) | Format: yyyy-MM-dd Date of the subscription should start. For example, if you set a trial period, provide a future start date. Default is current date, which is start immediately. Note: for monthly billing cycle, for start date is 29th, 30th, 31st, If a month doesn’t have the date, the subscription will be billed on the last day of the month. |
Response Parameters
Field | Type | Required | Description |
---|---|---|---|
merchant_id | string(20) | Unique ID for merchant assigned by LianLian | |
merchant_subscribe_id | string(64) | Unique ID of subscription created by merchant | |
recurring_bill_id | string(20) | Recurring billing ID generated by LianLian | |
recurring_bill_status | string(8) | Recurring billing status | |
create_time | string (19) | Subscription created time | |
link_url | string(256) | Checkout page URL of a subscription |
see General Response Message for generic response field
Request & Response sample
- Request
{
"version": "v1",
"service": "llpth.recurring.update",
"merchant_id": "142019050800009001",
"merchant_subscribe_id": "test_020",
"plan_name": "plan name",
"plan_desc": "plan desc",
"interval_type": "MONTHLY",
"interval": "4",
"billing_amount": "200.00",
"billing_currency": "THB",
"retry": "N",
"start_date": "2022-03-01",
"total_terms": "11"
}
- Response
{
"code": 200000,
"data": {
"merchant_id": "142019050800009001",
"merchant_subscribe_id": "test_020",
"recurring_bill_id": "122020040700160021",
"recurring_bill_status": "ACTIVE",
"link_url": "checkout_url"
},
"message": "Success",
"trace_id": "54e2983e66b738e6"
}
Cancel a Subscription
Request URL
- Sandbox
- Production
POST https://sandbox-th.lianlianpay-inc.com/gateway
POST https://api.lianlianpay.co.th/gateway
Request Parameters
Field | Type | Required | Description |
---|---|---|---|
version | string | Interface version number, fixed value: v1 | |
service | string | Fixed value: llpth.recurring.cancel | |
merchant_id | string(20) | Unique ID for merchant assigned by LianLian | |
merchant_subscribe_id | string(64) | Unique ID of subscription created by merchant |
Response Parameters
Field | Type | Required | Description |
---|---|---|---|
see General Response Message for generic response field
Request & Response sample
- Request
{
"version": "v1",
"service": "llpth.recurring.cancel",
"merchant_id": "142019050800009001",
"merchant_subscribe_id": "test_020"
}
- Response
{
"code": 200000,
"message": "Success",
"trace_id": "54e2983e66b738e6"
}
Checkout Page Redirection
When the deduction is successful, Lianlian Thailand will redirect back to the "redirect_url" which was provided by merchant in the payment application. The redirect method is HTTP POST form. Add signature to other parameters except “sign_type” and “sign”. The final status of the order shall be subject to asynchronous notification or inquiry.
Parameters (Lianlian Thailand to merchant):
Field | Type | Required | Description |
---|---|---|---|
merchant_id | string(64) | Merchant ID | |
merchant_subscribe_id | string(64) | Unique ID of subscription created by merchant | |
recurring_bill_id | string(20) | Recurring Billing ID generated by LianLian | |
status | string(8) | SUCCESS, FAIL | |
billing_amount | string(8,2) | Amount to be charged of each billing cycle | |
billing_currency | string(3) | Currency | |
type | string(20) | Notification type: | |
sign_type | string(3) | RSA | |
sign | string(256) | Signature |