Purchase Subscription
This API allows third-party platforms (e.g., middleware that interfaces with the mobile app of the business) to purchase a new subscription plan in the Punchh platform without the need for guests to be logged in to the Punchh platform.
If a business is migrating active subscriptions from an incumbent system to the Punchh platform, the subscription ID for each user in the incumbent system can be mapped to the corresponding subscription ID in the Punchh platform.
If the Single Use setting is enabled for the subscription plan, and if you send auto_renewal as true in the Purchase Subscription API, then the API returns an error: This is a single use subscription and cannot be renewed automatically. Please check the request to send auto_renewal as false.
- Type: stringContent
- Type requiredapplication/json
- Type: stringAcceptrequired
application/json
- Type: stringAuthorizationrequired
Bearer token for admin authorization, who is making a call on behalf of the customer
- Type: booleanauto
_renewal requiredA guest’s preference of having a newly purchased subscription plan get automatically renewed per the plan's schedule. Third parties where auto renewal is considered default should send this value as "true".
- Type: stringend
_time min length:1Format: date-timerequiredDate and time (in ISO 8601 format) until which the subscription being issued will remain active
- Type: integerlocation
_id requiredID of the location where the subscription plan is purchased. It identifies the origin of the subscription purchase for the loyalty guest. If an invalid or missing location_id is passed, the API returns a 400 Bad Request error with the message "Invalid or missing location_id".
- Type: integerFormat: int64plan
_id requiredSystem-generated unique ID of a subscription plan created in the Punchh platform. A subscription based on this plan ID will be issued to the guest when a purchase call is made.
- Type: numberFormat: floatpurchase
_price requiredPrice charged to the user for purchasing the subscription plan
- Type: stringstart
_time min length:1Format: date-timerequiredDate and time (in ISO 8601 format) from which the subscription being issued will become active
- Type: integerFormat: int64user
_id requiredSystem-generated unique ID of a guest created on the Punchh platform
- Type: numberFormat: floatinitial
_debits Number of discounted units for the migrated subscription. Based on this value, further discounting of units will be done in the Punchh system after the guest migrates. This value should not be included in lifetime_debits and should be sent only once at the time of making the purchase call for migration. This is relevant only if the value of the "migration" parameter is "true".
- Type: numberFormat: floatinitial
_savings Volume of savings for the migrated subscription. Further savings in the Punchh platform will be added to this. This value should not be included in lifetime_savings and should be sent only once at the time of making the purchase call for migration. This is relevant only if the value of the "migration" parameter is "true".
- Type: numberFormat: floatlifetime
_debits Total discounted units under this plan ID, issued in the incumbent system before the guest migrated over to Punchh. This value should be sent only once at the time of making the purchase call for migration. This is relevant only if the value of the "migration" parameter is "true".
- Type: numberFormat: floatlifetime
_savings Total volume of savings under this plan ID, issued in the incumbent system before the guest migrated over to Punchh. This value should be sent only once at the time of making the purchase call for migration. This is relevant only if the value of the "migration" parameter is "true".
- Type: booleanmigration
This key determines if a particular purchase call should be considered as a fresh purchase or the migration of an existing subscription from the incumbent system to the Punchh platform. A value of "true" indicates that this purchase is a migration, and value of "false" indicates that this is a fresh purchase.
- application/json
- application/json
- application/json
- application/json
- application/json
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/dashboard/subscriptions/purchase \
--request POST \
--header 'Content-Type: application/json' \
--header 'Accept: ' \
--header 'Authorization: ' \
--data '{
"user_id": 1234,
"start_time": "2021-05-18 11:34:46",
"plan_id": 12,
"end_time": "2021-05-28 11:34:46",
"purchase_price": 20,
"auto_renewal": false,
"migration": false,
"lifetime_debits": 30,
"lifetime_savings": 50,
"initial_debits": 10,
"initial_savings": 20,
"source_subscription_id": "null",
"location_id": 12345
}'
{
"subscription_id": 123,
"start_time": "2021-05-18 11:34:46",
"end_time": "2021-05-28 11:34:46",
"external_plan_identifier": "string",
"location_id": 1
}