Step 2 - Create a Subscription
Create Subscription Offering
Now that you have a merchant scoped token you can create a subscription offering. Subscription offerings allow a merchant to enroll users in reoccurring transactions on a daily, weekly, monthly, or yearly basis.
Create Subscription Workflow
Create the Subscription
HTTP request
Sandbox - POST <https://staging-api.aeropay.com/transaction>
Production - POST <https://api.aeropay.com/transaction>
Request parameters
Parameter | Required? | Type | Description |
---|---|---|---|
name | Yes | String | Name of the subscription plan |
merchantAccountId | No | String | Aeropay id of merchant's bank account. Defaults to merchant's selected bank. |
amount | Yes | String | JSON formatted Array of money amounts, in cents. (ex: $10 = 1000) |
notes | Yes | String | JSON formatted Array of Plan amounts, in dollars. |
periodicity | Yes | String | How often the subscription is billed (Daily, Weekly, Monthly, Yearly) |
freeTrial | No | String | Length of free trial, same options as periodicity. |
periodDate | Yes | String | Date the subscription will be billed. Yearly: Month Day (e.g. Apr 12), Monthly: Day of month (e.g. 5), Weekly: Day of Week (e.g. Monday), Daily: no value required. |
type | Yes | String | Subscription offer type, Consumer or Business. 0 for Consumer, 1 for Business. |
Code Example - Request
curl --request POST \
--url https://staging-api.aeropay.com/subscriptions \
--header 'accept: application/json' \
--header 'authorizationToken: Bearer {{token}}' \
--header 'content-type: application/json' \
--data '
{
"periodicity": "Monthly",
"name": "Bretts Burgers VIP",
"amounts": "[1000, 2000, 5000]",
"notes": "[10, 20, 50]",
"freeTrial": "Weekly",
"periodDate": "1",
"type": "0"
}
'
Code Example - Response
{
"subscription": {
"id": "370",
"merchantId": "1732",
"merchantAccountId": "1428",
"merchantName": "Bretts Burgers",
"amounts": "[1000, 2000, 5000]",
"notes": "[10, 20, 50]",
"periodicity": "Monthly",
"periodDate": "1",
"freeTrial": "Weekly",
"type": "0",
"removed": "0"
}
}
Updated 2 months ago