Credit Card Subscription

Create Credit Card Subscription

Create credit card subscription via Paylabs API.

Request URL

URL: ${ROOT_URL}/cc/v1/sub/createsub

HTTPMethod: POST

EndpointUrl: /cc/v1/sub/createsub

Create Subscription Request Parameters

Data Signing Rules

Field NameTypeValueRequired
Content-TypeString(30)Fixed value "application/json;charset=utf-8"Yes
X-TIMESTAMPString(29)Current time, format 2022-09-16T16:58:47.964+07:00Yes
X-SIGNATUREString(64)Signature. For details see Data Signing RulesYes
X-PARTNER-IDString(20)Merchant IDYes
X-REQUEST-IDString(64)Unique ID for each requestYes

Body

ParameterTypeRequiredRemarks
requestIdString(64)YesUnique identifier on every request
merchantIdString(20)YesUnique ID provided by payment gateway to merchant
storeIdString(30)NoOnly if using branch ID
paymentTypeString(20)YesPayment type
requestAmountdecimal(12,2)YesPayment amount
feeTypeString(3)NoFee deduction type: BEN/OUR. Default BEN. OUR adds fee to order amount automatically.
agreementIdString(32)YesAgreement ID, can be obtained via subscription order query
notifyUrlString(200)NoURL for reminder/cancellation/complete notification
redirectUrlString(200)NoFrontend return URL for initial subscription
subTitleString(128)YesSubscription title shown to user
subMessageString(256)NoSubscription description shown to user
subIntervalStringYesDAILY/WEEKLY/MONTHLY
+ productInfoObjectYesRecurring product/service details
- idString(10)YesProduct ID
- nameString(32)YesProduct Name
- pricedecimal(12,2)YesAmount in IDR, supports two decimals
- typeString(20)YesProduct Type
- urlString(200)NoProduct URL
- quantityNumber(4)YesProduct Quantity

paymentType

Payment TypeCode
CreditCardStaticCcSub,DynamicCcSub

Create Subscription Response Parameter

Header

Data Signing Rules

Field NameTypeValueRequired
Content-TypeString(30)Fixed value "application/json;charset=utf-8"Yes
X-TIMESTAMPString(29)Current time, format 2022-09-16T16:58:47.964+07:00Yes
X-SIGNATUREString(64)Signature. For details see Data Signing RulesYes
X-PARTNER-IDString(20)Merchant IDYes
X-REQUEST-IDString(64)Unique ID for each requestYes

Body

Error Code

ParameterTypeRequiredRemarks
requestIdString(64)YesUnique ID for each request
errCodeString(32)Yes0 means success, otherwise see Error Code
errCodeDesString(128)NoError description
merchantIdString(20)YesUnique ID provided by payment gateway to merchant
storeIdString(30)NoIf using branch ID
paymentTypeString(20)YesPayment type
requestAmountDecimal(12,2)NoAmount at request
amountdecimal(12,2)YesAmount in IDR, with 2 decimals
agreementIdString(32)YesAgreement ID, can be obtained via subscription order query
createTimeString(16)NoyyyyMMddHHmmss
statusString(32)NoINIT: Subscription request created, FAILED: request failed
checkoutUrlString(variable)NoURL for user to complete subscription
expiredTimeString(v)NoyyyyMMddHHmmss (checkoutUrl unusable after expiry)

Example

Request

POST  /cc/v1/sub/createsub
# HTTP Header
Content-Type: application/json;charset=utf-8
X-TIMESTAMP: 2022-09-16T16:58:47.964+07:00
X-SIGNATURE: xxxxxxxxx
X-PARTNER-ID: 010001
X-REQUEST-ID: xxxxxxxxxxxxxxxxxxxxxxxx

# HTTP Body
{
  "merchantId": "010001",
  "requestId": "N01029020230619290000003911687350380290",
  "paymentType": "StaticCcSub",
  "requestAmount": "20000",
  "agreementId": "PY-1762845307.595957",
  "notifyUrl": "https://merchant-domain.com/xxx",
  "subTitle": "test",
  "productInfo": {
    "id": "prod001",
    "name": "Product 001",
    "price": 100000,
    "type": "type001",
    "url": "https://paylabs.co.id",
    "quantity": 1
  },
  "subInterval": { "type": "DAILY", "value": 1 },
  "expiredDate": "2025-11-23",
  "redirectUrl": "https://paylabs.co.id"
}

Response

POST /cc/v1/sub/createsub
# HTTP Header
Content-Type: application/json;charset=utf-8
X-TIMESTAMP: 2022-09-16T16:58:47.964+07:00
X-SIGNATURE: xxxxxxxxx
X-PARTNER-ID: 010001
X-REQUEST-ID: xxxxxxxxxxxxxxxxxxxxxxxx

# HTTP Body
{
  "merchantId": "010001",
  "requestId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
  "errCode": "0",
  "paymentType": "StaticCcSub",
  "requestAmount": 20000,
  "amount": 20000,
  "agreementId": "PY-1762845307.595957",
  "createTime": "20251111141508",
  "status": "INIT",
  "checkoutUrl": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "expiredTime": "20251111142508"
}