Dana Subscription

Create Dana Subscription

Create DANA subscription via Paylabs API.

Request URL

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

HTTPMethod: POST

EndpointUrl: /dana/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 ID for each request
merchantIdString(20)YesUnique ID provided by payment gateway to merchant
storeIdString(30)NoIf merchant has branches and wants to create order using branch ID
paymentTypeString(20)YesPayment Type
requestAmountdecimal(12,2)YesAmount at request
feeTypeString(3)NoFee deduction type: BEN/OUR. Default BEN. OUR adds fee to order amount automatically.
merchantTradeNoString(32)YesMerchant order number
notifyUrlString(200)NoURL for payment reminder/cancellation/complete notification
returnUrlString(200)NoFrontend return URL for initial subscription
subTitleString(128)YesSubscription title shown to user
subMessageString(256)NoSubscription description shown to user
+ subIntervalObjectYesDAILY/WEEKLY/MONTHLY
- typeString(10)YesDAILY: Day, WEEKLY: Week, MONTHLY: Month
- valueNumber(2)YesInterval value, 1-99
+ 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
DANA E-Wallet (supports refund)StaticDanaSub,DynamicDanaSub

Create Subscription Response Parameters

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 merchant has branches and wants to create order using branch ID
paymentTypeString(20)YesPayment Type
requestAmountDecimal(12,2)NoAmount at request
amountdecimal(12,2)YesAmount in IDR, with 2 decimals
merchantTradeNoString(32)YesMerchant order number (unique subscription ID)
createTimeString(16)NoyyyyMMddHHmmss
statusString(32)No01: Subscription created 02: Payment successful 06: Subscription canceled 09: Subscription creation failed
checkoutUrlString(variable)NoURL for user to complete subscription
expiredTimeString(v)NoyyyyMMddHHmmss (checkoutUrl unusable after expiry)

Example

Request

POST  /dana/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
{
  "requestId": "PYeb8699ac-f46b-491f-a415-c894e9a5bca7",
  "merchantId": "010001",
  "paymentType": "StaticDanaSub",
  "requestAmount": 15000,
  "feeType": "BEN",
  "merchantSubId": "PY-1763012574.0645576",
  "notifyUrl": "https://merchant-domain.com/xxx",
  "redirectUrl": "https://paylabs.co.id/home.html",
  "subTitle": "test subTitle",
  "subMessage": "test subMessage",
  "subInterval": {
    "type": "WEEKLY",
    "value": "1"
  },
  "productInfo": {
    "id": "1",
    "name": "test",
    "price": 15000,
    "type": "1",
    "quantity": 1
  }
}

Response

POST /dana/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": "PYeb8699ac-f46b-491f-a415-c894e9a5bca7",
  "errCode": "0",
  "paymentType": "StaticDanaSub",
  "requestAmount": 15000,
  "amount": 15000,
  "merchantSubId": "PY-1763012574.0645576",
  "createTime": "20251113124254",
  "status": "01",
  "checkoutUrl": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "expiredTime": "20251113125254"
}