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
Header
| Field Name | Type | Value | Required |
|---|---|---|---|
| Content-Type | String(30) | Fixed value "application/json;charset=utf-8" | Yes |
| X-TIMESTAMP | String(29) | Current time, format 2022-09-16T16:58:47.964+07:00 | Yes |
| X-SIGNATURE | String(64) | Signature. For details see Data Signing Rules | Yes |
| X-PARTNER-ID | String(20) | Merchant ID | Yes |
| X-REQUEST-ID | String(64) | Unique ID for each request | Yes |
Body
| Parameter | Type | Required | Remarks |
|---|---|---|---|
| requestId | String(64) | Yes | Unique identifier on every request |
| merchantId | String(20) | Yes | Unique ID provided by payment gateway to merchant |
| storeId | String(30) | No | Only if using branch ID |
| paymentType | String(20) | Yes | Payment type |
| requestAmount | decimal(12,2) | Yes | Payment amount |
| feeType | String(3) | No | Fee deduction type: BEN/OUR. Default BEN. OUR adds fee to order amount automatically. |
| agreementId | String(32) | Yes | Agreement ID, can be obtained via subscription order query |
| notifyUrl | String(200) | No | URL for reminder/cancellation/complete notification |
| redirectUrl | String(200) | No | Frontend return URL for initial subscription |
| subTitle | String(128) | Yes | Subscription title shown to user |
| subMessage | String(256) | No | Subscription description shown to user |
| subInterval | String | Yes | DAILY/WEEKLY/MONTHLY |
| + productInfo | Object | Yes | Recurring product/service details |
| - id | String(10) | Yes | Product ID |
| - name | String(32) | Yes | Product Name |
| - price | decimal(12,2) | Yes | Amount in IDR, supports two decimals |
| - type | String(20) | Yes | Product Type |
| - url | String(200) | No | Product URL |
| - quantity | Number(4) | Yes | Product Quantity |
paymentType
| Payment Type | Code |
|---|---|
| CreditCard | StaticCcSub,DynamicCcSub |
Create Subscription Response Parameter
Header
| Field Name | Type | Value | Required |
|---|---|---|---|
| Content-Type | String(30) | Fixed value "application/json;charset=utf-8" | Yes |
| X-TIMESTAMP | String(29) | Current time, format 2022-09-16T16:58:47.964+07:00 | Yes |
| X-SIGNATURE | String(64) | Signature. For details see Data Signing Rules | Yes |
| X-PARTNER-ID | String(20) | Merchant ID | Yes |
| X-REQUEST-ID | String(64) | Unique ID for each request | Yes |
Body
| Parameter | Type | Required | Remarks |
|---|---|---|---|
| requestId | String(64) | Yes | Unique ID for each request |
| errCode | String(32) | Yes | 0 means success, otherwise see Error Code |
| errCodeDes | String(128) | No | Error description |
| merchantId | String(20) | Yes | Unique ID provided by payment gateway to merchant |
| storeId | String(30) | No | If using branch ID |
| paymentType | String(20) | Yes | Payment type |
| requestAmount | Decimal(12,2) | No | Amount at request |
| amount | decimal(12,2) | Yes | Amount in IDR, with 2 decimals |
| agreementId | String(32) | Yes | Agreement ID, can be obtained via subscription order query |
| createTime | String(16) | No | yyyyMMddHHmmss |
| status | String(32) | No | INIT: Subscription request created, FAILED: request failed |
| checkoutUrl | String(variable) | No | URL for user to complete subscription |
| expiredTime | String(v) | No | yyyyMMddHHmmss (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"
}