Create a subscription

Generate a subscription with all the settings you need.

Subscription Creation Flow

  1. The user initiates the subscription registration on the merchant's site.
  2. The merchant triggers the Create a subscription method in dLocal's API, including information such as subscription frequency, and start/end date.
  3. dLocal will respond with a URL which the merchant will use to redirect the user to dLocal's hosted payment page.
  4. There, the user will select the payment method, and complete the authentication process with the issuer.
  5. Once the issuer approved the authentication, the merchant will receive a confirmation via API, alongside the subscription ID in the wallet.token field.

35383538

Example request

curl -X POST \
   -H 'X-Date: 2018-02-20T15:44:42.310Z' \
   -H 'X-Login: sak223k2wdksdl2' \
   -H 'X-Trans-Key: fm12O7G9' \
   -H 'Content-Type: application/json' \
   -H 'X-Version: 2.1' \
   -H 'User-Agent: MerchantTest / 1.0 ' \
   -H 'Authorization: V2-HMAC-SHA256, Signature: 1bd227f9d892a7f4581b998c21e353b1686a6bdad5940e7bb6aa596c96e0a6ec' \
   -d '{body}'
   https://api.dlocal.com/payments
   
   {
   "amount": 0,
   "currency": "INR",
   "country": "IN",
   "payment_method_id": "IR",
   "payment_method_flow": "REDIRECT",
   "payer": {
       "name": "Ram Devi",
       "email": "[email protected]",
       "phone": "+919000123456",
       "document": "HSECT4378A"
   },
   "wallet": {
       "save": true,
       "verify": true,
       "recurring_info": {
           "subscription_frequency_unit": "MONTH",
           "subscription_frequency": 1,
           "subscription_start_at": "20210101",
           "subscription_end_at": "20220101"
       },
       "capture": false
   },
   "order_id": "5346523564",
   "notification_url": "http://merchant.com/notifications",
   "callback_url": "http://merchant.com/callback"
}

Synchronous Response

{
   "id": "D-4-75c7473a-ab86-4e43-bd39-c840268747d3",
   "amount": 0,
   "currency": "INR",
   "payment_method_id": "IR",
   "payment_method_type": "WALLET",
   "payment_method_flow": "REDIRECT",
   "country": "IN",
   "created_date": "2018-12-26T20:37:20.000+0000",
   "status": "PENDING",
   "status_detail": "The payment is pending",
   "status_code": "100",
   "order_id": "5346523564",
   "notification_url": "http://merchant.com/notifications",
   "redirect_url": "https://api.dlocal.com/collect/pay/pay/M-0aa0cc00-094e-11e9-9f92-dbdad3ad0963?xtid=CATH-ST-1545856640-602791137"
}

Complete authentication

The user shall be redirected to the redirect_url to complete the authentication.

Asynchronous notifications

When there is a change of status in the subscriptions, we will send you a notification to the provided notification_url indicating wallet.token.

The wallet.token it’s the subscription token that needs to be passed on each recurring charge.

{
   "id": "D-4-75c7473a-ab86-4e43-bd39-c840268747d3",
   "amount": 0.00,
   "status": "VERIFIED",
   "status_detail": "The wallet was verified.",
   "status_code": "700",
   "currency": "INR",
   "country": "IN",
   "payment_method_id": "IR",
   "payment_method_type": "WALLET",
   "payment_method_flow": "REDIRECT",
   "payer": {
       "name": "Ram Devi",
       "email": "[email protected]",
       "phone": "+919000123456",
       "document": "HSECT4378A"
   },
   "wallet": {
       "token": "W-yu23y4ibnyiu23y4"
   },
   "order_id": "5346523564",
   "notification_url": "http://www.merchant.com/notifications",
   "created_date": "2018-12-26T20:37:20.000+0000"
}

Did this page help you?