API: GET Offer Redemption

Overview

Using the byn_transaction_id within the path, you are able to pull an offer redemption record using: api.banyan.com/rest/v1/offer/redemption/byn_transaction_id

The byn_transaction_id is found in the response to the POST transaction call..

The offer redemption has many objects within it:

  1. Offer Redemption Meta Data: elements about the offer redemption (id, timestamp, etc)
  2. Offer Result Information: elements about qualified items, amounts
  3. Offer Details: elements about the relevant offer
  4. Matching details: elements about the match itself (timestamp, id)
  5. Original transaction details: elements that were sent to Banyan by the FinX including some Banyan enrichments like location/category information
  6. Receipt details of the matched receipt: elements pertaining to the matched receipt including items and store information

Authentication and Authorization

Contact your Banyan representative to obtain an API key and Access ID to be used on the authorization end point. Once you have your key and ID, you will use the following curl call to obtain your token. Tokens expire every 30 minutes. Using a retired token will result in a 404 error response.

Offer redemptions that your transaction are tied to are available to be extracted from the Banyan platform. You will not be able to pull offer redemptions for transactions you do not own.

TOKEN=$(curl -s -X POST \
    -H 'Content-Type: application/json' \
    --data "{\"access_id\":\"$ACCESS_ID\",\"api_key\":\"$API_KEY\"}" \
    ${GATEWAY_URL}/token | jq -r .data[0])

Headers

Header NameDescriptionRequiredValues
BearerAccess TokenRequiredSee Authorization section
Content-TypeThe transaction format to sendOptionalapplication/JSON
AcceptThe response format sent backOptionalapplication/JSON

URL

api.banyan.com/rest/v1/offer/redemption/{{byn_transaction_id}} where byn_transaction_id is the transaction you want offer redemption information for.

Response

offer_redemption

NameDescriptionTypeNotes
idBanyan created ID of the offer redemption objectStringA new redemption record will be generated for every transaction at a merchant for a given account/card match
fulfillment_countCount of fulfilled redemptions for this offer activation before this record was deliveredStringA fulfillment_count of 0 means that previous to this record, no fulfillments were recorded for this particular offer activation

offer_redemption.campaign

NameDescriptionTypeNotes
idBanyan created ID to represent one or many offers that belong to the same marketing budgetString
nameUser generated name for the campaignStringCan be updated at any time
byn_publisher_idBanyan client ID for the publisher/provider of the campaignString
created_tsWhen the campaign was created in UTCRFC3339
updated_tsWhen a campaign was updated lastRFC3339

offer_redemption.offer_activation

NameDescriptionTypeNotes
byn_publisher_idThe ID given to your organization from BanyanNumericReach out to your Customer Support representative if you are unsure what your byn_publisher_id is
publisher_consumer_tokenThe unique ID your organization has for an accountString
cardsThe cards that are valid for the offerArray of strings
created_tsWhen an activation was createdRFC3339
updated_tsWhen an activation was last updatedRFC3339

offer_redemption.offer

NameDescriptionTypeNotes
byn_offer_idBanyan created ID of the offer object.String
publisher_offer_idUnique ID provided by the publisher used to create the byn_offer_id as well as the key to tie Banyan data back to FinX internal dataString
nameUser generated offer nameString
byn_campaign_idBanyan created unique ID for the campaignString
return_receipt_detailWhether the offer redemption record delivered back to the FinX has full receipt details or simply the resultBooleanValid values are true, false. Default is true
byn_advertiser_idBanyan created client/merchant ID that the campaign is advertisingString
byn_publisher_idBanyan created client/finx ID that the campaign is fulfilled byString
amount_back_limitThe highest amount the customer can receive for the offerStringRelevant when the offer is a % back of a purchase. If left null, there will be no limit.
amount_back_per_dollarRate of the reward per dollarStringExamples noted below
amount_back_typeWhether the reward is dollars or pointsStringPotential values: dollars, points, miles
start_tsWhen the offer is valid to be redeemedRFC3339Should be sent in UTC
expiration_tsWhen the offer endsRFC3339Should be sent in UTC. If you want the offer to extend for a long period of time, choose a date far out in the future.
always_onWhether it is an always on offerBoolean
offer_criteriaTop level objectObject
currencyCurrency of the amount back limit and amount thresholdStringAll amounts must be in the same currency
allow_activation_after_purchaseWhether opting into the offer has to happen before the purchase of the qualified items for it to fulfill the reward criteriaBoolean
prorate_qualified_spendWhether all payments on the transaction count towards the offer criteria or only the payment that has the card activationBoolean

offer_redemption.offer.offer_criteria

NameDescriptionTypeNotes
order_typesPurchase method such as web, in_store, or phoneArray of StringsThere is no default, but if you do not add any values here, no offer redemptions will be created
incl_tagsKey value pairs that represent item attributes that are valid for the offerArray of key value strings
excl_tagsKey value pairs that represent item attributes that are invalid for the offerArray of key value strings
include_skuSKUs that are included in the offerArray of Strings
exclude_skuSKUs that are excluded from the offerArray of Strings
amount_thresholdThe amount of money that must be spent to qualify for the offerString
fulfillment_count_limitHow many times can the offer be reused by the same card/accountString0 means there is no limit

offer_redemption.enriched_transaction

See enriched transaction schema here

offer_redemption.result

This object will tell you with the fulfilled field whether the attached receipt contents resulted in a reward for the card holder. In addition, the result offers some useful information for both payouts and customer support. This object will tell you the IDs of the items that qualified/did not qualify for the offer as well as the total amount of the qualified items.

NameDescriptionTypeNotes
items.qualified_total_amountTotal amount of the items that are included in the offer criteriaStringCurrently only in USD
fulfilledIf true, the offer is fulfilled. If false, the offer is not fulfilledBoolean
items.qualified_idsThe Banyan given IDs of the items that are included in the offer criteriaString
items.unqualified_idsThe Banyan given IDs of the items that are not included in the offer criteriaString
amount_backThe calculated amount the user receives based on their spend and offer criteriaString
fulfillment_countThe number of times a reward has been redeemed by the same finx consumer token and card not including the offer redemption it is part ofStringExample: The first time the offer is fulfilled the repeat_amount will show "0", the next time will show "1", and so on

Example unfulfilled offer:

{
  "data": [
    {
      "id": "a90b6501-3587-4946-995f-e246c0330d04",
      "campaign": {
        "byn_campaign_id": "75ffa112-1ee4-57ae-b887-73061ae94b74",
        "name": "July 2024 Gas Promotion",
        "byn_publisher_id": 000,
        "created_ts": "2024-06-26T16:58:24.450235Z",
        "updated_ts": "2024-06-26T16:58:24.450235Z"
      },
      "offer_activation": {
        "id": "552b71fc-99be-50bd-b1cf-bc8620684087",
        "byn_publisher_id": 000,
        "publisher_consumer_token": "55555555555",
        "cards": [
          "5718"
        ],
        "created_ts": "2024-07-15T16:08:18.515494Z",
        "updated_ts": "2024-07-15T16:08:18.515494Z"
      },
      "offer": {
        "byn_offer_id": "3d147491-467c-5d84-800c-66e376361d0a",
        "name": "NON WOW July 2024 Gas Offer",
        "publisher_offer_id": "555555",
        "return_receipt_detail": true,
        "always_on": false,
        "byn_advertiser_id": 001,
        "byn_publisher_id": 000,
        "amount_back_limit": "5",
        "amount_back_per_dollar": "0.2",
        "amount_back_type": "DOLLAR",
        "start_ts": "2024-07-01T04:00:00Z",
        "expiration_ts": "2024-07-09T03:59:00Z",
        "offer_criteria": {
          "order_types": [
            "any"
          ],
          "incl_tags": [
            "category_name:|:UNEADED PREMIUM\t",
            "category_name:|:E85 FUEL",
            "category_name:|:UNLEADED MID GRADE",
            "category_name:|:ETHANOL FREE FUEL",
            "category_name:|:UNLEADED REGULAR",
            "category_name:|:DIESEL",
            "fuel_prepay:|:True"
          ],
          "excl_tags": [],
          "incl_sku": [],
          "excl_sku": [],
          "amount_threshold": "0",
          "fulfillment_count_limit": 1
        },
        "offer_hotel_criteria": null,
        "created_ts": "2024-06-26T17:08:37.841888Z",
        "updated_ts": "2024-06-26T17:08:37.841888Z",
        "currency": "",
        "allow_activation_after_purchase": true,
        "prorate_qualified_spend": true,
        "card_issuer": "",
        "card_types": null
      },
      "result": {
        "items": {
          "qualified_total_amount": "29.14",
          "qualified_ids": [
            "e0bd7473-8961-5b27-9a8d-768e9a2e97ca"
          ],
          "unqualified_ids": []
        },
        "fulfilled": true,
        "cumulative_qualified_total_amount": "29.14",
        "amount_back": "5.83",
        "hotel": {
          "qualified_dining_charges": null,
          "unqualified_dining_charges": null,
          "total_qualified_dining_spend": "0",
          "qualified_room_charges": null,
          "unqualified_room_charges": null,
          "total_qualified_room_spend": "0"
        }
      },
      "fulfillment_count": 0,
      "created_ts": "2024-07-15T16:34:30.840992882Z",
      "enriched_transaction": {
        "byn_etx_id": "197ca460-63bc-5854-a1f8-9b2cbc013b29",
        "match_ts": "2024-07-15T16:32:03.263Z",
        "transaction": {
          "byn_transaction_id": "8a3653c4-121b-5426-afe9-8b4966df4778",
          "purchase_ts": "2024-07-07T21:13:59.502Z",
          "received_ts": "2024-07-15T16:31:57.687Z",
          "authorization_ts": "2024-07-07T21:13:59.502Z",
          "merchant": {
            "name": "USA GAS"
          },
          "location": {
            "merchant_store_id": "",
            "name": "USA GAS #3691",
            "card_acceptor_names": null,
            "display_name": "",
            "phone_number": "",
            "address": {
              "address_line_one": "",
              "address_line_two": "",
              "city": "GIBSONIA",
              "state": "PA",
              "country": "",
              "postal_code": ""
            }
          },
          "payment": {
            "payment_type": "",
            "scheme": "",
            "card_last_four": "0000",
            "bin": "",
            "auth_code": "000054",
            "arn": "",
            "total_amount": "29.14",
            "currency": "USD",
            "finx_mid": "938293920329439",
            "virtual_card_last_four": "",
            "card_issuer": "",
            "card_type": ""
          },
          "order_type": "",
          "description": "",
          "finx_transaction_id": "9999999201583112",
          "finx_consumer_token": "55555555555",
          "custom_fields": null
        },
        "receipt": {
          "byn_receipt_id": "df9b1b4c-feff-56e5-b9bd-0a3a86746ccf",
          "hotel": null,
          "merchant_receipt_id": "3691-215-29-20240707171300",
          "merchant_mid": "",
          "purchase_ts": "2024-07-07T21:13:00Z",
          "order_ts": "",
          "received_ts": "2024-07-11T17:13:16.827Z",
          "merchant": {
            "name": "GAS USA"
          },
          "location": {
            "merchant_store_id": "3691",
            "name": "GAS USA GIBSONIA",
            "card_acceptor_names": null,
            "display_name": "",
            "phone_number": "",
            "address": {
              "address_line_one": "4099 Grandview Drive",
              "address_line_two": "",
              "city": "Gibsonia",
              "state": "PA",
              "country": "US",
              "postal_code": "15044"
            }
          },
          "order_type": "in_store",
          "fulfillment_type": "in_store",
          "currency": "USD",
          "merchant_total_amount": "29.14",
          "items": [
            {
              "byn_item_id": "e0bd7473-8961-5b27-9a8d-768e9a2e97ca",
              "merchant_item_id": "",
              "upc": "030034925017",
              "sku": "163745194",
              "image_url": "",
              "brand": "",
              "description": "FUEL STATION/REGULAR UNLEADED",
              "amount_paid": "29.14",
              "full_price_per_unit": "0.01",
              "discount_price_per_unit": "3.54",
              "quantity": "8.23",
              "unit_type": "gallon",
              "tags": [
                "department_name:|:Reg Unleaded",
                "department_id:|:84",
                "category_name:|:UNLEADED REGULAR",
                "category_id:|:7520"
              ]
            }
          ],
          "image_url": "",
          "barcode_url": "",
          "custom_fields": null,
          "payment": {
            "total_amount": "29.14",
            "payment_type": "CREDIT",
            "scheme": "MC",
            "shipping_amount": null,
            "subtotal_amount": "29.14",
            "tip_amount": "0",
            "tax_amount": "0",
            "other_positive_amounts": null,
            "other_negative_amounts": null,
            "cash_back_amount": "0",
            "is_virtual_card": null,
            "card_issuer": ""
          }
        },
        "byn_match_id": "c6909118-95a0-5a1e-805f-f3d5f00405c9"
      }
    }
  ],
  "errors": [],
  "request_id": "57b82203-ca08-4845-9a91-74fa530603b7"
}