post-api-auth-subscriptions

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
  • Accept
    Type: string
    required

    Advertises which content types the client can understand

  • Content-Type
    Type: string
    required

    Set this header to application/json

  • x-pch-digest
    Type: string
    required

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

  • Accept-Language
    Type: string

    Language parameter

  • id-token
    Type: string

    A token that contains identity information about the authenticated user. It is used to verify the user’s identity and is required only when authentication is performed using Advanced Authentication. This token alone does not grant access to Punchh APIs. To access the APIs, you must include the id_token in the id-token header and the access_token in the Authorization header. See Access Punchh APIs Using Access and ID tokens

  • Authorization
    Type: string
    required

    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. Note: When authentication is performed using Advanced Authentication, you must include the id_token in the id-token header and the access_token in the Authorization header. See Access Punchh APIs Using Access and ID tokens

Body
application/json
  • authentication_token
    Type: string
    required

    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.

  • auto_renewal
    Type: boolean
    default: 
    false
    required

    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
    Type: string
    required

    Client key of the business

  • end_time
    Type: string
    min length:  
    1
    Format: date-time
    required

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

  • payment_card_uuid
    Type: string

    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.

  • plan_id
    Type: integer
    required

    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.

  • purchase_price
    Type: numberFormat: float
    required

    Price at which one unit of the subscription plan is purchased

  • start_time
    Type: string
    min length:  
    1
    Format: date-time
    required

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

Responses
  • 200
    Type: object
    • end_time
      Type: string
      min length:  
      1
      Format: date-time
      required

      Date and time (in ISO 8601 format) until which the subscription plan purchased for the guest will remain active

    • external_plan_identifier
      Type: string

      UPC/SKU of the subscription plan as present on third-party applications of enterprise businesses and is configured on this subscription plan. This will be stored in the database, and the business can use it for analytics purposes.

    • start_time
      Type: string
      min length:  
      1
      Format: date-time
      required

      Date and time (in ISO 8601 format) from which the subscription plan purchased for the guest will become active

    • subscription_id
      Type: integer
      required

      System-generated unique ID of the subscription plan that is issued for a guest

  • 400
    Type: object
    • errors
      Type: object
      required
  • 401
    Type: object
    • errors
      Type: object
      required
  • 412
    Type: object
    • errors
      Type: object
      required
  • 422
    Type: object
    • errors
      Type: object
      required
post/api/auth/subscriptions
{
  "subscription_id": 1,
  "start_time": "2021-04-28T13:59:47+05:30",
  "end_time": "2021-04-28T13:59:47+05:30",
  "external_plan_identifier": "string"
}