Step 5 - Enroll user to Subscription
Create subscription enrollments
A subscription enrollment is a user specific object of their unique enrollment to a given subscription offering. The user will be charged based upon the periodicity of the Subscription offering until the date specified in the subscriptionEnrollment call or until the subscriptionEnrollment is deleted.
Create subscriptionEnrollment Workflow
Request parameters
Parameter | Required? | Type | Description |
---|---|---|---|
subscriptionOfferId | Yes | String | Subscription offerId being subscribed to - |
amount | Yes | String | Subscription amount. Must match amount from subscription offer. |
userBankAccountId | Yes | String | UserBankAccountId being charged |
endDate | No | String | End Date of subscription. Formatted as 'YYYY-MM-DD |
name | No | String | Name for subscriptionEnrollment. |
Code Example - Request
curl --request POST \
--url https://staging-api.aeropay.com/subscriptionEnrollment \
--header 'accept: application/json' \
--header 'authorizationToken: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdXRoIjoiNDMyIiwic3ViIjoidXNlcmZvcm1lcmNoYW50IiwianRpIjoiOWQ1ODdmZTQtMTNhOC00NmE4LWI1Y2YtMzUyYjlkNjhhMDI0IiwiZXhwIjoxNzMxNTMyMTM2LCJ1c2VybmFtZSI6IjBmMjU0MmE0LThlNjAtNGE3Mi1iM2ExLTA2NGYyZDY5NDNlOCJ9.o9Uxtkt5nAUjZRPR7MTd8LSE2Eq-Kgg2pxbDJEMisTI' \
--header 'content-type: application/json' \
--data '
{
"subscriptionOfferId": "370",
"amount": "1000",
"endDate": "2025-11-13",
"userBankAccountId": "781914",
"name": "subscribed"
}
'
Code Example - Response
{
"subscription": {
"id": "386",
"subscriptionOfferId": "370",
"amount": "10.00",
"name": "subscribed",
"userId": "1102575",
"userBankAccountId": "781914",
"subscribeDate": "11/13/2024",
"nextDate": "11/20/2024",
"endDate": "11/13/2025",
"subscriptionOffer": {
"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"
}
}
}
Updated 2 months ago