Purchase Gift Card

​

Enables a user to purchase a gift card using the app of a business. If the gift card purchase feature is disabled for the brand in the Punchh platform, the API returns a 422 error. Contact your Punchh representative to update this Punchh platform configuration.

Headers

  • The signature for the API call

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

  • Advertises which content types the client is able to understand

  • Preferred language

  • Set this header to application/json.

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

Body

application/json
  • Amount with which the user wants to purchase a gift card. The minimum value can be configured in the Punchh platform.

  • Name of the person who owns the payment card used to purchase a gift card. Not needed for Apple Pay / Android Wallet

  • OAuth client ID provided by the business

  • ID of a particular gift card design selected by the user while purchasing a gift card

  • Expiration date of the payment card used by the user. Not needed for Apple Pay / Android Wallet

  • This parameter is required when a user makes a payment via saved cards. Send "recurring" as the value of this parameter.

  • Zip code as specified by the cardholder in the billing address

  • Unique digital identifier/token of the user's payment card, or the UUID of the saved payment card if the value of payment_type is "recurring". The transaction token is issued by a payment processor used by a business.

  • Type of payment card used by the user (e.g., Visa, Mastercard, etc.). Not needed for Apple Pay / Android Wallet

Responses

  • application/json
  • Please turn on <config_key> in Mobile Configuration before performing this gift card action.

Request Example for post/api2/mobile/gift_cards/purchase
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/mobile/gift_cards/purchase \
  --request POST \
  --header 'x-pch-digest: {{$$.env.signature}}' \
  --header 'Authorization: Bearer ACCESS_TOKEN_GOES_HERE' \
  --header 'Accept: application/json' \
  --header 'Accept-Language: en' \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: AppName/AppVersion/BuildNumber (OS; Model; MANUFACTURER; MODEL; OS Version)' \
  --data '{
  "client": "CLIENT_GOES_HERE",
  "design_id": 13,
  "amount": "10",
  "transaction_token": "TOKEN_GOES_HERE",
  "cardholder_name": "FIRST_NAME_GOES_HERE LAST_NAME_GOES_HERE",
  "exp_date": 419,
  "type": "VISA",
  "postal_code": 10004
}'
{
  "card_background_image": "IMAGE_URL_GOES_HERE",
  "card_number": "CARD_NUMBER_GOES_HERE",
  "epin": "EPIN_GOES_HERE",
  "usb_scannable_card_number": "CARD_NUMBER_GOES_HERE",
  "created_at": "2016-05-12T03:54:45-06:00",
  "design_id": 1,
  "preferred": false,
  "name": null,
  "last_fetched_amount": 10,
  "last_fetched_at": "2016-05-12T03:54:45-06:00",
  "status": "active",
  "updated_at": "2016-05-12T03:54:45-06:00",
  "users": [
    {
      "user_id": 111111111,
      "email": "test@example.com",
      "first_name": "FIRST_NAME_GOES_HERE",
      "last_name": "LAST_NAME_GOES_HERE",
      "fb_uid": null,
      "avatar_remote_url": null,
      "state": "owner"
    }
  ],
  "uuid": "ID_GOES_HERE",
  "gift_card_id": "ID_GOES_HERE",
  "auto_reload_enabled": true,
  "gc_user_auto_reload_threshold_amount": 50,
  "gc_user_auto_reload_default_amount": 50,
  "gc_user_auto_reload_preferred_payment": "PAYMENT_CARD_UUID_GOES_HERE"
}