Skip to main content

Recurring

Create a Subscription

Request URL

POST https://sandbox-th.lianlianpay-inc.com/gateway

Request Parameters

FieldTypeRequiredDescription
versionString
Y
Interface version number, fixed value: v1
serviceString
Y
Fixed value: llpth.recurring.create
merchant_idString(20)
Y
Unique ID for merchant assigned by LianLian
store_idString(20)
N
Store ID. Unique identifier of the store
merchant_subscribe_idstring(64)
Y
Unique ID of subscription created by merchant
plan_namestring(255)
Y
Specify plan name for reference
plan_descstring(256)
N
Description of the plan
interval_typestring(10)
Y
The type of interval for a plan:
DAILY, WEEKLY, MONTHLY, YEARLY
intervalstring(2)
Y
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:
  • DAILY, min 7- max 365
  • WEEKLY, min 1 - max 4
  • MONTHLY, min 1- max 12
  • YEARLY, allowed value is 1 only
  • total_termsstring(10)
    Y
    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_amountstring (8, 2)
    Y
    Amount to be charged of each billing cycle
    billing_currencystring (3)
    Y
    Currency
    retrystring (1)
    Y
    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_datestring(10)
    N
    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.
    customerCustomer
    Y
    Customer information
    notify_urlstring(256)
    N
    Subscription result notification URL
    redirect_urlstring(256)
    N
    URL that user is redirected when subscription is successful.

    Response Parameters

    FieldTypeRequiredDescription
    merchant_idstring(20)
    Y
    Unique ID for merchant assigned by LianLian
    merchant_subscribe_idstring(64)
    Y
    Unique ID of subscription created by merchant
    recurring_bill_idstring(20)
    Y
    Recurring Billing ID generated by LianLian
    recurring_bill_statusstring(8)
    Y
    Recurring billing status
    create_timestring(19)
    Y
    Subscription created time
    link_urlstring(256)
    Y
    Checkout page URL of a subscription
    tip

    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

    POST https://sandbox-th.lianlianpay-inc.com/gateway

    Request Parameters

    FieldTypeRequiredDescription
    versionstring
    Y
    Interface version number, fixed value: v1
    servicestring
    Y
    Fixed value: llpth.recurring.update.
    Recommended for merchant already integrated with multiple payment methods
    merchant_idstring(20)
    Y
    Unique ID for merchant assigned by LianLian
    merchant_subscribe_idstring(64)
    Y
    Unique ID of subscription created by merchant
    plan_namestring(255)
    Y
    Specify plan name for reference
    plan_descstring(256)
    N
    Description of the plan
    interval_typestring(10)
    Y
    The type of interval for a plan:
    DAILY, WEEKLY, MONTHLY, YEARLY
    intervalstring(2)
    Y
    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:
  • DAILY, min 7- max 365
  • WEEKLY, min 1 - max 4
  • MONTHLY, min 1- max 12
  • YEARLY, allowed value is 1 only
  • total_termsstring(10)
    Y
    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_amountstring (8, 2)
    Y
    Amount to be charged of each billing cycle
    billing_currencystring (3)
    Y
    Currency
    retrystring (1)
    Y
    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_datestring(10)
    N
    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

    FieldTypeRequiredDescription
    merchant_idstring(20)
    Y
    Unique ID for merchant assigned by LianLian
    merchant_subscribe_idstring(64)
    Y
    Unique ID of subscription created by merchant
    recurring_bill_idstring(20)
    Y
    Recurring billing ID generated by LianLian
    recurring_bill_statusstring(8)
    Y
    Recurring billing status
    create_timestring (19)
    Y
    Subscription created time
    link_urlstring(256)
    Y
    Checkout page URL of a subscription
    tip

    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

    POST https://sandbox-th.lianlianpay-inc.com/gateway

    Request Parameters

    FieldTypeRequiredDescription
    versionstring
    Y
    Interface version number, fixed value: v1
    servicestring
    Y
    Fixed value: llpth.recurring.cancel
    merchant_idstring(20)
    Y
    Unique ID for merchant assigned by LianLian
    merchant_subscribe_idstring(64)
    Y
    Unique ID of subscription created by merchant

    Response Parameters

    FieldTypeRequiredDescription
    tip

    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

    info

    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):

    FieldTypeRequiredDescription
    merchant_idstring(64)
    Y
    Merchant ID
    merchant_subscribe_idstring(64)
    Y
    Unique ID of subscription created by merchant
    recurring_bill_idstring(20)
    Y
    Recurring Billing ID generated by LianLian
    statusstring(8)
    Y
    SUCCESS, FAIL
    billing_amountstring(8,2)
    N
    Amount to be charged of each billing cycle
    billing_currencystring(3)
    N
    Currency
    typestring(20)
    N
    Notification type:
  • Created: subscription created
  • Created_Deducted: subscription successfully billed
  • Updated: subscription successfully updated
  • Updated_Deducted: subscription successfully updated and billed
  • Deducted: subscription successfully billed
  • sign_typestring(3)
    Y
    RSA
    signstring(256)
    Y
    Signature