Fetch Subscription Plans for a User

This API returns the subscriptions attached to a guest's profile. While the response can be filtered based on "status" and "past_subscriptions", the default response will include subscriptions that are either "active" or "soft_cancelled" and have their end time in the future.

Query Parameters
  • filter
    Type: string

    Filter subscription by status and past_subscriptions.

    If the status is not sent, the API returns subscriptions that are active, soft_cancelled, and have an end_time that is not in the past. Supported "filter” values are ''active'', ''expired'', and ''cancelled''.

    When the API call is made using the past_subscriptions filter, the response returns only such subscriptions that have their end date/time in the past. The status against each subscription can have these values: ‘expired’, ‘renewed’, ‘soft_cancelled’, and ‘hard_cancelled’.'

Headers
  • x-pch-digest
    Type: string
    required

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

  • Authorization
    Type: string
    required

    Used to authorize the request with access_token. It should be supplied as Bearer ACCESS_TOKEN_GOES_HERE.

  • Content-Type
    Type: string
    required

    Set this header to application/json

  • User-Agent
    Type: string
    required

    Used to identify the software, device, and application initiating the request, providing information about the client to the server. For details, see User Agent.

  • Accept-Language
    Type: string

    Preferred language. Punchh supports multiple languages for the subscription plan name, description, and miscellaneous parameters in the API response as per the locale specified in the Accept-Language request header. Possible values: es for Spanish, fr for French, fr-ca for French-Canada, en-CY for English-Cyprus, ro for Romania, es-US for Spanish United States, etc. The locales for a business are configured in the Punchh platform under Administration > Business Profile > Address > Alternate Languages. Administrators have to configure Name, Description, and Miscellaneous fields in the relevant language(s) on the subscription plan in the Punchh platform under Wallet and Passes > Subscription Plans. If these fields are not configured in Punchh in the language specified in the Accept-Language request header, then the API response will include the subscription plan name, description, and miscellaneous parameters with empty values.

  • Accept
    Type: string
    required

    Advertises which content types the client can understand

Body
application/json
  • client
    Type: string
    required

    OAuth client ID provided by the business

Responses
  • application/json
  • application/json
  • application/json
  • application/json
  • application/json
Request Example for get/api2/mobile/user_subscriptions
curl 'https://SERVER_NAME_GOES_HERE.punchh.com/api2/mobile/user_subscriptions?filter=' \
  --header 'x-pch-digest: ' \
  --header 'Authorization: Bearer ACCESS_TOKEN_GOES_HERE' \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: AppName/AppVersion/BuildNumber (OS; Model; MANUFACTURER; MODEL; OS Version)' \
  --header 'Accept-Language: en' \
  --header 'Accept: application/json' \
  --data '{
  "client": "CLIENT_GOES_HERE"
}'
{
  "has_any_subscriptions": true,
  "subscriptions": [
    {
      "subscription_id": 19,
      "start_time": "2021-05-18T21:09:38+05:30",
      "end_time": "2021-06-03T21:09:38+05:30",
      "plan_id": 9,
      "image": "test-image.png",
      "cancellation_reason": "Found better alternative",
      "cancelled_at": null,
      "name": "fuel_price",
      "description": "",
      "miscellaneous": "",
      "status": "Active",
      "external_plan_identifier": "EXTERNAL_PLAN_IDENTIFIER_GOES_HERE",
      "plan_image_url": "PLAN_IMAGE_URL_GOES_HERE",
      "renewed_on": "2023-04-10T05:00:00+05:30",
      "upcoming_renewal": "2023-05-11T05:00:00+05:30",
      "purchase_price": 100,
      "auto_renewal": true,
      "benefits": [
        {
          "benefit_id": 3,
          "benefit_type": "sku_discounting",
          "discounts": [
            {
              "discount_id": 7,
              "threshold": 40,
              "discounted_value": 80,
              "discounted_quantity": 40
            },
            {
              "discount_id": 8,
              "threshold": 1000,
              "discounted_value": 1000,
              "discounted_quantity": 1000
            }
          ]
        }
      ],
      "payment_card": {
        "uuid": "SAVED_CARD_UUID",
        "nickname": "My card",
        "card_details": {
          "name_on_card": "CARDHOLDER_NAME_GOES_HERE",
          "cc_4": "1111",
          "card_type": "Visa",
          "expiry_month": "09",
          "expiry_year": "23"
        },
        "cancellation_feedback": "Found better alternative"
      }
    }
  ]
}