Gift Cards .: Destroy Value

API Reference / v15

Destroy Gift Card Value

This endpoint destroys Gift Card value given a QR code. This endpoint should ONLY be used for correcting cashier error. It should not be used to “redeem” a gift card – that should be done through the orders endpoint.

Request Endpoint

POST /v15/merchants/:merchant_id/gift_card_value_removals

Authorization Required – Merchant Token in Header

Authorization: token 982-9a4218e4b6714b7b6b47890d0bf2f46544c99ff7a5957f72ef5637eaafdc73

Request Body

{
  "gift_card_value_removal": {
    "payment_token_data": "LU020000029080KFZ02I9A8V030000LU",
    "value_amount": 1000
  }
}

Request Parameters

Param Type Required Description
payment_token_data String Yes QR code data from gift card (input from the LevelUp Scanner).
value_amount Integer Yes The amount (in cents) of value to be destroyed from the gift card
merchant_id Integer Yes The merchant ID of the merchant involved in the gift card transaction

cURL Example

curl -X POST https://sandbox.thelevelup.com/v15/merchants/34/gift_card_value_removals \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 982-9a4218e4b6714b7b6b47890d0bf2f46544c99ff7a5957f72ef5637eaafdc73' \
  -d '{
  "gift_card_value_removal":{
    "payment_token_data":"LU020000029080KFZ02I9A8V030000LU",
    "value_amount": 100
  }
}'

Example Response

HTTP/1.1 200 OK

{
    "gift_card_value_removal": {
        "removed_value_amount": 100,
        "new_value_at_merchant_amount": 102,
        "old_value_at_merchant_amount": 202
    }
}

Response Parameters

Key Type Description
removed_value_amount Integer The value that was removed from the gift card
new_value_
at_merchant_amount
Integer The new total value available at that merchant
old_value_
at_merchant_amount
Integer The previous total value available at that merchant

Errors

QR Code not found

HTTP/1.1 404 Not Found

Tried to destroy 0 or negative value

HTTP/1.1 422 Unprocessable Entity

[
  {
    "error": {
      "object": "gift_cards/value_adder",
      "property": "base",
      "message": "You must remove a positive value."
    }
  }
]

Not authorized to load for that merchant (bad merchant token)

HTTP/1.1 401 Unauthorized

Tried to remove more value than remained on gift card

HTTP/1.1 422 Unprocessable Entity

[
  {
    "error": {
      "object": "gift_cards/value_adder",
      "property": "base",
      "message": "This gift card has a balance of $X.XX. Please retry with that amount."
    }
  }
]