Purchase Subscription

​

This API supports the purchase of a subscription plan created 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.

Headers

  • Advertises which content types the client can understand

  • Set this header to application/json

  • Signature generated using the request path, body, and OAuth secret provided by the business. For details, see signature

  • Language parameter

  • You may pass the access_token instead of the authentication_token in Online Ordering endpoints to authorize the request. It must be supplied as Bearer ACCESS_TOKEN_GOES_HERE.

Body

application/json
  • The authentication token of the user, required if the HTTP_AUTHORIZATION header is not added. You can retrieve this from the response of a successful sign in API call or through the SSO process.

  • A 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".

  • Client key of the business

  • Date and time (in ISO 8601 format) until which the subscription being issued will remain active

  • System-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.

  • Price at which one unit of the subscription plan is purchased

  • Date and time (in ISO 8601 format) from which the subscription being issued will become active

  • Unique digital identifier/token of the user's credit card can be referred to as the uuid of the saved payment card, required if a saved payment card is used for payments. The transaction token is issued by a payment processor used by a business.

Responses

  • application/json
  • application/json
  • application/json
  • application/json
  • application/json
Request Example for post/api/auth/subscriptions
curl https://SERVER_NAME_GOES_HERE.punchh.com/api/auth/subscriptions \
  --request POST \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'x-pch-digest: ' \
  --header 'Accept-Language: en' \
  --header 'Authorization: Bearer ACCESS_TOKEN_GOES_HERE' \
  --data '{
  "client": "CLIENT_GOES_HERE",
  "authentication_token": "AUTH_TOKEN_GOES HERE",
  "plan_id": 23,
  "start_time": "2023-04-28T13:59:47+05:30",
  "end_time": "2023-04-28T13:59:47+05:30",
  "purchase_price": "23.09",
  "auto_renewal": "true",
  "payment_card_uuid": "PAYMENT_CARD_UUID_GOES_HERE"
}'
{
  "subscription_id": 23,
  "start_time": "2021-04-28T13:59:47+05:30",
  "end_time": "2021-04-28T13:59:47+05:30",
  "external_plan_identifier": "EXTERNAL_PLAN_IDENTIFIER GOES HERE"
}