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

ParameterRequired?TypeDescription
nameYesStringName of the subscription plan
merchantAccountIdNoStringAeropay id of merchant's bank account. Defaults to merchant's selected bank.
amountYesStringJSON formatted Array of money amounts, in cents. (ex: $10 = 1000)
notesYesStringJSON formatted Array of Plan amounts, in dollars.
periodicityYesStringHow often the subscription is billed (Daily, Weekly, Monthly, Yearly)
freeTrialNoStringLength of free trial, same options as periodicity.
periodDateYesStringDate 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.
typeYesStringSubscription 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"
  }
}