This is a multi-page printable view. Click here to print.
AIR MILES API Documentation
- 1. AIR MILES Cash
- 1.1. Authentication & Authorization
- 1.2. API Library
- 1.3. Point-of-Sale Terminal Workflows
- 1.4. File Reconciliation
- 1.5. OpenAPI (Swagger-Spec)
- 2. AIR MILES Issuance
- 2.1. Authentication & Authorization
- 2.2. API Library
- 2.3. OpenAPI (Swagger-Spec)
- 3. Member Banner
- 4. Offer Service
- 5. Transaction History
1 - AIR MILES Cash
The purpose of this documentation is to provide a guide on how to integrate with the AIR MILES Cash API. As part of this documentation, we also include information on RESTful HTTPS requests/responses, error codes, the reconciliation process and integration environments.
Target audience
This material is intended to be used by a Partner wishing to integrate with the AIR MILES Cash API.
What is real-time redemption
The AIR MILES real-time platform provides Partners with a streamlined method for redeeming Collector’s AIR MILES Cash Reward Miles, online or in-store. Real-time redemption ensures your customer’s will be able to see their updated balances immediately before and after using their AIR MILES Cash Reward Miles.
Tip
- Collectors maintain one account, but have two balances (AM Cash and Dream Miles).
- Reward Miles earned in the AM Cash balance can be used as in-store redemptions at checkout.
- 95 AM Cash Reward Miles can be redeemed for $10, processed as an in-store purchase (at participating sponsor locations).
- Collectors can redeem up to a maximum of $750 a day across all participating sponsors.
Service level objective
Please contact our Partner support team for details on our Service Level Agreement (SLA). Refer to our “Escalation Guide” for contact details.
Integration environments
There are two sets of environments used by partners to integrate with the real-time checkout platform. These environments are configured similarly for consistent production-level quality, whether the partner has deployed to production or is still performing non-production testing.
Environment | Domain | Description |
---|---|---|
Certification | https://cert.airmilesapis.ca | Contains production quality code and test data used for developing and testing 3rd party integrations. |
Production | https://airmilesapis.ca | Contains production code and live user data for real-world 3rd party integrations. |
Note
All integration environments must be accessed via HTTPS only.Your AMRP project team
In preparation for launch, an AIR MILES team is pulled together to assist Partners with integration and setup. This team will provide the following services:
- Consulting Partners on the best technical solution to support AIR MILES Issuance based on system compatibility.
- Providing guidance for assessing Partner requirements, data exchange methods, and reconciliation.
- As well as overseeing a broad range of activities to meet the requirements of launch, including:
- Planning
- Communications
- Delivery
- Execution
- Monitoring
Commonly used acronyms
Name | Definition |
---|---|
AMRP | AIR MILES Rewards Program: The loyalty program itself consisting both AIR MILES issuance an redemption processes. |
AMRM | AIR MILES Rewards Miles: The loyalty program currency that Collectors earn and redeem for travel, merchandise and cash rewards. |
RTC | Real-Time Checkout: An AIR MILES API platform specifically tailored for “Real-Time Issuance” & redemption of AIR MILES “Reward Miles”. |
M2M | Machine-to-Machine: Refers to direct communication between devices using any communications channel, including wired and wireless. This includes CLIs, daemons, or services running on your back-end that self-authenticates and/or authorizes an application without collector interaction. |
POS | Point-of-Sale: Refers to the software/hardware component that handles transactional messages, as well as processing AIR MILES issuances and reversals (return transactions). |
1.1 - Authentication & Authorization
For more information on “Auth0” and the various authentication flows, click the button below.
1.2 - API Library
This section includes the four (4) AIR MILES Cash API endpoints listed below. Each page offers a brief summary of the API endpoint in question, common use-case scenarios, and sample request/response messages with response codes.
API endpoints
ECHO
Used to test and confirm that the real-time checkout platform is up and ready to process requests.
INQUIRE
Used to retrieve account balances and AIR MILES Cash offer information.
REDEEM
Used to redeem AIR MILES Cash Miles from a Collector’s account to be used towards their purchase.
REVERSE
Used to refund (aka reverse) an AM Cash Miles redemption.
Idempotent requests
All the API calls shown above (excluding ECHO
& INQUIRY
) support idempotency for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. For example, if a request to redeem miles from a Collector does not receive a response due to a network connection error, you can retry the request with the same idempotency key to guarantee that additional miles aren’t accidentally redeemed from the Collector’s account.
Note
To perform an idempotent request, you need to provide an additionalIdempotency-Key: <key>
header to the request.
What is an “Idempotency Key”
An “Idempotency Key” is a unique value generated by the client which the server uses to recognize subsequent retries of the same request. How you create unique keys is up to you, but we suggest using V4 UUIDs, or another random string with enough entropy to avoid collisions.
WARNING
If you omit the header in the request, then the content of the transaction itself will be used to detect if it’s a duplicate. This requires that you send the exact same request as before, including an identical timestamp. This process however does not guarantee idempotency and should only be used as a last resort.Sample header with Idempotency
curl -X POST https://cert.airmilesapis.ca/checkout/amcash/echo \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ...' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000' \
-d '{
Handling request/response messages
As described above, the RESTful specification defines a transaction as a pair of request and response messages that are used for information interchange.
Note
Mandatory parameters will be marked with an asterisk (*) in the subsequent pages.Message Type | Description |
---|---|
Request | |
Response | Content-Type is specified in the Header (e.g., application/json .responseCode .null or ’empty’ values are automatically excluded from the response body. |
Handling request timeouts
A request timeout has likely occurred if either of the following are true.
- You received a Response Code of
0008
- You didn’t receive any response at all
Upon experiencing a request timeout, your POS terminal should immediately attempt to retry the same request. The reattempted request MUST be identical to the initial request.
Important
If the new request does not match exactly with the initial request, the system will not recognize it as a “retry” request, but will register it as a brand new transaction. If the request continues to timeout and/or fail, an error message should be displayed to the cashier, as suggested in the section Displaying the reversal result.If at any time, AIR MILES real-time encounters an internal problem or network error while trying to return a “redemption response” to the partner, the redemption request will be automatically cancelled. Thereby ensuring the customer is not charged for a redemption that could not be redeemed.
Note
- If the retry succeeds, then the transaction must be included in the reconciliation report sent to AIR MILES.
- If the retry fails, the transaction must NOT be included in the reconciliation report, as no Miles were processed for the transaction.
For all other Response codes; when a particular code is received (e.g., 0002
, 0096
, etc.), the appropriate message should be displayed to the cashier, as shown in POS Workflows > Redemption.
Status/response codes
Status Code | Response Code | Display Message | Description |
---|---|---|---|
200 |
0000 |
Approved | The transaction was successful. The POS terminal AND receipt should display the appropriate information. |
202 |
0001 |
Approved - balance suppressed | The transaction was successful, however the Collector opted to not view their rewards balances. The printed receipt MUST NOT show the Collector’s ‘Cash’/‘Dream’ balances, or the available “AM Cash” that can be redeemed. |
401 |
0002 |
Collector account inactive | The Collector account is not active. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center. |
408 |
0008 |
Transaction timeout | The transaction timed out when a request was sent to the “Instant POS” Switch. The Partner’s Switch/POS Terminal should retry the request one (1) time. If a cashier receives this error, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
403 |
0009 |
Card not swiped or scanned | Redemption offers will not be sent if the Collector Card is not presented. The Collector Card is physically required to perform instant cash redemptions. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
401 |
0025 |
Invalid Collector number | The Collector number is invalid. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
400 |
0035 |
Invalid request parameter | A mistake was made when submitting the request. Please correct the error and try again. |
202 |
0051 |
Insufficient reward miles | The Collector has not earned enough in their “AIR MILES Cash” balance for the requested redemption amount. Please ask the Collector to go to airmiles.ca and check their redemption/earning history. |
400 |
0057 |
Invalid redemption confirmation number | The redemptionConfirmationNumber submitted is invalid. Please resubmit the request with the correct Redemption Confirmation Number. |
202 |
0065 |
Exceeded daily redemption limit | The Collector has exceeded the daily redemption limit. The Collector’s account has exceeded the maximum daily redemption amount. Please ask the Collector to wait until the following day to redeem more Cash miles. |
202 |
0066 |
Insufficient basket size | The Collector’s basket size is too small to make a redemption. The purchase amount is not enough to make a redemption. Ask the customer if they wish to add more items to their basket in order to make an AM Cash redemption. |
408 |
0067 |
Offer is temporarily unavailable | The offer being requested is temporarily unavailable. Please advise the Collector to try redeeming this offer at a later time. |
409 |
0080 |
Reversal window expired | The reversal window for the redemption has expired; meaning a reversal can no longer be submitted for this transaction. This usually happens when a reversal is attempted after 3:00 AM the day after the original transaction. Any reversals that are attempted past the 3:00 AM time-frame should be refunded to the customer via in-store credit or gift card. Please DO NOT RETURN CASH to the customer. |
503 |
0092 |
Scheduled outage | The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
0096 |
Server error or no response | An unknown error occurred while calling the “Instant POS” Switch". The Sponsor Switch/POS Terminal should retry one time and if the error persists, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
null |
null |
Missing or invalid “bearer” token | No valid “Bearer Token” present. Please generate a valid “Bearer” Token and submit to continue." |
1.2.1 - ECHO
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
This test ensures there are no known connectivity issues between AIR MILES and our partners. The ECHO call functions similarly to a standard ‘ping’ request, determining if a client or host is online and accessible. To receive a “Bearer Token” and authorize your request, use the client_id
/client_secret
provided to you by AIR MILES.
Note
It is highly recommended that all Partners use the ECHO test upon starting their integration, to ensure both systems can communicate properly. Also at the partner’s discretion, we recommend performing periodic ECHO tests at regular intervals to be notified immediately in the case of any unforeseen outages.Sample request
curl -X POST \
https://cert.airmilesapis.ca/checkout/amcash/echo \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ...' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"deviceId": "001",
"sponsorCode": "BMOA",
"storeId": "0001",
"traceId": "000012345678",
"vendorId": "100087"
}'
Header parameters
Parameter | Description |
---|---|
Authorization | Token from authentication.
Example: |
Content-Type | Default value: application/json |
cache-control | Default value: no-cache |
Query parameters
Parameter | Description |
---|---|
none | none |
Body parameters
* Required field
Parameter | Description |
---|---|
deviceId * |
ID number used to identify the POS terminal currently in use.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
storeId * |
Alpha-numeric value used to identify the Partner’s location.
Example: |
traceId * |
Partner’s unique transaction tracking number.
Example: |
vendorId * |
Number used to identify the Partner and for downstream financial payments.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"deviceId": "001",
"message": "Approved",
"responseCode": "0000",
"sponsorCode": "1234",
"storeId": "0001",
"traceId": "000012345678",
"transDateTime": "2019-01-30T03:59:03",
"vendorId": "1234567890"
}
Response model
Includes all “Request” parameters listed above, plus the additional ones below.
Parameter | Description |
---|---|
message |
Text description of the response code.
Example: |
responseCode |
Number indicating the result of the transaction.
Example:
|
transDateTime |
Date and time when the response was sent. (see ISO-8601)
Example: |
Note
Responses will always include theresponseCode
and message
fields. If the original request was successful, the response will include the same parameters sent in the request body.
Status/Response codes
Status Code | Response Code | Display Message | Description |
---|---|---|---|
200 |
0000 |
Approved | The transaction was successful. The POS terminal AND receipt should display the appropriate information. |
408 |
0008 |
Transaction timeout | The transaction timed out when a request was sent to the “Instant POS” Switch. The Partner’s Switch/POS Terminal should retry the request one (1) time. If a cashier receives this error, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
400 |
0035 |
Invalid request parameter | A mistake was made when submitting the request. Please correct the error and try again. |
503 |
0092 |
Scheduled outage | The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
0096 |
Server error or no response | An unknown error occurred while calling the “Instant POS” Switch". The Sponsor Switch/POS Terminal should retry one time and if the error persists, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
none | none | Missing or invalid Bearer token | No valid Bearer token present. Please generate a valid Bearer token and submit to continue." |
1.2.2 - INQUIRE
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
Used to retrieve account balances and AIR MILES Cash offer information. Once a Partner receives a response, the POS terminal can acquire the reward miles Cash/Dream balances.
Note
These balances SHOULD be shown on the Collector’s sales-receipt, but SHOULD NOT be displayed on the POS terminal. The receipt and/or POS terminal may also display the Collector’s remaining daily availableCashBalance
and availableDollarAmount
taken from the response.
See the Response Model below for more information - or, for additional details on Response Messages and POS System Integration, please refer to POS Terminal Workflows.
Sample request
curl -X POST \
https://cert.airmilesapis.ca/checkout/amcash/inquire \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ...' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"acquirerId": "100000",
"cardEntryMode": "SWIPE",
"collectorNumber": "84095202006",
"dateTime": "1972-07-16T13:32:00+0400",
"deviceId": "001",
"instantMessage": "en-CA",
"postTaxBasketAmount": "16.12",
"sponsorCode": "BMOA",
"storeId": "0001",
"traceId": "999999999999",
"vendorId": "100087"
}'
Header parameters
Parameter | Description |
---|---|
Authorization | Token from authentication.
Example: |
Content-Type | Default value: application/json |
cache-control | Default value: no-cache |
Query parameters
Parameter | Description |
---|---|
none | none |
Body parameters
* Required field
Parameter | Description |
---|---|
acquirerId * |
The acquirer ID identifies the party that sends the request, usually this is the partner.
Example: |
cardEntryMode * |
The method that was used to enter the AIR MILES account number.
Example:
WARNING This does not work for Redemption. |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
dateTime * |
Date and time when the request was sent. (see ISO-8601)
Example: |
deviceId * |
ID number used to identify the POS terminal currently in use.
Example: |
instantMessage |
The Partner’s language preference for receiving the POS display messages.
Example: en-CA |
postTaxBasketAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
storeId * |
Alpha-numeric value used to identify the Partner’s location.
Example: |
traceId * |
Partner’s unique transaction tracking number.
Example: |
vendorId * |
Number used to identify the Partner and for downstream financial payments.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"acquirerId": "100000",
"availableCashBalance": "95",
"availableDollarAmount": "10",
"availableOfferUnits": "1",
"cashBalance": "120",
"collectorNumber": "1234567890123456789",
"dailyOfferLimit": "10",
"dateTime": "2019-01-30T04:39:59.503-0400",
"deviceId": "001",
"dreamBalance": "545",
"message": "Approved",
"offerDescEn": "Sample offer description in English.",
"offerDescFr": "Exemple de description de l'offre en français.",
"offerId": "1111111111",
"offerType": "RGL",
"responseCode": "0000",
"sponsorCode": "1234",
"storeId": "0001",
"traceId": "000012345678",
"transDateTime": "2019-01-30T11:41:55",
"unitValueAMCash": "95",
"unitValueDollars": "10.00",
"vendorId": "555555"
}
Response model
Includes all “Request” parameters listed above, plus the additional ones below.
Parameter | Description |
---|---|
availableCashBalance |
The remaining available daily limit of AM Cash redemptions, in Miles (post-transaction); or the Collector’s total Miles balance - whichever is lower.
Example: |
availableDollarAmount |
The dollar ($) amount available that the Collector can redeem.
Example: |
availableOfferUnits |
The number of AM Cash units available to the Collector at checkout (in multiples of $10/95 miles).
Example: |
cashBalance |
The Collector’s “AM Cash” account balance in Miles (post-transaction).
Example: |
dailyOfferLimit |
The limit of AM Cash units the Collector can redeem today.
Example: |
dreamBalance |
The Collector’s “AIR MILES Dream” account balance.
Example: |
message |
Text description of the response code.
Example: |
offerDescEn |
Offer description (English) |
offerDescFr |
Offer description (French) |
offerId |
AM Cash offer ID.
Example: |
offerType |
Either RGL (regular offers) or SPL (special/discounted offers).
Example: |
responseCode |
Number indicating the result of the transaction.
Example:
|
transDateTime |
Date and time when the response was sent. (see ISO-8601)
Example: |
unitValueAMCash |
The number of AM Cash miles required for a single redemption unit.
Example: |
unitValueDollars |
The dollar ($) value for a single unit of redemption.
Example: |
Note
Responses will always include theresponseCode
and message
fields. In addition, all fields that contain values (i.e., not null) will also be included in the response model.
Conditional parameters
The optional data elements contain information required to show the number of miles that can be redeemed and the discount that would be applied towards the purchase.
Note
The conditional response parameters listed below will ONLY be returned if the following conditions are met:
- The Collector number is swiped or scanned (i.e.,
cardEntryMode
=SWIPE
,SCAN
, orPREREGISTERED
) - The Collector has enough reward miles in their balance.
- The Collector has not exceeded their daily redemption limit.
Parameter | Description |
---|---|
availableOfferUnits |
Redemption offer units available for the current transaction.
Example: |
dailyOfferLimit |
The maximum number of units a Collector can redeem in a single day (i.e., a 24 hour period).
Example: |
offerDescEn |
Offer description (English) |
offerDescFr |
Offer description (French) |
offerId |
AM Cash offer ID.
Example: |
offerType |
Either RGL (regular offers) or SPL (special/discounted offers).
Example: |
unitValueAMCash |
The number of “AM Cash” miles required for a single redemption unit.
Example: |
unitValueDollars |
The dollar ($) value for a single unit of redemption.
Example: |
Status/Response codes
Status Code | Response Code | Display Message | Description |
---|---|---|---|
200 |
0000 |
Approved | The transaction was successful. The POS terminal AND receipt should display the appropriate information. |
202 |
0001 |
Approved - Balance suppressed | The transaction was successful, however the Collector opted to not view their rewards balances. The printed receipt MUST NOT show the Collector’s ‘Cash’/‘Dream’ balances, or the available “AM Cash” that can be redeemed. |
401 |
0002 |
Collector account inactive | The Collector account is not active. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center. |
202 |
0005 |
Balance suppressed, unable to redeem | The transaction was successful, but the Collector opted to not view their balances, or allow instant cash redemptions. The POS terminal MUST NOT prompt for an “AM Cash” Redemption. |
202 |
0006 |
Unable to redeem | The transaction was successful, but the Collector account is set to not allow instant “AM Cash” redemptions. The POS terminal MUST NOT prompt for an “AM Cash” Redemption. |
408 |
0008 |
Transaction timeout | The transaction timed out when a request was sent to the “Instant POS” Switch. The Partner’s Switch/POS Terminal should retry the request one (1) time. If a cashier receives this error, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
403 |
0009 |
Card not swiped or scanned | Redemption offers will not be sent if the Collector Card is not presented. The Collector Card is physically required to perform instant cash redemptions. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
401 |
0025 |
Invalid collector number | The Collector number is invalid. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
400 |
0035 |
Invalid request parameter | A mistake was made when submitting the request. Please correct the error and try again. |
202 |
0051 |
Insufficient AIR MILES reward Miles | The Collector has not earned enough in their “AIR MILES Cash” balance for the requested redemption amount. Please ask the Collector to go to airmiles.ca and check their redemption/earning history. |
408 |
0067 |
Offer is temporarily unavailable | The offer being requested is temporarily unavailable. Please advise the Collector to try redeeming this offer at a later time. |
503 |
0092 |
Scheduled outage | The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
0096 |
Server error or no response | An unknown error occurred while calling the “Instant POS” Switch". The Sponsor Switch/POS Terminal should retry one time and if the error persists, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
none | none | Missing or invalid “Bearer token” | No valid “Bearer Token” present. Please generate a valid “Bearer” Token and submit to continue." |
1.2.3 - REDEEM
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
To redeem Miles, the Collector’s card must be either scanned, swiped, or pre-registered (e.g., e-commerce site).
Important
Key-entering the Collector’s number manually is not a valid way to process a redemption request. Using this method will cause the transaction to fail.Redemption process
- The sales associate makes a redemption request at checkout by submitting a
dollarRedeemRequest
. - The maximum redemption amount is displayed on-screen, which is less than or equal to the
postTaxBasketAmount
. - The sales associate selects the appropriate redemption amount (
unitsRedeemed
) before completing the transaction.
Tip
Default redemption amount to be displayed
-
The total purchase amount after tax, rounded down to the nearest $10.
(e.g., if the post-tax basket amount is $43.35, the maximum allowable redemption would be $40) -
Or, the Collector’s maximum redeemable Cash balance - in multiples of $10.
Calculating the dollar amount
The dollar amount to be applied towards the purchase is calculated by multiplying the number of unitsRedeemed
by unitValueDollars
(which is currently $10 CAD).
Upon receiving the redemption response from our real-time checkout, the POS terminal should display and print the transaction confirmation number (i.e., txtConfirmationNumber
).
Sample request
curl -X POST \
https://cert.airmilesapis.ca/checkout/amcash/redeem \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ...' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"acquirerId": "100000",
"cardEntryMode": "SWIPE",
"collectorNumber": "84095202006",
"dateTime": "1972-07-16T13:32:00+0400",
"deviceId": "001",
"dollarRedeemRequest": "16.12",
"instantMessage": "en-CA",
"originalPostTaxBasketAmount": "16.12",
"originalPreTaxAmount": "16.12",
"postTaxBasketAmount": "16.12",
"sponsorCode": "BMOA",
"storeId": "0001",
"traceId": "999999999999",
"vendorId": "100087"
}'
Header parameters
Parameter | Description |
---|---|
Authorization | Token from authentication.
Example: |
Content-Type | Default value: application/json |
cache-control | Default value: no-cache |
Query parameters
Parameter | Description |
---|---|
none | none |
Body parameters
* Required field
Parameter | Description |
---|---|
acquirerId * |
The acquirer ID identifies the party that sends the request. Usually this is the partner.
Example: |
cardEntryMode * |
The method that was used to enter the AIR MILES account number.
Example:
WARNING This does not work for Redemption. |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
dateTime * |
Date and time when the request was sent. (see ISO-8601)
Example: |
deviceId * |
ID number used to identify the POS terminal currently in use.
Example: |
dollarRedeemRequest * |
The dollar amount available to be redeemed.
Example: |
instantMessage |
The partner’s language preference for receiving the POS display messages.
Example: en-CA |
originalPostTaxBasketAmount |
Original purchase amount, post-tax.
Example: |
originalPreTaxAmount |
Original purchase amount, pre-tax.
Example: |
postTaxBasketAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
storeId * |
Alpha-numeric value used to identify the Partner’s location.
Example: |
traceId * |
Partner’s unique transaction tracking number.
Example: |
vendorId * |
Number used to identify the Partner and for downstream financial payments.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"acquirerId": "100000",
"availableCashBalance": "95",
"availableDollarAmount": "10",
"cashBalance": "120",
"collectorNumber": "80000000001",
"dailyOfferLimit": "10",
"dateTime": "2019-01-30T04:39:59.503-0400",
"deviceId": "001",
"dreamBalance": "550",
"message": "Approved",
"milesRedeemed": "95",
"offerDescEn": "Sample offer description in English.",
"offerDescFr": "Exemple de description de l'offre en français.",
"offerId": "1111111111",
"offerType": "RGL",
"responseCode": "0000",
"sponsorCode": "1234",
"storeId": "0001",
"traceId": "000012345678",
"transDateTime": "2018-10-27T02:25:10",
"txnConfirmationNumber": "0000",
"unitsRedeemed": "1",
"unitValueAMCash": "95",
"unitValueDollars": "10.00",
"vendorId": "555555"
}
Response model
Includes all “Request” parameters listed above, plus the additional ones below.
Parameter | Description |
---|---|
availableCashBalance |
The remaining available daily limit of AM Cash redemptions, in Miles (post-transaction); or the Collector’s total Miles balance - whichever is lower.
Example: |
availableDollarAmount |
The dollar ($) amount available that the Collector can redeem.
Example: |
cashBalance |
The Collector’s AM Cash account balance in Miles (post-transaction).
Example: |
dailyOfferLimit |
The maximum number of units a Collector can redeem in a single day (i.e., a 24 hour period).
Example: |
dreamBalance |
The Collector’s “AIR MILES Dream” account balance.
Example: |
message |
Text description of the response code.
Example: |
milesRedeemed |
The number of AM Cash miles redeemed in the transaction.
Example: |
offerDescEn |
Offer description (English) |
offerDescFr |
Offer description (French) |
offerId |
AM Cash offer ID.
Example: |
offerType |
Either RGL (regular offers) or SPL (special/discounted offers).
Example: |
responseCode |
Number indicating the result of the transaction.
Example:
|
transDateTime |
Date and time when the response was sent. (see ISO-8601)
Example: |
txnConfirmationNumber |
The confirmation number returned upon a successful redemption. This value should be printed on the purchase receipt and is required to process a reversal.
Example: |
unitsRedeemed |
The number of AM Cash units redeemed in the transaction.
Example: |
unitValueAMCash |
The number of AM Cash miles required for a single redemption unit.
Example: |
unitValueDollars |
The dollar ($) value for a single unit of redemption.
Example: |
Note
Responses will always include theresponseCode
and message
fields. In addition, all fields that contain values (i.e., not null) will also be included in the response model.
Status/Response codes
Status Code | Response Code | Display Message | Description |
---|---|---|---|
200 |
0000 |
Approved | The transaction was successful. The POS terminal AND receipt should display the appropriate information. |
202 |
0001 |
Approved - balance suppressed | The transaction was successful, however the Collector opted to not view their rewards balances. The printed receipt MUST NOT show the Collector’s ‘Cash’/‘Dream’ balances, or the available “AM Cash” that can be redeemed. |
401 |
0002 |
Collector account inactive | The Collector account is not active. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center. |
202 |
0005 |
Balance suppressed, unable to redeem | The transaction was successful, but the Collector opted to not view their balances, or allow instant cash redemptions. The POS terminal MUST NOT prompt for an “AM Cash” Redemption. |
202 |
0006 |
Unable to redeem | The transaction was successful, but the Collector account is set to not allow instant “AM Cash” redemptions. The POS terminal MUST NOT prompt for an “AM Cash” Redemption. |
408 |
0008 |
Transaction timeout | The transaction timed out when a request was sent to the “Instant POS” Switch. The Partner’s Switch/POS Terminal should retry the request one (1) time. If a cashier receives this error, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
403 |
0009 |
Card not swiped or scanned | Redemption offers will not be sent if the Collector Card is not presented. The Collector Card is physically required to perform instant cash redemptions. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
401 |
0025 |
Invalid collector number | The Collector number is invalid. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
400 |
0035 |
Invalid request parameter | A mistake was made when submitting the request. Please correct the error and try again. |
202 |
0051 |
Insufficient AIR MILES reward Miles | The Collector has not earned enough in their “AIR MILES Cash” balance for the requested redemption amount. Please ask the Collector to go to airmiles.ca and check their redemption/earning history. |
202 |
0065 |
Exceeded daily redemption limit | The Collector has exceeded the daily redemption limit. The Collector’s account has exceeded the maximum daily redemption amount. Please ask the Collector to wait until the following day to redeem more Cash miles. |
202 |
0066 |
Insufficient basket size | The Collector’s basket size is too small to make a redemption. The purchase amount is not enough to make a redemption. Ask the customer if they wish to add more items to their basket in order to make an AM Cash redemption. |
408 |
0067 |
Offer is temporarily unavailable | The offer being requested is temporarily unavailable. Please advise the Collector to try redeeming this offer at a later time. |
503 |
0092 |
Scheduled outage | The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
0096 |
Server error or no response | An unknown error occurred while calling the “Instant POS” Switch". The Sponsor Switch/POS Terminal should retry one time and if the error persists, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
none | none | Missing or invalid “Bearer token” | No valid “Bearer Token” present. Please generate a valid “Bearer” Token and submit to continue." |
1.2.4 - REVERSE
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
Prior to requesting a “reversal”, a valid “redemption request”/“redemption response” must be exchanged in order to create the txnConfirmationNumber
required for the “reversal”.
WARNING
Key-entering the Collector’s number manually is not a valid way to process a redemption request. Using this method will cause the transaction to fail.
Also, please note that reversals can only be issued up until 3:00 AM EST the same day of the purchase, for a given transaction.
Reversal process
- The sales associate makes a REVERSAL request at checkout by submitting the
redemptionConfirmationNumber
for the transaction in question. - The POS system will prompt the sales associate to accept the return and issue a full monetary refund.
- Once completed, a response message containing all relevant fields will be returned to the POS system.
Tip
Calculating the reversal amount
The AM Cash API will calculate the Miles to reversed to the Collector when processing a reversal request. This number is based on the transaction ID of the original transaction, which is why it’s required to provide the redemptionConfirmationNumber
before proceeding.
Upon receiving the reversal response from our real-time checkout, the POS terminal should display and print the transaction confirmation number (i.e., txtConfirmationNumber
).
Receiving a timeout
If you receive a timeout (i.e., responseCode
0008) or you receive NO response at all, your POS terminal should automatically retry the reversal request. If the error persists, the POS terminal should display an error message (as explained in POS Terminal Workflows > Processing a Reversal).
Sample request
curl -X POST \
https://cert.airmilesapis.ca/checkout/amcash/reverse \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ...' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"acquirerId": "100000",
"cardEntryMode": "SWIPE",
"collectorNumber": "84095202006",
"dateTime": "1972-07-16T13:32:00+0400",
"deviceId": "001",
"redemptionConfirmationNum": "10000000000",
"sponsorCode": "BMOA",
"storeId": "0001",
"traceId": "999999999999",
"vendorId": "100087"
}'
Header parameters
Parameter | Description |
---|---|
Authorization | Token from authentication.
Example: |
Content-Type | Default value: application/json |
cache-control | Default value: no-cache |
Query parameters
Parameter | Description |
---|---|
none | none |
Body parameters
* Required field
Parameter | Description |
---|---|
acquirerId * |
The acquirer ID identifies the party that sends the request, usually this is the partner.
Example: |
cardEntryMode * |
The method that was used to enter the AIR MILES account number.
Example:
WARNING This does not work for Redemption. |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
dateTime * |
Date and time when the request was sent. (see ISO-8601)
Example: |
deviceId * |
ID number used to identify the POS terminal currently in use.
Example: |
redemptionConfirmationNum * |
Number used to identify the redemption transaction to reverse (void).
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
storeId * |
Alpha-numeric value used to identify the Partner’s location.
Example: |
traceId * |
Partner’s unique transaction tracking number.
Example: |
vendorId * |
Number used to identify the Partner and for downstream financial payments.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"acquirerId": "100000",
"availableCashBalance": "95",
"availableDollarAmount": "10",
"cashBalance": "120",
"collectorNumber": "80000000001",
"dateTime": "2019-01-30T04:39:59.503-0400",
"deviceId": "001",
"dreamBalance": "550",
"message": "Approved",
"milesReversed": "95",
"responseCode": "0000",
"sponsorCode": "1234",
"storeId": "0001",
"traceId": "000012345678",
"transDateTime": "2019-01-30T04:39:59",
"txnConfirmationNumber": "0000",
"unitsReversed": "1",
"unitValueAMCash": "95",
"unitValueDollars": "10",
"vendorId": "1234567890"
}
Response model
Includes all “Request” parameters listed above, plus the additional ones below.
Parameter | Description |
---|---|
availableCashBalance |
The remaining available daily limit of AM Cash redemptions, in Miles (post-transaction); or the Collector’s total Miles balance - whichever is lower.
Example: |
availableDollarAmount |
The dollar ($) amount available that the Collector can redeem.
Example: |
cashBalance |
The Collector’s AM Cash account balance in Miles (post-transaction).
Example: |
dreamBalance |
The Collector’s “AIR MILES Dream” account balance.
Example: |
message |
Text description of the response code.
Example: |
milesReversed |
The number of AM Cash miles reversed (refunded).
Example: |
responseCode |
Number indicating the result of the transaction.
Example:
|
transDateTime |
Date and time when the response was sent. (see ISO-8601)
Example: |
txnConfirmationNumber |
The confirmation number returned upon a successful redemption. This value should be printed on the purchase receipt and is required to process a reversal.
Example: |
unitsReversed |
The number of AM Cash units reversed (refunded).
Example: |
unitValueAMCash |
The number of AM Cash miles required for a single redemption unit.
Example: |
unitValueDollars |
The dollar ($) value for a single unit of redemption.
Example: |
Note
Responses will always include theresponseCode
and message
fields. In addition, all fields that contain values (i.e., not null) will also be included in the response model.
Status/Response codes
Status Code | Response Code | Display Message | Description |
---|---|---|---|
200 |
0000 |
Approved | The transaction was successful. The POS terminal AND receipt should display the appropriate information. |
202 |
0001 |
Approved - balance suppressed | The transaction was successful, however the Collector opted to not view their rewards balances. The printed receipt MUST NOT show the Collector’s ‘Cash’/‘Dream’ balances, or the available “AM Cash” that can be redeemed. |
401 |
0002 |
Collector account inactive | The Collector account is not active. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center. |
408 |
0008 |
Transaction timeout | The transaction timed out when a request was sent to the “Instant POS” Switch. The Partner’s Switch/POS Terminal should retry the request one (1) time. If a cashier receives this error, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
403 |
0009 |
Card not swiped or scanned | Redemption offers will not be sent if the Collector Card is not presented. The Collector Card is physically required to perform instant cash redemptions. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
401 |
0025 |
Invalid collector number | The Collector number is invalid. Please ask the Collector to visit the airmiles.ca self-serve page, online chat support, or contact our call-center to request a replacement card. |
400 |
0035 |
Invalid request parameter | A mistake was made when submitting the request. Please correct the error and try again. |
202 |
0051 |
Insufficient AIR MILES reward Miles | The Collector has not earned enough in their “AIR MILES Cash” balance for the requested redemption amount. Please ask the Collector to go to airmiles.ca and check their redemption/earning history. |
400 |
0057 |
Invalid redemption confirmation number | The redemptionConfirmationNumber submitted is invalid. Please resubmit the request with the correct Redemption Confirmation Number. |
202 |
0065 |
Exceeded daily redemption limit | The Collector has exceeded the daily redemption limit. The Collector’s account has exceeded the maximum daily redemption amount. Please ask the Collector to wait until the following day to redeem more Cash miles. |
202 |
0066 |
Insufficient basket size | The Collector’s basket size is too small to make a redemption. The purchase amount is not enough to make a redemption. Ask the customer if they wish to add more items to their basket in order to make an AM Cash redemption. |
408 |
0067 |
Offer is temporarily unavailable | The offer being requested is temporarily unavailable. Please advise the Collector to try redeeming this offer at a later time. |
409 |
0080 |
Reversal window expired | The reversal window for the redemption has expired; meaning a reversal can no longer be submitted for this transaction. This usually happens when a reversal is attempted after 3:00 AM the day after the original transaction. Any reversals that are attempted past the 3:00 AM time-frame should be refunded to the customer via in-store credit or gift card. Please DO NOT RETURN CASH to the customer. |
503 |
0092 |
Scheduled outage | The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
0096 |
Server error or no response | An unknown error occurred while calling the “Instant POS” Switch". The Sponsor Switch/POS Terminal should retry one time and if the error persists, they should escalate the issue as indicated in the “AM Cash - Sponsor Escalation Guide”. |
none | none | Missing or invalid “Bearer token” | No valid “Bearer Token” present. Please generate a valid “Bearer” Token and submit to continue." |
Handling timeouts
A request timeout has occurred if either of the following scenarios is true:
- You received a “response code” of
0008
- You received no response at all
Upon experiencing a request timeout, your POS terminal should immediately attempt a retry of the same transaction request. The “Retry Request” must match the initial request exactly.
If the new request does not match exactly with the initial request, the system will not recognize it as a “retry”, but will register it as a brand new transaction. If the request continues to timeout/fail, an error message should be displayed to the cashier and/or the customer, as suggested in the section Displaying the reversal result.
If at any time, our real-time checkout encounters an internal problem or network error while trying to return a “redemption response”; the redemption request will be automatically cancelled, thereby ensuring the customer is not charged for a redemption that could not be delivered.
For all other response codes; when a particular code is received (e.g., 0002
, 0096
, etc.), the appropriate message should be displayed to the cashier, as shown in POS Workflows > Redemption.
Important
Notes regarding “file reconciliation”:
- If the retry succeeds then the transaction must be included in the reconciliation report sent to AIR MILES.
- If the retry fails, the transaction MUST NOT be included in the reconciliation report, as no Miles were processed for the transaction.
1.3 - Point-of-Sale Terminal Workflows
This page provides POS (Point-of-Sale) display mock-ups which demonstrate the preferred method for displaying AM Cash transaction details to the customer.
Display Types
Pop-up displays
From here onward, we are assuming that your terminals can display a pop-up window over the main terminal display. However if your terminals have a more limited display functionality, a similar display interface can be built by integrating the new “AIR MILES Cash” elements into the main display area; this is shown in figure 1 below.

(Fig. 1) POS Terminal Home Screen
Text-based displays
There are also display mockups for text-based POS terminals. These mockups assume that the POS terminal has at least twenty (20) columns and four (4) rows. Throughout this section, the two mockups will be shown side-by-side where possible, to contrast the different interfaces.
Processing a Redemption
Upon receiving an AM Cash Inquiry response, the POS terminal should display relevant offer information to the Collector, which at a minimum should include the remaining daily limit of AM Cash units
the Collector can request.
AM Cash Redemption Facts
- 95 Miles = 1
unit
of AM Cash - 1
unit
of AM Cash = $10.00 in store credit - Daily AM Cash redemptions limited to 20
units
(or $200.00 in store credit) - Collector is required to have a minimum of 95 Cash Miles in their AIR MILES balance before making a redemption request
- Daily restriction time-frames reset each day at 03:00AM EST
See figure 3 below for more details
AIR MILES Cash Inquiry

(Fig. 2) AM Cash Inquiry - POS Terminal Mockup
In the example above, the AM Cash “Inquiry” screen displays the following key values:
Value | Description |
---|---|
95 | The number of reward Miles per unit . |
10 | The dollar (monetary) amount per unit . |
3 | The maximum number of units that can be redeemed for this transaction. |
20 | The maximum number of units that can be redeemed for the day. |
As previously stated, an offer is returned ONLY if the Collector has enough reward Miles to redeem at least a single unit
AND have not reached their daily redemption cap. If no offer is returned, the POS terminal won’t display any of the information shown above.
Tip
The Real-time Checkout platform returns units that can be redeemed, it DOES NOT return a dollar/monetary amount, nor does it return a bulk number of reward Miles. However, as explained above, it does return the set dollar amount and number of reward Miles per unit, so a quick multiplication is enough to calculate and display the quantities shown in figure 2 above.The Collector can redeem for a minimum of 95 reward Miles (which is equivalent to $10.00 CAD.), as well as further increments of 95 reward Miles.
Note
The maximum redemption for a purchase is 285 reward Miles (or 95 Miles * 3 Units), which equals a maximum redemption rate of $30.00 CAD per transaction.
The daily maximum redemption limit is 1,900 reward Miles (or 95 Miles * 20 Units), which equals a daily maximum redemption rate of $200.00.
If the AM Cash inquiry response has an offer available for the Collector, the POS terminal should give the cashier a visual cue, so they can ask the Collector for redemption.
We recommend using one of the following options:
- Preferred method
- Pop-up window with AIR MILES Cash information.
- For embedded interfaces
- Blinking cue for embedded AIR MILES Cash section.
- Alternative method
- If there is no way to do either of the above, have the cashier click an on-screen button to activate the AIR MILES Cash section.
Displaying on a text-based POS
Similar to the GUI-based screens shown above, a text-based terminal should display the minimum and increment values together with the maximum allowed (based on the qualifying amount). The Collector at this point has the option to either enter an amount or cancel and proceed with the remaining purchase flow.
Here’s an example of what a text-based display would look like.

(Fig. 3) Collector Info - POS Text Mockup
Displaying the Redemption
After the redemption request is sent and a response is received by the POS terminal, the redemption information can be shown as follows.

(Fig. 4) Cash Redemption - POS Terminal Mockup
The POS terminal should display the following:
- Transaction confirmation number
txnConfirmationNumber
- Number of reward Miles redeemed
unitValueAMCash
*unitsredeemed
- Remaining reward Miles for redemption
cashBalance
/unitValueAMCash
Displaying on a text-based POS
A text-based POS terminal could display the redemption information as follows.

(Fig. 5) Redemption Confirmation - POS Text Mockup
Following this screen, the rest of the payment flow continues normally.
Important
Due to the restricted display size, a text-based POS terminal does not have to display the transaction confirmation number (txnConfirmationNumber
) and available reward Miles (cashBalance
) to the customer and/or cashier; however, the printed receipt MUST ALWAYS include this information.
Text-based POS terminals that have the capability should display the number of reward Miles redeemed.
Printing the receipt
This section provides a mockup of what a receipt could look like.

(Fig. 6) Mockup Receipt - Collector Info
The receipt shown above follows the examples that has been used so far and shows the following:
Common basket details
- Partner details (business name, address, phone # etc.).
- Purchase details (item/basket info - includes a negative balance if returning a product).
- Sub-total, added sales tax, and total.
- Transaction confirmation number together with the dollar/monetary amount of the redemption.
AIR MILES specific basket details
- Masked Collector number (at least 3-digits in the middle must be masked, and the last four digits visible).
- Base and bonus AIR MILES reward Miles redeemed.
- Available “AIR MILES Cash” Rewards Miles balance.
- Available “AIR MILES Dream” Rewards Miles balance.
Note
For privacy reasons the Collector number must always be masked when appearing on a receipt or any other print/display materials!Processing a Reversal
In order to reverse a redemption all that is needed is the original redemption confirmation number, as the redemption is fully reversed (no partial reversals are done).
This is demonstrated in figure 7 below:

(Fig. 7) Voiding a Transaction - POS Terminal Mockup
The AM Cash reversal function should be made available to the cashier by way of a button or on-screen-display. Once this screen is displayed the cashier will need to enter the transaction confirmation number (txnConfirmationNumber
) and press a key to process the reversal (such as the Void button shown in the figure above).
Important
As mentioned previously, a reversal can only be processed up until 03:00AM EST (the same day of the original transaction). This means that if a redemption is completed at 01:00AM EST, then the Collector has only two (2) hours to reverse the transaction and recover their AIR MILES.Displaying the reversal
After a reversal request has been processed, a response containing a new transaction confirmation number should be received.
This is demonstrated in figure 8 below.

(Fig. 8) Refund Confirmation - POS Terminal Mockup
The POS terminal should display the total Miles refunded (milesReversed
), the available reward Miles (cashBalance
) and the new reversal confirmation number (txnConfirmationNumber
).
Printing the receipt
This section provides a mockup of how a receipt showing balances and redemption information could be organized.
See figure 9 below for more details:

(Fig. 9) Organization & Layout - POS Receipt Mockup
The receipt shown above follows the examples that has been used so far and shows the following:
Common basket details
- Partner details (business name, address, phone # etc.).
- Purchase details (item/basket info - includes a negative balance if returning a product).
- Sub-total, added sales tax, and total.
- Transaction confirmation number together with the dollar/monetary amount of the redemption.
AIR MILES specific basket details
- Masked Collector number (at least 3-digits in the middle must be masked, and the last four digits visible).
- Base and bonus AIR MILES reward Miles voided/reversed (calculated by the partner).
- Available “AIR MILES Cash” Rewards Miles balance.
- Available “AIR MILES Dream” Rewards Miles balance.
1.4 - File Reconciliation
A Reconciliation process has been established to ensure that successful “Redemption” and “Reverse” transactions match in both the partner’s systems and AIR MILES systems. This matching ensures that the number of transactions in both systems and the transaction values (e.g., amounts, dates) are identical.
What are reconciliation files
The Reconciliation files are sent to the Partner at regular intervals, and contain all successful Redemptions and Reversals that were reconciled on a given day.
The following sections describe the Reconciliation process, files, formats, and file transfer methods.
File formats and schedules
Each Reconciliation file contains the following:
- Header Records x2
- Trailer Records x2
- Detailed Records 0 or more
Reconciliation files are text-based and have a specific format (described below), use delimiters to separate fields, and are uncompressed & un-encrypted. Records within the reconciliation file use the standard ASCII character set, where fields within a record are separated by double percent characters (%%
), and records are separated by a new line character at the end of each line.
Since fields in the file records are delimited with percentage characters (%%
) there is no need for fillers or padding. As an example, the “amount” field is defined as Numeric and 4 characters in length, so in order to send 190 Miles, it is enough to send just those three digits (i.e., there is no need to send 0190
). Similarly, the “Card Terminal ID” is defined as Alphanumeric and 16 characters in length, so in order to send the characters SPON000101
there is no need to append filler spaces at the end of those characters.
Note
All examples in the following sections are based on regular runs containing data for a standard 24-hour period, with cut-off at 12:00AM EST.During normal processing times, reconciliation files will be created at regular intervals. For resubmissions, the files may contain more (or less) than 24-hours of transactions, and may include a different time range. However, in all instances the “Local Transaction Date/Time” of all records within the file must be between the BeginExtractDate
and EndExtractDate
values in the “Header” and “Trailer” records (see an example of the file format below).
Files sent to the partner
The naming of the reconciliation file uses the following format:
RECON_LMG_YYYYMMDD.txt
As an example, a reconciliation file created on July 19, 2020 would be named RECON_LMG_20200719.txt
.
Tip
TheYYYYMMDD
value should represent the file creation date (e.g., 20200625
for June 25, 2020). These files are transferred from AIR MILES after 2:00PM EST.
Sample file contents
H%%20100718070925%%20100718221523
S%%95001%%20100718070925%%20100718221523
D%%2210%%80000000001%%190%%358%%162824%%20100718%%39000000883%%SPON000101%%20.00
D%%2210%%80000000001%%190%%344%%070925%%20100718%%39000000842%%SPON001101%%20.00
D%%2210%%80000000001%%190%%355%%221523%%20100718%%39000000750%%SPON000121%%20.00
D%%2430%%80000000001%%190%%359%%162940%%20100718%%39000000883%%SPON000105%%20.00
D%%2210%%80000000001%%190%%2909%%083455%%20100718%%39000000644%%SPON000106%%20.00
D%%2430%%80000000001%%190%%2912%%143448%%20100718%%39000000636%%SPON000106%%20.00
D%%2210%%80000000001%%190%%341%%090658%%20100718%%39000000693%%SPON000101%%20.00
D%%2430%%80000000001%%190%%345%%151102%%20100718%%39000000842%%SPON000101%%20.00
D%%2430%%80000000001%%190%%2911%%143455%%20100718%%39000000644%%SPON000101%%20.00
D%%2210%%80000000001%%95%%327%%074551%%20100718%%39000000677%%SPON000111%%10.00
F%%95001%%20100718070925%%20100718221523%%10
T%%20100718070925%%20100718221523%%12
Header and trailer record templates
As mentioned above, the reconciliation files contain two (2) header records, two (2) trailer records, and zero (0) or more detailed records.
- Header 1
H%%BeginExtractDate%%EndExtractDate
- Header 2
S%%CardAcceptorId%%BeginExtractDate%%EndExtractDate
- Trailer 1
F%%CardAcceptorId%%BeginExtractDate%%EndExtractDate%%NumOfDetailRowsInFile
- Trailer 2
T%%BeginExtractDate%%EndExtractDate%%NumOfDetailRowsInFile+2
Note
TheBeginExtractDate
in the header and trailer records is the earliest time boundary for all detailed records in the file - likewise, the EndExtractDate
is the latest time boundary for the detailed records. This means that the local transaction date & time of all the detailed records fall within the BeginExtractDate
and EndExtractDate
date/time frames.
Reconciliation file fields
# | Field | Type (length) | Description |
---|---|---|---|
1 | Row Type | Alpha (1) | Always ‘D’ |
2 | MTI | Numeric (4) | The values are 2210 for redemptions and 2430 for reversals |
3 | Collector Number | Numeric (11) | The Collector number |
4 | Miles Amount | Numeric (4) | Amount (in AIR MILES Reward Miles) of the redemption or reversal |
5 | System Trace Number | Numeric (12) | Partner issued unique tracking number |
6 | Local Transaction Time | Numeric (6) | Format: HH24MISS (the time component of Local Date/Time) |
7 | Local Transaction Date | Numeric (8) | Format: YYYYMMDD (the date component of Local Date/Time) |
8 | Transaction Confirmation Number | Numeric (12) | The unique identification number included in any “redemption” or “reversal” response message |
9 | Card Terminal Id | Alphanumeric (16) | Concatenation of sponsorCode , storeId , and deviceId |
10 | Dollar Amount | Numeric (6, 2) | Format: NNNN.NN (no left padding - the amount in dollars of the redemption or reversal) |
File transmission method
The accepted transmission method for receiving the Reconciliation file is via SFTP (Simple File-Transfer-Protocol).
Contact us for more details at partnersupport@loyalty.com.
1.5 - OpenAPI (Swagger-Spec)
2 - AIR MILES Issuance
The purpose of this documentation is to provide a guide on how to integrate with the AIR MILES Issuance API. As part of this documentation, we also include information on RESTful HTTPS requests/responses, error codes, the reconciliation process, integration environments, and support contact information.
Target audience
This material is intended to be used by a Partner wishing to integrate with the AM Issuance API.
What is real-time Issuance
The AIR MILES “Real-Time Checkout” platform provides Partners with a streamlined method for instantly awarding their customers with AIR MILES Reward Miles, online or in-store. “Real-Time Issuance” ensures your customers will be able to see their updated balances immediately following checkout.
Service level objective
Please contact our Partner support team for details on our Service Level Agreement (SLA). Refer to our “Escalation Guide” for contact details.
Did you know
Our “Transaction Day” for real-time Issuance runs from 12:00AM to 11:59PM EST daily.Integration environments
There are two sets of environments used by partners to integrate with the real-time checkout platform. These environments are configured similarly for consistent production-level quality, whether the partner has deployed to production or is still performing non-production testing.
Environment | Domain | Description |
---|---|---|
Certification | https://cert.airmilesapis.ca | Contains production quality code and test data used for developing and testing 3rd party integrations. |
Production | https://airmilesapis.ca | Contains production code and live user data for real-world 3rd party integrations. |
Note
All integration environments must be accessed via HTTPS only.Your AMRP project team
In preparation for launch, an AIR MILES team is pulled together to assist Partners with integration and setup. This team will provide the following services:
- Consulting Partners on the best technical solution to support AIR MILES Issuance based on system compatibility.
- Providing guidance for assessing Partner requirements, data exchange methods, and reconciliation.
- As well as overseeing a broad range of activities to meet the requirements of launch, including:
- Planning
- Communications
- Delivery
- Execution
- Monitoring
Commonly used acronyms
Name | Definition |
---|---|
AMRP | AIR MILES Rewards Program: The loyalty program itself consisting both AIR MILES issuance an redemption processes. |
AMRM | AIR MILES Rewards Miles: The loyalty program currency that Collectors earn and redeem for travel, merchandise and cash rewards. |
RTC | Real-Time Checkout: An AIR MILES API platform specifically tailored for “Real-Time Issuance” & redemption of AIR MILES “Reward Miles”. |
M2M | Machine-to-Machine: Refers to direct communication between devices using any communications channel, including wired and wireless. This includes CLIs, daemons, or services running on your back-end that self-authenticates and/or authorizes an application without collector interaction. |
POS | Point-of-Sale: Refers to the software/hardware component that handles transactional messages, as well as processing AIR MILES issuances and reversals (return transactions). |
2.1 - Authentication & Authorization
For more information on “Auth0” and the various authentication flows, click the button below.
2.2 - API Library
This section describes the AIR MILES Issuance API endpoints. The endpoints are grouped into 2 categories; AMRP Calculated and Partner Calculated. Each API page offers a brief summary of the API endpoint in question, common use-case scenarios, and sample request/response messages with response codes.
API endpoints
AMRP Calculated Endpoints
Includes the API endpoints CALCULATE, ISSUE, RETURN, and RECORD.
Partner Calculated Endpoints
Includes the API endpoints POST, POST/EVENT, REVERSE, REVERSE/EVENT, and RECORD.
Idempotent requests
All the API calls (except RECORD
) support idempotency for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. For example, if a request to issue miles to a Collector does not receive a response due to a network connection error, you can retry the request with the same idempotency key to guarantee that extra miles aren’t accidentally deposited into the Collector’s account.
Note
To perform an idempotent request, you need to provide an additionalIdempotency-Key: <key>
header to the request.
What is an “Idempotency Key”
An “Idempotency Key” is a unique value generated by the client which the server uses to recognize subsequent retries of the same request. How you create unique keys is up to you, but we suggest using V4 UUIDs, or another random string with enough entropy to avoid collisions.
WARNING
If you omit the header in the request, then the content of the transaction itself will be used to detect if it’s a duplicate. This requires that you send the exact same request as before, including an identical timestamp. This process however does not guarantee idempotency and should only be used as a last resort.Sample header with Idempotency
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/post \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ...' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000' \
-d '{
Handling request/response messages
As described above, the RESTful specification defines a transaction as a pair of request and response messages that are used for information interchange.
Note
Mandatory parameters will be marked with an asterisk (*) in the subsequent pages.Message Type | Description |
---|---|
Request | |
Response | Content-Type is specified in the Header (e.g., application/json .responseCode .null or ’empty’ values are automatically excluded from the response body. |
Response code descriptions
Status Code | Description |
---|---|
200 | Request processed successfully. |
202 | Request succeeded, but still processing… |
400 | Request failed, bad request. |
500 | Request failed, internal error. |
Error code descriptions
Error Code | Status Code | Display Message | Description |
---|---|---|---|
202 | 202 | Location Code Not Provided | The request is missing a location code. |
203 | 202 | Offer Code Not Found | The Issuance offer code does not exist. |
204 | 202 | Offer Code Expired | The Issuance offer code has expired. |
205 | 202 | Location Code Inactive | The location code is not currently active. |
207 | 202 | Invalid Unit Miles | Miles do not match the allowable ‘Unit Mileage’. |
208 | 202 | Invalid Variable Miles | Miles exceed the allowable ‘Variable Mileage’. |
221 | 400 | Sponsor Code Not Found | The Sponsor code you entered does not exist. |
224 | 400 | Collector Account Closed | The requested Collector account has been closed. |
225 | 202 | Sponsor Code Expired | The requested Sponsor code has expired. |
230 | 202 | Location Code Not Found | The location code does not exist. |
232 | 400 | Collector Account Deleted | The requested Collector has been deleted from the system. |
234 | 400 | Collector Account Not Found | The requested Collector does not exist. |
000 | 202 | Unknown | The Issuance is pending due to unknown error. |
2.2.1 - AMRP Calculated Endpoints
The APIs in this section handle all the calculations and logging themselves, which makes things easier for most businesses looking to integrate with the AIR MILES rewards program. Using the “AMRP Calculated” method means AIR MILES handles all the logging and billing aspects of the service.
2.2.1.1 - CALCULATE
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The CALCULATE
endpoint is used to calculate how many Miles to issue for all eligible items in the basket. This API call DOES NOT issue actual Miles to the Collector.
Important
You do not need to make aCALCULATE
call prior to making an ISSUE
call. The CALCULATE
call is only required if you want to see how many Miles would be issued for an item (or items), but don’t want to issue those Miles.
API call validation process
After making a call to CALCULATE
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/calculate \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-d {
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"items": [{
"baseAmount": 9.99,
"categoryId" : "11101",
"departmentId":"10001",
"finalAmount": 19.98,
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2
},
{
"baseAmount": 4.99,
"categoryId" : "CAT2",
"departmentId":"DEPT2",
"finalAmount": 4.99,
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1
}
],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "TEST",
"tender": ["CASH", "CREDIT"],
"transactionType": "RETURN"
}
Request parameters
* required field
Parameter | Description |
---|---|
basketGSTAmount |
The dollar amount of GST (Government Sales Tax) to be added.
Example: |
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
Example: |
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
Example: |
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
Example: |
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
Example: |
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples:
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
Example: |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
items |
This optional object contains data elements related to purchase details, including the list of item(s) purchased, their quantity, individual price, and total amount paid (pre-tax).
Example:
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
Example: |
originalTransactionId |
This value represents the transactionId returned in the ISSUE transaction response from AIR MILES. Alternatively the checkoutTransactionId supplied by the Partner in an ISSUE transaction can be sent in this field.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
tender |
The method of payment used to pay for the transaction at checkout.
Example: |
transactionType * |
Transaction Type can be PURCHASE (ISSUE ) or RETURN .
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber":"81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454"
}],
"items": [{
"baseAmount": 9.99,
"categoryId" : "11101",
"departmentId":"10001",
"finalAmount": 19.98,
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2
},
{
"baseAmount": 4.99,
"categoryId" : "CAT2",
"departmentId":"DEPT2",
"finalAmount": 4.99,
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1
}],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "TEST",
"tender": ["CASH","CREDIT"],
"transactionId": "c4f6cd00-dd00-4aaf-9099-b0685ab710b3",
"transactionType": "RETURN"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
issuances |
This optional object contains data elements related to issuance data.
Example:
|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.1.2 - ISSUE
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The ISSUE
endpoint is used to both calculate how many Miles will be issued for all eligible items in the basket, and deposit those Miles to the Collector’s account.
Important
You do not need to make aCALCULATE
call prior to making an ISSUE
call. The CALCULATE
call is only required if you want to see how many Miles would be issued for an item (or items), but don’t want to issue those Miles.
API call validation process
After making a call to ISSUE
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is SUCCESSFUL but issuances are pending and causing a delay
- You will receive a response code of
202
- No further action is required
- Resubmitting the same request will have no effect on the transaction.
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.WARNING
While a transaction is being processed for a Collector, DO NOT attempt to process an additional transaction in parallel for the same Collector. This will result in an error.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/issue \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000" \
-d {
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"items": [{
"baseAmount": 9.99,
"categoryId" : "11101",
"departmentId":"10001",
"finalAmount": 19.98,
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2
},
{
"baseAmount": 4.99,
"categoryId" : "CAT2",
"departmentId":"DEPT2",
"finalAmount": 4.99,
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1
}
],
"locationCode": "1137",
"sponsorCode": "TEST",
"tender": ["CASH", "CREDIT"]
}
Request parameters
* required field
Parameter | Description |
---|---|
basketGSTAmount |
The dollar amount of GST (Government Sales Tax) to be added.
Example: |
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
Example: |
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
Example: |
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
Example: |
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
Example: |
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples:
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
Example: |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
items |
This optional object contains data elements related to purchase details, including the list of item(s) purchased, their quantity, individual price, and total amount paid (pre-tax). Click below to see additional details on the data object’s elements, including their descriptions and examples.
Example:
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
tender |
The method of payment used to pay for the transaction at checkout.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"confirmationNumber": "0ed100a4-fc9a-41bb-a747-942c2593b683",
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454",
"processedDateTime": "2019-05-30T14:12:59.479Z",
"status": "CONFIRMED"
}],
"items": [{
"baseAmount": 9.99,
"categoryId" : "11101",
"departmentId":"10001",
"finalAmount": 19.98,
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2
},
{
"baseAmount": 4.99,
"categoryId" : "CAT2",
"departmentId":"DEPT2",
"finalAmount": 4.99,
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1
}
],
"locationCode": "1137",
"sponsorCode": "TEST",
"tender": ["CASH","CREDIT"],
"transactionId": "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
issuances |
Array value describing the issuance offers redeemed by the Collector.
Example:
|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
202 | Request still processing, please wait. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.1.3 - RETURN
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The RETURN
endpoint is used to recalculate the Miles earned for each item in the basket, then withdraws the Miles for the item(s) being returned.
Important
You do not need to make aCALCULATE
call prior to making an ISSUE
call. The CALCULATE
call is only required if you want to see how many Miles would be issued for an item (or items), but don’t want to issue those Miles.
API call validation process
After making a call to RETURN
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is SUCCESSFUL but issuances are pending and causing a delay
- You will receive a response code of
202
- No further action is required
- Resubmitting the same request will have no effect on the transaction.
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.WARNING
While a transaction is being processed for a Collector, DO NOT attempt to process an additional transaction in parallel for the same Collector. This will result in an error.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/return \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000" \
-d {
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"DEPT2",
"categoryId" : "CAT2"
}
],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "TEST",
"tender": ["CASH", "CREDIT"]
}
Request parameters
* required field
Parameter | Description |
---|---|
basketGSTAmount |
The dollar amount of GST (Government Sales Tax) to be added.
Example: |
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
Example: |
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
Example: |
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
Example: |
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
Example: |
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples:
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
Example: |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
items |
This optional object contains data elements related to purchase details, including the list of item(s) purchased, their quantity, individual price, and total amount paid (pre-tax). Click below to see additional details on the data object’s elements, including their descriptions and examples.
Example:
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
Example: |
originalTransactionId * |
This value represents the transactionId returned in the ISSUE transaction response from AIR MILES. Alternatively the checkoutTransactionId supplied by the Partner in an ISSUE transaction can be sent in this field.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the partner.
Example: |
tender |
The method of payment used to pay for the transaction at checkout.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber":"81111111111",
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"confirmationNumber": "0ed100a4-fc9a-41bb-a747-942c2593b683",
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454",
"processedDateTime": "2019-05-30T14:12:59.479Z",
"status": "CONFIRMED"
}],
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"DEPT2",
"categoryId" : "CAT2"
}],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "TEST",
"tender": ["CASH","CREDIT"],
"context": {"key1": "value1","key2": "value2"},
"transactionId": "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
issuances |
Array value describing the issuance offers redeemed by the Collector.
Example:
|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
202 | Request still processing, please wait. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.1.4 - RECORD
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
Note
This API call DOES NOT issue Miles to Collectors.The RECORD
endpoint is used to test and verify the transmission of transactions to AIR MILES - this includes both Collector and non-Collector transactions. This endpoint can be used initially to test and verify that the API integration is working as expected.
API call validation process
After making a call to RECORD
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/calculate \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-d {
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"DEPT2",
"categoryId" : "CAT2"
}
],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "TEST",
"tender": ["CASH", "CREDIT"],
"transactionType": "RETURN"
}
Request parameters
* required field
Parameter | Description |
---|---|
basketGSTAmount |
The dollar amount of GST (Government Sales Tax) to be added.
Example: |
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
Example: |
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
Example: |
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
Example: |
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
Example: |
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples:
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
Example: |
collectorNumber |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
items |
This optional object contains data elements related to purchase details, including the list of item(s) purchased, their quantity, individual price, and total amount paid (pre-tax).
Example:
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
Example: |
originalTransactionId |
This value represents the transactionId returned in the ISSUE transaction response from AIR MILES. Alternatively the checkoutTransactionId supplied by the partner in an ISSUE transaction can be sent in this field.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
tender |
The method of payment used to pay for the transaction at checkout.
Example: |
transactionType * |
Transaction Type can be PURCHASE or RETURN .
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"coupon": ["57841","57862"],
"deviceId": "POS1",
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"10001",
"categoryId" : "11101"
}],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "KELL",
"tender": ["CASH","CREDIT"],
"transactionId": "c4f6cd00-dd00-4aaf-9099-b0685ab710b3",
"context": {"key1": "value1","key2": "value2"},
"transactionType": "RETURN"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.2 - Partner Calculated Endpoints
Important
The APIs listed here require the partner to calculate and process the transactions themselves. If you are a smaller business who either doesn’t have the infrastructure or doesn’t wish to send us a monthly detailed transaction log, you may be better suited for our AMRP calculated APIs.The APIs in this section require the Partner to keep a detailed log of all their transactions, calculate Miles to be issued for each transaction, which must be sent to AIR MILES on a regular basis (i.e., daily, weekly, bi-weekly or monthly) to facilitate issuing these Miles to AIR MILES Collectors. This method is primarily used by businesses that wish to keep their own detailed record of every transaction and remit those records on their own schedule.
2.2.2.1 - POST
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The POST
endpoint is used to issue AIR MILES to a Collector’s account in real-time for a basket transaction at
checkout. With this method selected the total AIR MILES to be issued for a transaction are calculated by the Partner.
API call validation process
After making a call to POST
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is SUCCESSFUL but issuances are pending and causing a delay
- You will receive a response code of
202
- No further action is required
- Resubmitting the same request will have no effect on the transaction
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/post \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000" \
-d {
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454"
}],
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"10001",
"categoryId" : "11101"
}],
"locationCode": "1137",
"sponsorCode": "KELL",
"tender": ["CASH","CREDIT"]
}
Request parameters
* required field
Parameter | Description |
---|---|
basketGSTAmount |
The dollar amount of GST (Government Sales Tax) to be added.
Example: |
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
Example: |
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
Example: |
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
Example: |
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
Example: |
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples:
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
Example: |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
|
items |
This optional object contains data elements related to purchase details, including the list of item(s) purchased, their quantity, individual price, and total amount paid (pre-tax). Click below to see additional details on the data object’s elements, including their descriptions and examples.
Example:
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location. While it is not mandatory to be sent on the issuance record, for partners with retail locations including e-commerce, this field should be populated.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
tender |
The method of payment used to pay for the transaction at checkout.
Example: |
provider |
The provider of these transactions to AIR MILES. This can be the Partner Name or their data provider name.
Example: |
program |
The program for which these transactions are being sent. If you are part of the core AIR MILES Reward Program, then this value is always “AIRMILES"
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"confirmationNumber": "0ed100a4-fc9a-41bb-a747-942c2593b683",
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454",
"processedDateTime": "2019-05-30T14:12:59.479Z",
"status": "CONFIRMED"
}],
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"10001",
"categoryId" : "11101"
}],
"locationCode": "1137",
"sponsorCode": "KELL",
"tender": ["CASH","CREDIT"],
"context": {"key1": "value1","key2": "value2"},
"transactionId": "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
issuances |
Array value describing the issuance offers redeemed by the Collector.
Example:
|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
202 | Request still processing, please wait. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.2.2 - POST/EVENT
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The POST/EVENT
endpoint is used to issue AIR MILES to a Collector’s account in real-time for a non-transactional
reason (e.g., issuing AIR MILES for desired activity or issuing a manual correction to a Collector’s account). With this
method selected the total AIR MILES to be issued for a transaction are calculated by the Partner.
API call validation process
After making a call to POST/EVENT
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is SUCCESSFUL but issuances are pending and causing a delay
- You will receive a response code of
202
- No further action is required
- Resubmitting the same request will have no effect on the transaction
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/post/event \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000" \
-d {
"clientTransactionId": "111112314",
"collectorNumber": "80085102028",
"context": {"key1": "value1","key2": "value2"},
"coupon": [
"coupon"
],
"deviceId": "string",
"issuances": [
{
"issuanceOfferCode": "STANDARD",
"locationCode": "0037",
"milesAmount": 8,
"offerDescription": "offer",
"offerId": 22
}
],
"sponsorCode": "KENY",
"transactionDateTime": "2021-11-09T21:04:45.930Z"
}
Request parameters
* required field
Parameter | Description |
---|---|
clientTransactionId * |
Unique identifier generated by the Partner for the event transaction.
Example: |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
|
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
transactionDateTime * |
The date and time the request was sent.
Example: |
provider |
The provider of these transactions to AIR MILES. This can be the Partner Name or their data provider name.
Example: |
program |
The program for which these transactions are being sent. If you are part of the core AIR MILES Reward Program, then this value is always “AIRMILES"
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"clientTransactionId": "111112314",
"collectorNumber": "80085102028",
"coupon": [
"coupon"
],
"deviceId": "string",
"issuances": [
{
"issuanceOfferCode": "STANDARD",
"locationCode": "0037",
"milesAmount": 8,
"offerDescription": "offer",
"offerId": "22",
"status": "PENDING"
}
],
"sponsorCode": "KENY",
"transactionDateTime": "2021-11-11T12:54:31.780-05:00",
"transactionId": "93a1237c-545c-4f16-96e5-4d890c903bd9"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
issuances |
Array value describing the issuance offers redeemed by the Collector.
Example:
|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
202 | Request still processing, please wait. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.2.3 - REVERSE
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The REVERSE
endpoint is used to reverse AIR MILES from a Collector’s account for returns or corrections.
API call validation process
After making a call to REVERSE
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is SUCCESSFUL but issuances are pending and causing a delay
- You will receive a response code of
202
- No further action is required
- Resubmitting the same request will have no effect on the transaction.
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/reverse \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000" \
-d {
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454"
}],
"items": [{
"baseAmount": 9.99,
"categoryId" : "11101",
"departmentId":"10001",
"finalAmount": 19.98,
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2
},
{
"baseAmount": 4.99,
"categoryId" : "CAT2",
"departmentId":"DEPT2",
"finalAmount": 4.99,
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1
}],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "KELL",
"tender": ["CASH","CREDIT"]
}
Request parameters
* required field
Parameter | Description |
---|---|
basketGSTAmount |
The dollar amount of GST (Government Sales Tax) to be added.
Example: |
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
Example: |
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
Example: |
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
Example: |
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
Example: |
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples:
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
Example: |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
|
items |
This optional object contains data elements related to purchase details, including the list of item(s) purchased, their quantity, individual price, and total amount paid (pre-tax). Click below to see additional details on the data object’s elements, including their descriptions and examples.
Example:
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location. While it is not mandatory to be sent on the issuance record, for partners with retail locations including e-commerce, this field should be populated.
Example: |
originalTransactionId |
This value represents the transactionId returned in the POST transaction response from AIR MILES. Alternatively the checkoutTransactionId supplied by the Partner in an POST transaction can be sent in this field.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
tender |
The method of payment used to pay for the transaction at checkout.
Example: |
provider |
The provider of these transactions to AIR MILES. This can be the Partner Name or their data provider name.
Example: |
program |
The program for which these transactions are being sent. If you are part of the core AIR MILES Reward Program, then this value is always “AIRMILES"
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"confirmationNumber": "0ed100a4-fc9a-41bb-a747-942c2593b683",
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454",
"processedDateTime": "2019-05-30T14:12:59.479Z",
"status": "CONFIRMED"
}],
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"10001",
"categoryId" : "11101"
}],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "KELL",
"tender": ["CASH","CREDIT"],
"context": {"key1": "value1","key2": "value2"},
"transactionId": "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
issuances |
Array value describing the issuance offers redeemed by the Collector.
Example:
|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
202 | Request still processing, please wait. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.2.4 - REVERSE/EVENT
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The REVERSE/EVENT
endpoint is used to reverse AIR MILES from a Collector’s account in real-time for a
non-transactional reason (e.g., issuing a manual correction to a Collector’s account). With this method selected the
total AIR MILES to be reversed are calculated by the Partner.
API call validation process
After making a call to REVERSE/EVENT
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is SUCCESSFUL but issuances are pending and causing a delay
- You will receive a response code of
202
- No further action is required
- Resubmitting the same request will have no effect on the transaction
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/reverse/event \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 123e4567-e89b-12d3-a456-426655440000" \
-d {
"clientTransactionId": "111112314",
"collectorNumber": "80085102028",
"context": {"key1": "value1","key2": "value2"},
"coupon": [
"coupon"
],
"deviceId": "string",
"issuances": [
{
"issuanceOfferCode": "STANDARD",
"locationCode": "0037",
"milesAmount": 8,
"offerDescription": "offer",
"offerId": 22
}
],
"originalClientTransactionId": "12340001111",
"sponsorCode": "KENY",
"transactionDateTime": "2021-11-09T21:04:45.930Z"
}
Request parameters
* required field
Parameter | Description |
---|---|
clientTransactionId * |
Unique identifier generated by the Partner for the event transaction.
Example: |
collectorNumber * |
The customer’s AIR MILES account number.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
|
originalClientTransactionId |
This value represents the clientTransactionId returned in the POST/EVENT transaction response from AIR MILES. Alternatively the checkoutTransactionId supplied by the Partner in an POST transaction can be sent in this field.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
transactionDateTime * |
The date and time the request was sent.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"clientTransactionId": "111112314",
"collectorNumber": "80085102028",
"coupon": [
"coupon"
],
"deviceId": "string",
"issuances": [
{
"issuanceOfferCode": "STANDARD",
"locationCode": "0037",
"milesAmount": 8,
"offerDescription": "offer",
"offerId": "22",
"status": "PENDING"
}
],
"originalClientTransactionId": "12340001111",
"sponsorCode": "KENY",
"transactionDateTime": "2021-11-11T12:54:31.780-05:00",
"transactionId": "93a1237c-545c-4f16-96e5-4d890c903bd9"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
issuances |
Array value describing the issuance offers redeemed by the Collector.
Example:
|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
202 | Request still processing, please wait. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.2.2.5 - RECORD
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
Note
This API call DOES NOT issue AIR MILES to Collectors.The RECORD
endpoint is used to test and verify the transmission of transactions to AIR MILES - this includes both
Collector and non-Collector transactions. This endpoint can be used initially to test and verify that the API
integration is working as expected. Partners can use this endpoint to send Collector and non-Collector transactions that
did not qualify for the transaction to be sent on the POST, REVERSE, POST/EVENT or REVERSE/EVENT endpoints.
API call validation process
After making a call to RECORD
, you will receive one of the following responses:
- If the call is SUCCESSFUL
- You will receive a response code of
200
- No further action is required
- You will receive a response code of
- If the call is REJECTED due to incorrect or invalid details
- You will receive a response code of
400
- You must retry the request with a valid transaction record and/or the corrected details
- You will receive a response code of
- If the call FAILS due to an error or other issue
- You will receive a response code of
500
- It’s recommended you retry the request at least 2 additional times
- You will receive a response code of
Note
The “FAIL” response above could indicate a system error on our end. If this happens, please contact our Support Desk for assistance.Sample request
curl -X POST https://cert.airmilesapis.ca/checkout/issuance/record \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." \
-H "Content-Type: application/json" \
-d {
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"context": {"key1": "value1","key2": "value2"},
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"contributingItemIds": ["SKU1234","SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454"
}],
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"10001",
"categoryId" : "11101"
}],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "KELL",
"tender": ["CASH","CREDIT"],
"transactionType": "RETURN"
}
Request parameters
* required field
Parameter | Description |
---|---|
basketGSTAmount |
The dollar amount of GST (Government Sales Tax) to be added.
Example: |
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
Example: |
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
Example: |
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
Example: |
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
Example: |
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
Example: |
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples:
|
checkoutTransactionId * |
Unique identifier generated by the partner for the transaction at checkout.
Example: |
collectorNumber |
The customer’s AIR MILES account number.
Example: |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: |
deviceId |
ID number used to identify the POS terminal currently in use.
Example: |
issuances |
This optional object contains data elements related to issuance data.
Example:
|
items |
This optional object contains data elements related to purchase details, including the list of item(s) purchased, their quantity, individual price, and total amount paid (pre-tax).
Example:
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location. While it is not mandatory to be sent on the issuance record, for partners with retail locations including e-commerce, this field should be populated.
Example: |
originalTransactionId |
This value represents the transactionId returned in the RECORD transaction response from AIR MILES. Alternatively the checkoutTransactionId supplied by the Partner in an POST transaction can be sent in this field.
Example: |
sponsorCode * |
Alpha-numeric value used to identify the Partner.
Example: |
tender |
The method of payment used to pay for the transaction at checkout.
Example: |
transactionType * |
Transaction Type can be PURCHASE or RETURN .
Example: |
provider |
The provider of these transactions to AIR MILES. This can be the Partner Name or their data provider name.
Example: |
program |
The program for which these transactions are being sent. If you are part of the core AIR MILES Reward Program, then this value is always “AIRMILES"
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"basketGSTAmount": 0,
"basketPSTAmount": 0,
"basketHSTAmount": 3.25,
"basketQSTAmount": 0,
"basketPreTaxAmount": 24.97,
"basketPostTaxAmount": 28.22,
"checkoutDateTime": "2019-05-30T14:12:59.479Z",
"checkoutTransactionId": "12340001111",
"collectorNumber": "81111111111",
"coupon": ["57841","57862"],
"deviceId": "POS1",
"issuances": [{
"contributingItemIds": ["SKU1234", "SKU1252"],
"issuanceOfferCode": "STANDARD",
"locationCode": "1100",
"milesAmount": 5,
"offerDescription": "Bonus Miles for Groceries.",
"offerId": "123454"
}],
"items": [{
"id": "SKU1234",
"name": "Dog Food",
"number": 1,
"quantity": 2,
"baseAmount": 9.99,
"finalAmount": 19.98,
"departmentId":"10001",
"categoryId" : "11101"
},
{
"id": "SKU1252",
"name": "Potato Chips",
"number": 2,
"quantity": 1,
"baseAmount": 4.99,
"finalAmount": 4.99,
"departmentId":"10001",
"categoryId" : "11101"
}],
"locationCode": "1137",
"originalTransactionId": "d445b671-7a7f-490f-a3f8-adfc443408a5",
"sponsorCode": "KELL",
"tender": ["CASH","CREDIT"],
"context": {"key1": "value1","key2": "value2"},
"transactionId": "c4f6cd00-dd00-4aaf-9099-b0685ab710b3",
"transactionType": "RETURN"
}
Response parameters
Only parameters unique to the Sample Response are listed below. For all other parameters, refer to the table above.
Parameter | Description |
---|---|
transactionId |
A unique ID created for the particular transaction.
Example: |
Status codes
Refer to our Audit report errors table for more information.
Status Code | Description |
---|---|
200 | Request processed successfully. |
400 | Bad request, failed to process. |
500 | Request failed due to internal error. |
2.3 - OpenAPI (Swagger-Spec)
3 - Member Banner
Allows your customers to check their AIR MILES account balances and details right from your mobile application or website.

Generating an Authorization Code
Generate an Authorization Code by redirecting your customer to our universal login page.

(Fig. 1) AIR MILES universal log in page
Sample Authorization Request
<a href="https://oauth-cert.airmiles.ca/authorize?
client_id=knPJldKv8ygPn56gZhdFEIZV27QevLkx&
response_type=code&
connection=member-email-idp-recaptcha&
redirect_uri=https://your_redirect_uri/callback&
scope=memberbanner%20offline_access&
audience=https://members.loyalty.com">
Sign In
</a>
Parameter | Description |
---|---|
client_id |
To be provided by AIR MILES. |
response_type |
Do not change, keep as code . |
connection |
Do not change, keep as member-email-idp-recaptcha . |
redirect_uri |
The URL which Auth0 will redirect the browser to, and send the authorization code.
Note The address must be a valid callback URI, and needs to be communicated to AIR MILES at the same time yourclient_id is being setup.
|
scope |
Do not change, keep as memberbanner .
Note Theoffline_access scope enables the use of Refresh Tokens and is optional
|
audience |
Do not change, keep as https://members.loyalty.com . |
Sample Authorization Response
Once your customer authenticates themselves, a response will be sent to the redirect URI that includes an Authorization Code.
HTTP/1.1 302 Found
Location: https://your_redirect_uri/callback?code=6hgDftTGH656HEDLdfOPA43nmsR5GuqG
Generating an Access Token
An Access Token is required to communicate with the Member Banner API. To generate an Access Token (aka JSON Web Token), make an API request like the one shown below.
WARNING
The Access Token request must originate from your backend, otherwise it will be rejected by Auth0. If for example the request originates from a Web browser, it will be declined, as this means yourclient_secret
has been exposed to the public.
Sample Token Request
curl --request POST \
--url 'https://oauth-cert.airmiles.ca/oauth/token' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'client_id=knPJldKv8ygPn56gZhdFEIZV27QevLkx' \
--data-urlencode 'client_secret=lfgdFGDF456fFDFV4FdDFffdl7h8J43s' \
--data-urlencode 'code=6hgDftTGH656HEDLdfOPA43nmsR5GuqG' \
--data-urlencode 'redirect_uri=https://your_redirect_uri/callback'
Parameter | Description |
---|---|
grant_type |
Do not change, keep as authorization_code . |
client_id |
The client_id used in the previous step. |
client_secret |
To be provided by AIR MILES. |
code |
The Authorization Code (i.e., code ) returned in the last step. |
redirect_uri |
The redirect_uri used in the previous step. |
Sample Token Response
If all goes well, you’ll receive a (HTTP 200) JSON response with a payload containing an access_token
, refresh_token
, id_token
, and token_type
.
{
"access_token": "eyJz93a409sSwFG8kkIL2qsGHk4laUWw",
"refresh_token": "GE5g5HJdbYb47HN358polTHdf3tHf3ra",
"id_token": "eyKMD32ldkgfkDYKL4h6hf33edHGSDKk",
"token_type": "Bearer"
}
Notes on Refresh Tokens
- The
refresh_token
will only be present in the response if you included theoffline_access
scope. - Refresh Tokens must be stored securely since they allow a user to remain authenticated essentially forever.
JSON Web Token (JWT) structure
The JWT consists of three concatenated Base64url-encoded strings, separated by dots “.
”.

(Fig. 2) JWT Example
String | Description |
---|---|
Header | Contains metadata about the type of token and the cryptographic algorithms used to secure its contents. |
Payload | Contains verifiable security statements, such as the Collector ID and the allowed scopes. |
Signature | Used to validate that the token is trustworthy and has not been tampered with. |
Calling the Member Banner API
Finally, to display the Collector’s account details, make an API request using the Access Token received in the previous step.
Sample API Request
curl -X GET \
`https://cert.airmilesapis.ca/member-profile/banner` \
-H 'Authorization: Bearer eyJz93a409sSwFG8kkIL2qsGHk4laUWw' \
Tip
Make sure to include the wordBearer
before the token, as shown in the example above.
Sample API Response
If everything went as expected you should receive a JSON response that includes the Collector’s account details, as shown in the example below.
{
"cardNumber": "84151103449",
"memberId": "fbd651ea-af99-3a71-b0db-83d4feae087f",
"firstName": "JIMMY",
"tier": "Blue",
"cashBalance": 10901,
"dreamBalance": 849
}
Parameter | Description |
---|---|
cardNumber |
The Collector’s AIR MILES card number. |
memberId |
The Collector’s ID number. |
firstName |
The Collector’s first name (given name). |
tier |
The Collector’s account level (Blue, Gold, or Onyx). |
cashBalance |
The Collector’s balance of AIR MILES Cash Miles. |
dreamBalance |
The Collector’s balance of AIR MILES Dream Miles. |
Using a Refresh Token
Typically, a user needs a new access token when gaining access to a resource for the first time, or after the previous access token granted to them expires. A refresh token is a special kind of token used to obtain a renewed access token. You can request new access tokens until the refresh token is blacklisted. Applications must store refresh tokens securely because they essentially allow a user to remain authenticated forever.
Note
To successfully obtain a refresh token, you must first have included theoffline_access
scope when you initiated your authentication request through the ../authorize
endpoint, as shown in Step 1.
To exchange the Refresh Token you received during authorization for a new Access Token, make a POST
request to https://oauth-cert.airmiles.ca/oauth/token
, using grant_type=refresh_token
as seen in the example below.
Important
You should only ask for a new token if the access token has expired or you want to refresh the claims contained in the ID token. For example, it’s bad practice to call the endpoint to get a new access token every time you call an API. There are rate limits in Auth0 that will throttle the number of requests to this endpoint that can be executed using the same token from the same IP.Sample ‘Refresh Token’ Request
curl --request POST \
--url 'https://oauth-cert.airmiles.ca/oauth/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=refresh_token \
--data-urlencode 'client_id=knPJldKv8ygPn56gZhdFEIZV27QevLkx' \
--data-urlencode client_secret=lfgdFGDF456fFDFV4FdDFffdl7h8J43s \
--data refresh_token=YOUR_REFRESH_TOKEN
Parameter | Description |
---|---|
grant_type |
Do not change, keep as refresh_token . |
client_id |
To be provided by AIR MILES. |
client_secret |
To be provided by AIR MILES. |
refresh_token |
The Refresh Token to use. |
Note
The scopes requested in the initial request are included by default in the Refresh Token.Sample ‘Refresh Token’ Response
If all goes well, you’ll receive an HTTP 200
response with a payload containing a new access_token
, its lifetime in seconds (expires_in
), granted scope
values, and token_type
. If the scope of the initial token included openid
, then the response will also include a new id_token
:
The response will include a new Access Token, its type, its lifetime (in seconds), and the granted scopes. The memberbanner
scope should also be included in the response as well.
{
"access_token": "eyJz93a409sSwFG8kkIL2qsGHk4laUWw",
"scope": "memberbanner offline_access",
"id_token": "eyKMD32ldkgfkDYKL4h6hf33edHGSDKk",
"token_type": "Bearer"
}
AIR MILES Brand Guidelines
Our Brand Guidelines site is currently offline for ongoing updates and maintenance. In the meantime, please reach out to our ‘Brand Approvals’ team in the ‘Rewards & Marketing’ department, to request more information on website and application integration.
Contact information
-
- Email for Brand Approvals
- brandapprovals@loyalty.com
4 - Offer Service
Offer Service
The purpose of this document is to prvide a guide on how to integrate with the Offer Service API. This documentation will include use cases, request/response
High level
The Offer Service allows for a client to get offers available on the AIR MILES platform. There are two streams the Offer Service can flow, Authenticated and Public. Depending on the flow new functionality is provided by the Offer Service.
These are the API’s avaliable to clients from the Offer Service:
x | Authenticated | Public |
---|---|---|
/offers | ✅ | ✅ |
/offers/{id} | ✅ | ✅ |
/offers/{id}/state | ✅ | ➖ |
There are more differences between Authenticated and Public, which we will get to when going more in-depth about each of the above API
API Overview
GET /offers
GET a list of offers, with applying filters, sorting, pagination and limits. The Offer API will return all the offers details that are needed to display the offer to the collector.
GET /offers/{id}
GET offer details for a specific offer, same offer object retuned as /offers. This API will also return the offer details for targeted offers without authorization as well as offers not in region.
PUT /offers/{id}/state
PUT offer states at collector-level, which tracking when a collector saved or unsaved an offer, or when a collector opted in to an offer.
Auth vs. Public
Two ways to integrate with any Offer Service API, depending on header.
Authentication
- This allows for partners to request offers that are avaliable to specific collectors (targeted offers), also allows for showing collector their state (saved/opted) for an offers, and allows collector to update the state of an offer.- NO
Authentication
- This allows viewing of public offers (mass offers), also allows to get details of public offers.
4.1 - Mapping
This document contains the mappings of UUID’s to Partners, Categories, SubCategories, Promotions.
We can discuss later how Offer Service /offers
API can be used to get some of these mappings aswell.
Region
Code | Name |
---|---|
BC | British Columbia |
AB | Alberta |
SK | Saskatchewan |
MB | Manitoba |
ON | Ontario |
QC | Quebec |
TB | Thunder Bay |
NB | New Brunswick |
NS | Nova Scotia |
PE | Prince Edward Island |
NL | Newfoundland and Labrador |
NT | Northwest Territories |
NU | Nunavut |
YT | Yukon |
ZZ | for automated tests |
Partner
Id | Name |
---|---|
5058f22a-1f5c-4625-b8ff-ffe116756722 | TIMBER MART |
33d0cf88-5eae-4186-be03-05092061eed9 | HP |
63e8543d-fbf7-458e-8712-d25332da3614 | AIR MILES Travel |
22a2cdfd-ff82-45f6-bc94-c14a3a533922 | BMO Bank of Montreal |
e914624c-9676-4287-8ce9-04de68dd0507 | airmilesshops.ca |
87ab4dd0-65b5-41a3-acd2-b97540dc1aff | United Van Lines |
ef73e58a-db63-4b27-baae-bd1e1d2ae86c | Peter & Paul’s Gifts |
0c988dcd-b2a9-4391-b2c4-48f0294d5658 | Canadian Appliance Source |
fbdc481f-3fa4-40e9-b1ca-d4dab4c36c30 | All Purpose Realty |
11892e84-a87e-48b0-bf13-fcd0be389588 | Additional AIR MILES Partners |
c13f2e1b-f828-4781-9369-fde0581c400d | Onlia Insurance |
19e1bb2b-88d4-4b37-be72-262a694ae58d | National Car Rental |
4a755252-876b-478e-9440-42961525e307 | Metro |
1563e943-25fd-480b-b77d-94aedc7202af | LG Electronics |
cbfcd38f-b1c0-4443-881c-c342833649a0 | Fresh |
91adc45f-0037-4fa8-9424-2e6e8f999467 | SMASH + TESS |
b90e694d-3510-4cc2-84be-f9b6f61bd31b | Shell Mobility |
27568f1b-c48d-4c27-8d9b-7c67666308c2 | Dollarama |
98d43a31-1c04-4db7-bfd3-b9a4a0ced034 | Mayflower |
9ab6f70f-588e-4460-b14c-ad4ad8c9a524 | La Vie en Rose |
1b36212c-87a6-448c-82a7-c2f28c8b6d52 | HelloFresh |
5a92c696-cddd-4255-920e-1f74b121e7ea | Kernels |
40786f15-10e1-490f-a4bf-38003770ad73 | redtag.ca |
38178928-9281-42aa-9f70-8c39c453baf1 | Alamo Rent a Car |
There are many partners not listed in this list, you can contact REPLACE_ME to get more details
Categories
Id | Name |
---|---|
22b666ae-97c2-4e57-a437-e977de6beef4 | Grocery (Épicerie) |
1ba636e3-799d-44c3-9c84-42a3df6430b0 | Household Supplies (Entretien ménager) |
0f597ee1-16b8-4a4f-beb7-4654cfd0b45a | Pharmacy (Pharmacie) |
c7a208f3-8f94-4460-b76c-3c75ae53417d | Liquor (Alcool) |
38d878d7-c3e0-4ea1-8e6c-d4759f307042 | Pets (Animaux de compagnie) |
77c6067e-bd25-43a9-826c-7a4788581952 | Home and Garden (Maison et jardin) |
0333d0e5-68be-4833-939f-3a20d0cc9806 | Fuel and Auto (Carburant et auto) |
0cbc9203-2811-4eae-9dc1-68da692658b8 | Financial (Produits financiers) |
0a889711-9ab8-4972-a0b5-b9eafc8fa312 | Retail (Articles de détail) |
0387d04b-2736-48e4-b804-ac50f4222b79 | Office (Bureau) |
121fa2dd-1fab-4492-8c5d-fb34624f4dda | Travel (Voyage) |
17180943-4cef-4fb8-833d-9919e359e4f3 | Gift Cards (Cartes-cadeaux) |
e10dea41-3aee-4a24-bc8d-0d8de8c3e5ae | airmilesshops.ca (airmilesshops.ca) |
cc1b19d6-72e0-47bc-8b81-2b1fbb49d050 | Other (Autre) |
SubCategories
Id | Name | Parent |
---|---|---|
4683cd1f-bba8-4dd0-b960-4324a246960b | Baby (Bébé) | Grocery (Épicerie) |
873c7bfa-745e-4bdd-afe2-55425821d721 | Bakery (Boulangerie) | Grocery (Épicerie) |
d614fed9-8c17-4c20-a179-2351e54679c1 | Beverages (Boissons) | Grocery (Épicerie) |
eab2662b-bfc5-4457-8cbf-33d9e10f9bb6 | Dairy and Eggs (Produits laitiers et œufs) | Grocery (Épicerie) |
f1f75e01-8b8f-460c-bc89-8bdb40060e7c | Deli and Prepared Food (Charcuterie et plats préparés) | Grocery (Épicerie) |
da4cdf1b-e2f0-4b1c-99b7-c0ce4696292f | Frozen Foods (Produits surgelés) | Grocery (Épicerie) |
37485ad6-07ad-4145-80f1-fbecdd46a26a | Fruits and Vegetables (Fruits et légumes) | Grocery (Épicerie) |
0d3245ac-9812-4bc3-9020-16b1349f1531 | Meat and Seafood (Viande et produits de la mer) | Grocery (Épicerie) |
be58904e-4ae9-49fc-ac6d-0e966dc193bb | Pantry (Garde-manger) | Grocery (Épicerie) |
d295e726-8205-4a41-8207-a6e31714dde3 | Snacks (Collations) | Grocery (Épicerie) |
53a177af-b923-43ea-ac7d-0230ea0db805 | Vegan and Vegetarian (Aliments végétariens et végétaliens) | Grocery (Épicerie) |
3c4b099b-061c-493b-8bc4-4ced119949c4 | Organic Groceries (Épicerie Biologique) | Grocery (Épicerie) |
e9c77b08-a3e5-4846-90e5-9e9ad0f34de1 | Other Grocery (Autre Épicerie) | Grocery (Épicerie) |
279ecbd8-b81b-4d46-9726-8fdd4dee8af8 | Cleaning (Nettoyage) | Household Supplies (Entretien ménager) |
43cf7742-601f-43ef-9934-3a461493eb4e | Laundry (Lessive) | Household Supplies (Entretien ménager) |
0b9d187d-bbf2-4884-9e10-2df4c97bcd3f | Paper and Plastics (Papier et plastiques) | Household Supplies (Entretien ménager) |
4683cd1f-bba8-4dd0-b960-4324a246960b | Baby (Bébé) | Pharmacy (Pharmacie) |
dc725f55-1c70-4088-8108-cc199bd2ca32 | Beauty (Beauté) | Pharmacy (Pharmacie) |
ef1ff9bd-6032-4c14-8c51-8b1f43dd0970 | Medicine and Health (Médicaments et santé) | Pharmacy (Pharmacie) |
d871a234-93f3-47f0-991a-b230cb797d74 | Personal Care (Soins personnels) | Pharmacy (Pharmacie) |
0dd2f52d-af4a-45f9-aa1c-c66cd13f16e6 | Beer and Cider (Bières et cidres) | Liquor (Alcool) |
6cad2024-2bc8-47f5-b563-53f97c1f7205 | Coolers (Coolers) | Liquor (Alcool) |
b3962476-bb50-47c2-af54-3bdec43fa499 | Spirits (Spiritueux) | Liquor (Alcool) |
8b618c88-cd2c-47fa-9de7-677fe1d3737f | Wine (Vins) | Liquor (Alcool) |
Mapping from Offer Service
We can make a call to the Offer Service API to get these extended_metedata
values.
Request
/offers?region=ON&extended_metadata=true
Response
{
"offers":[],
"metadata":{
"total": N
"partners": [...],
"categories": [...],
}
}
The field partners
in the response has id and labels. Region Dependent
The field categories
in the response contains id and labels for categories and subcategories. Region agnostic
4.2 - API Library
This section provides information on the 3 API’s provided by the Offer Service.
GET /offers
Used to get multiple offers based on parametes.
GET /offers/{id}
Used to get single offer detail.
PUT /offers/{id}/states
Used to update single offer state for a collector.
Common Use Case
-
Get Offers By Province
Request Response /offers?region=ON
Get all offers in Ontario
-
Get Offers By Partner
Request Response /offers?region=ON&partner_id=ID_1,ID_2
Get all offers related to partner with ID_1 OR ID_2, in Ontario ID_1 & ID_2 are UUID’s for partners. To get partner id for a specific partner check
Mapping -> Partner
documentation
Filter Combination
When multiple request parameters are passed, and/or multiple values are passed, the offers that satisfy the following logic are returned in the response.
(param1.valueA OR param1.valueB OR ...) AND (param2.valueX OR param2.valueY OR ...) AND (...)
For example, if request:
partner_id
= A, B, Ccategory_id
= X
/offers?region=ON&partner_id=A,B,C&category_id=X
Then the /offers
response will return offers that satisfy:
Offers where (partner=A OR partner=B OR partner=C) AND (category=X).
4.2.1 - GET /offers
GET /offers
This is the core API for Offer Service. API to get all details for displaying offers to collectors and the general public. This API has multiple query paramenter and headers that can change the response of the offers returned in varios ways.
Query Parameters
Name | Rquired | Type | Discription |
---|---|---|---|
region | ✔️ | String (single value) | Will only show offers from a single region |
partner_id | UUID (multiple value) | Will return offers with only the provided parters | |
category_id | UUID (multiple value) | Will return offers with only the provided category | |
subcategory_id | UUID (multiple value) | Will return offers with only the provided subcategory | |
promotion_id | UUID (single value) | Will return offers with only the provided promotion | |
type | String (multiple value) | Specify offer types. ie: buy , spend , amCashEarn , amCashDiscount |
|
program_type | String (multiple value) | Specify offer program types. allowed values: traditionalcore , cardlinked , airmilesshops , bmopreapp |
|
availability | String (multiple value) | Specify where offer is avaliable. allowed values: online , in-store |
|
sort | String (multiple value) | Specify the order of the offers returned, check allowed values list. | |
offset | Number (int) | Specify how many offers to skip at the begining and then start showing the offers. | |
limit | Number (int, min = 1, max = 96) | Specify the number of offers to return |
Authenticated
When calling /offers with a token (as a collector), a few more query paramaters are available to use in addition to all the ones metioned above.
Name | Rquired | Type | Discription |
---|---|---|---|
states | String (single value) | Specify offers that have been interacted in some way by the collector. allowed values: SAVED , OPTED_IN |
|
mass_offer | Boolean | Specify to show offers that are targeted, when mass_offer = false |
Sort Value and Behaviours
Behaviour | Sort Value | Need Authentication? | Discription |
---|---|---|---|
Default | [promotionId,massOffer,…] | Offers are grouped and sorted by promotion id, mass offer, and then ranked by partner priority, and then sorted by offer priority. This is the default sort used on the AirMiles website and mobile. | |
Ending soon | [..] | Offers are sorted by End Date first, grouped and sorted by partner priority second, and finally sorted by offer priority. | |
Collector Relevance | [collectorRelevance] | ✔️ | This is sorting based on Collector prefrences powered by magic. |
Region Relevance | [regionRelevance] | This is sorting based on most popular offers in the region powered by more magic. |
Headers
Name | Rquired | Type | Discription |
---|---|---|---|
X-Correlation-Id | UUID | This is used to track the request through the logs, if not provided it will be auto generated by API and returned in the header response | |
X-Origin-Client | ✔️ | String | This field is to let us know where the request is coming from. ie: internal:amrp:postman , external:web:bmo |
Accept-Language | String - Locale | This is let API know if you want the response back in some supported language. Allowed value: en-US , fr-CA |
Authenticated
To make authenticated request you need an additional header. The tokens that are supported are member
tokens, these tokens have an associated collecter specification.
Name | Rquired | Type | Discription |
---|---|---|---|
Authorization | Bearer {token} | Specifies a collector when making call to this api. This will give the ability to see the offers tarrgeted for that collector and the states of offers |
Response
The response has two main section offers
and metadata
. The latter is very simple just containing total count of offers that match the given filters in the query parameter.
lets focus on the offers:[]
list which is a list of offer objects, lets talk about some key information thats returned to us in these offer objects (for full list of values retuned, check out Sample Response) :
Name | Type | Discription |
---|---|---|
id | UUID | Offer object ID |
partnerId | UUID | Associated partner id |
categoryId | UUID | Associated category id |
awardShort | String | description of the award associated with offer |
qualifierShort | String | Short description of what is needed to qualify for offer award |
displayDate | LocalDateTime | When can this offer show up for collectors |
startDate | LocalDateTime | When can this offer be avalilable for use by collectors. Usually same as displayDate |
endDate | LocalDateTime | When can this offer be marked as expired so that no more collectors are able to see/use it |
massOffer | Boolean | true = Offer is publicly avaliable, false = Offer is targeted to specific collectors. |
tiers | List<tier> | Offers can have multiple qualifers and each can have a different award |
mechanisms | List | How to qualify for the offer |
states | List<States> | Authenticated Request Only Will give a list of states which are object showing the name, value and when it was updated |
legalText | String | Legal copy for offer |
Sample
Request
GET /offers?region=ON&limit=1 HTTP/1.1
Host: cdn.airmilesapis.ca
X-Origin-Client: internal:amrp:postman
Authorization: Bearer `TOKEN`
Response Body
{
"offers": [
{
"id": "4a80ad4a-de28-4c77-8180-0a89a71f4a55",
"partnerId": "3267588b-791d-49bc-a321-d85d5f818480",
"partnerLabel": "AIR MILES",
"partnerLogo": {
"url": "https://dev.cdn.airmilesapis.ca/partner-logo/7m10wxejlkq7/69ZErUapt6c8WQioe6iYSS/5107f862d6a2b238ff6f7739c5a90992/AIRMILES_PLANE_ELECTRIC_BLUE_RGB_E.png"
},
"partnerProfileURL": "https://www.airmiles.ca/en/offers/partners/air-miles-reward-program-bonus-offers.html",
"categoryId": "121fa2dd-1fab-4492-8c5d-fb34624f4dda",
"categoryLabel": "Travel",
"awardShort": "You could win a Walt Disney World vacation from AIR MILES®",
"qualifierShort": "Enter with your Collector info. Plus, earn 4 extra entries when you book any trip with AIR MILES® Travel.*",
"image": {
"url": "https://s3.amazonaws.com/prod-l1-amrpwl-post-images/processed-images/4008e08c-cd46-4429-bdc6-ce763cf4731a"
},
"displayDate": "2024-05-07T00:00:00",
"startDate": "2024-05-07T00:00:00",
"endDate": "2024-05-26T23:59:59",
"description": "Contest ends May 26, 2024. Must be 18 years or older to enter. No purchase necessary. Contest Rules apply. ",
"programType": "traditionalcore",
"massOffer": true,
"displayPriority": 1000,
"tiers": [
{
"awardLong": "You could win a Walt Disney World vacation from AIR MILES®",
"qualifierLong": "Enter with your Collector info. Plus, earn 4 extra entries when you book any trip with AIR MILES® Travel.*"
}
],
"mechanisms": [
{
"mechanismType": "button",
"mechanismLabel": "Enter now",
"mechanismValue": "https://www.airmiles.ca/arrow/Splash?splashId=26100080&changeLocale=en_CA"
}
],
"states": [
{
"name": "OPT_IN",
"value": "OPTED_IN",
"updatedAt": "2024-04-29T13:56:09.083363Z"
},
{
"name": "SAVE",
"value": "SAVED",
"updatedAt": "2024-04-29T13:56:09.082147Z"
}
],
"legalText": "The Contest runs from May 6, 2024 to May 26, 2024 and is open to Canadian resident AIR MILES® collectors who have reached the age of 18. *NO PURCHASE NECESSARY Collectors can visit https://airmiles.ca/magicalmemories\nto complete and submit the form and get 1x entry. To get 4 additional entries collectors must book any trip on AIR MILES Travel during the contest period and complete their trip by July 31, 2024 (or complete the alternative bonus entry method outlined in the full contest rules). Limit one (1) base entry and four (4) bonus entries per collector number. One (1) prize is available to be won consisting of a vacation for four (4) to the Walt Disney World Resort in Florida. Approximate Prize value is $10,219.00 USD ($13,285.00 CDN). Correctly answered math skill-testing question required upon selection as a potential winner. Odds of winning depend on the number of eligible entries received. For full contest rules and details, visit https://airmiles.ca/magicalmemories\n\n®™ Trademarks of AM Royalties Limited Partnership used under license by AIR MILES Loyalty Inc.\n"
}
],
"metadata": {
"total": 265
}
}
Response Header
X-Correlation-Id | a0ccb3a7-2b19-4916-8b7e-d3059ccc17bb |
For support its best to keep track of the X-Correlation-Id
value, as that can be used to track down logs for this request.
4.2.2 - GET /offers/{id}
GET /offers/{id}
API to get all details for displaying a specific offer to collectors and the general public. This API has limited query paramenter as this is accessing a specific offer resource.
Path Parameter
Name | Rquired | Type | Discription |
---|---|---|---|
id | ✔️ | UUID (single value) | Returns the offer detail associated with this id |
Query Parameter
Name | Rquired | Type | Discription |
---|---|---|---|
region | ✔️ | String (single value) | Will only show offers from a single region |
Headers
Name | Rquired | Type | Discription |
---|---|---|---|
X-Correlation-Id | UUID | This is used to track the request through the logs, if not provided it will be auto generated by API and returned in the header response | |
X-Origin-Client | ✔️ | String | This field is to let us know where the request is coming from. ie: internal:amrp:postman , external:web:bmo |
Accept-Language | String - Locale | This is let API know if you want the response back in some supported language. Allowed value: en-US , fr-CA |
Authenticated
To make authenticated request you need an additional header. The tokens that are supported are member
tokens, these tokens have an associated collecter specification.
Name | Rquired | Type | Discription |
---|---|---|---|
Authorization | Bearer {token} | Specifies a collector when making call to this api. This will give the ability to see the offers states for the collector |
Response
The response has two main section offers
and warning
.
The warning object has two states depending on region query parameter, authentication header and offer id passed:
"warning":null
OR
"warning": {
"errorCode": "String - errCodes",
"message": "String"
}
Error Code
name | Offer Returned | description |
---|---|---|
err-login-required | YES | When viewing a targetted offer without any authorization header |
err-region | YES | When viewing an offer that does not match the region query parameter in the request |
err-not-found | NO | Offer Id does not exist, Offer Id not valid |
err-expired | NO | Offer is expired |
err-not-live | NO | Future offer, Not live yet (current date < display start date) |
err-exclusive | NO | Targeted Offer - Collector is not eligible for the Offer |
lets talk about some key information thats returned to us in the offer objects (for full list of values retuned, check out Sample Response) :
Name | Type | Discription |
---|---|---|
id | UUID | Offer object ID |
partnerId | UUID | Associated partner id |
categoryId | UUID | Associated category id |
awardShort | String | description of the award associated with offer |
qualifierShort | String | Short description of what is needed to qualify for offer award |
displayDate | LocalDateTime | When can this offer show up for collectors |
startDate | LocalDateTime | When can this offer be avalilable for use by collectors. Usually same as displayDate |
endDate | LocalDateTime | When can this offer be marked as expired so that no more collectors are able to see/use it |
massOffer | Boolean | true = Offer is publicly avaliable, false = Offer is targeted to specific collectors. |
tiers | List<tier> | Offers can have multiple qualifers and each can have a different award |
mechanisms | List | How to qualify for the offer |
states | List<States> | Authenticated Request Only, Will give a list of states which are object showing the name, value and when it was updated |
legalText | String | Legal copy for offer |
Sample
Request
GET /offers/4a80ad4a-de28-4c77-8180-0a89a71f4a55?region=ON HTTP/1.1
Host: cdn.airmilesapis.ca
X-Origin-Client: internal:amrp:postman
Authorization: Bearer `TOKEN`
Response Body
{
"offer": {
"id": "4a80ad4a-de28-4c77-8180-0a89a71f4a55",
"partnerId": "3267588b-791d-49bc-a321-d85d5f818480",
"partnerLabel": "AIR MILES",
"partnerLogo": {
"url": "https://dev.cdn.airmilesapis.ca/partner-logo/7m10wxejlkq7/69ZErUapt6c8WQioe6iYSS/5107f862d6a2b238ff6f7739c5a90992/AIRMILES_PLANE_ELECTRIC_BLUE_RGB_E.png"
},
"partnerProfileURL": "https://www.airmiles.ca/en/offers/partners/air-miles-reward-program-bonus-offers.html",
"categoryId": "121fa2dd-1fab-4492-8c5d-fb34624f4dda",
"categoryLabel": "Travel",
"awardShort": "You could win a Walt Disney World vacation from AIR MILES®",
"qualifierShort": "Enter with your Collector info. Plus, earn 4 extra entries when you book any trip with AIR MILES® Travel.*",
"image": {
"url": "https://s3.amazonaws.com/prod-l1-amrpwl-post-images/processed-images/4008e08c-cd46-4429-bdc6-ce763cf4731a"
},
"displayDate": "2024-05-07T00:00:00",
"startDate": "2024-05-07T00:00:00",
"endDate": "2024-05-26T23:59:59",
"description": "Contest ends May 26, 2024. Must be 18 years or older to enter. No purchase necessary. Contest Rules apply. ",
"programType": "traditionalcore",
"massOffer": true,
"eventBasedOffer": false,
"displayPriority": 1000,
"tiers": [
{
"awardLong": "You could win a Walt Disney World vacation from AIR MILES®",
"qualifierLong": "Enter with your Collector info. Plus, earn 4 extra entries when you book any trip with AIR MILES® Travel.*"
}
],
"mechanisms": [
{
"mechanismType": "button",
"mechanismLabel": "Enter now",
"mechanismValue": "https://www.airmiles.ca/arrow/Splash?splashId=26100080&changeLocale=en_CA"
}
],
"states": [
{
"name": "OPT_IN",
"value": "OPTED_IN",
"updatedAt": "2024-04-29T13:56:09.083363Z"
},
{
"name": "SAVE",
"value": "SAVED",
"updatedAt": "2024-04-29T13:56:09.082147Z"
}
],
"legalText": "The Contest runs from May 6, 2024 to May 26, 2024 and is open to Canadian resident AIR MILES® collectors who have reached the age of 18. *NO PURCHASE NECESSARY Collectors can visit https://airmiles.ca/magicalmemories\nto complete and submit the form and get 1x entry. To get 4 additional entries collectors must book any trip on AIR MILES Travel during the contest period and complete their trip by July 31, 2024 (or complete the alternative bonus entry method outlined in the full contest rules). Limit one (1) base entry and four (4) bonus entries per collector number. One (1) prize is available to be won consisting of a vacation for four (4) to the Walt Disney World Resort in Florida. Approximate Prize value is $10,219.00 USD ($13,285.00 CDN). Correctly answered math skill-testing question required upon selection as a potential winner. Odds of winning depend on the number of eligible entries received. For full contest rules and details, visit https://airmiles.ca/magicalmemories\n\n®™ Trademarks of AM Royalties Limited Partnership used under license by AIR MILES Loyalty Inc.\n"
},
"warning": null
}
Response Header
X-Correlation-Id | a7b3b6a8-f033-4e78-804e-f1990f317515 |
For support its best to keep track of the X-Correlation-Id
value, as that can be used to track down logs for this request.
4.2.3 - PUT /offers/{id}/states
PUT /offers/{id}/states
API to update the state of an offer for a given collector. This API can only be used with a Authorization
token, as thats how the API knows which collector should be associated with the action.
Path Parameter
Name | Rquired | Type | Discription |
---|---|---|---|
id | ✔️ | UUID (single value) | Identify the offer to updated its state |
Request Body
required
{
"states": [
{
"name": "name1",
"value": "value1"
}
]
}
The request body contains a states: []
list which can contain multiple state objects.
Name | Rquired | Type | Discription |
---|---|---|---|
name | ✔️ | String | This specifies the type of state to update, as of now we support SAVE and OPT_IN |
value | ✔️ | String | The values associated with the state to update. For name equals SAVE valid value is SAVED OR UNSAVED , for name equals OPT_IN valid value is OPTED_IN |
Headers
Name | Rquired | Type | Discription |
---|---|---|---|
X-Correlation-Id | UUID | This is used to track the request through the logs, if not provided it will be auto generated by API and returned in the header response | |
X-Origin-Client | ✔️ | String | This field is to let us know where the request is coming from. ie: internal:amrp:postman , external:web:bmo |
Authorization | ✔️ | Bearer {token} | Specifies a collector when making call to this api. |
Response
As this is a PUT
request there is no response body. Check for status code 204 No Content
for successful request.
Sample
Request
PUT /offers/e6528c38-6642-497d-85ca-f71cc5a74583/states HTTP/1.1
Host: cdn.airmilesapis.ca
Authorization: Bearer {JWT_TOKEN}
x-origin-client: internal:amrp:postman
Content-Type: application/json
Content-Length: 102
{
"states": [
{
"name": "SAVE",
"value": "SAVED"
}
]
}
Response
Body
Status Code
Status-Code: 204 No Content
Header
X-Correlation-Id | a7b3b6a8-f033-4e78-804e-f1990f317515 |
For support its best to keep track of the X-Correlation-Id
value, as that can be used to track down logs for this request.
4.3 - OpenAPI (Swagger-Spec)
5 - Transaction History
The purpose of this documentation is to provide a guide on how to integrate with the Transaction History API. As part of this documentation, we also include information on RESTful HTTPS requests/responses, error codes, and integration environments.
Target audience
This material is intended to be used by a partner wishing to integrate with the Transaction History API.
Service level objective
Please contact our partner support team for details on our Service Level Agreement (SLA). Refer to our “Escalation Guide” for contact details.
Did you know
Our “Transaction Day” for real-time Issuance runs from 12:00AM to 11:59PM EST daily.Integration environments
There are two sets of environments used by partners to integrate with the real-time checkout platform. These environments are configured similarly for consistent production-level quality, whether the partner has deployed to production or is still performing non-production testing.
Environment | Domain | Description |
---|---|---|
Certification | https://cert.airmilesapis.ca | Contains production quality code and test data used for developing and testing 3rd party integrations. |
Production | https://airmilesapis.ca | Contains production code and live user data for real-world 3rd party integrations. |
Note
ALL integration environments must be accessed via HTTPS only.Your AMRP project team
In preparation for launch, an AIR MILES team is pulled together to assist Partners with integration and setup. This team will provide the following services:
- Consulting Partners on the best technical solution to support AIR MILES Issuance based on system compatibility.
- Providing guidance for assessing Partner requirements, data exchange methods, and reconciliation.
- As well as overseeing a broad range of activities to meet the requirements of launch, including:
- Planning
- Communications
- Delivery
- Execution
- Monitoring
Commonly used acronyms
Name | Definition |
---|---|
L1 | AirMilesLoyaltyInc: Is the name of the parent organization that operates the AMRP. |
AMRP | AIR MILES Rewards Program: The loyalty program itself consisting both AIR MILES issuance an redemption processes. |
AMRM | AIR MILES Rewards Miles: The loyalty program currency that Collectors earn and redeem for travel, merchandise and cash rewards. |
RTC | Real-Time Checkout: An AIR MILES API platform specifically tailored for “Real-Time Issuance” & redemption of AIR MILES “Reward Miles”. |
M2M | Machine-to-Machine: Refers to direct communication between devices using any communications channel, including wired and wireless. This includes CLIs, daemons, or services running on your back-end that self-authenticates and/or authorizes an application without collector interaction. |
5.1 - Authentication & Authorization
For more information on “Auth0” and the various authentication flows, click the button below.
5.2 - API Library
This section includes the three (3) Transaction History API endpoints listed below. Each page offers a brief summary of the API endpoint in question, common use-case scenarios, and sample request/response messages with response codes.
API endpoints
Health Check
Test and confirm that the Transaction History API is up and ready to process requests.
Collector Request
Retrieve the transaction history for a logged in Collector.
Sponsor Request
Retrieve the transaction history for a specified Collector number and filter by sponsor.
Handling request/response messages
As described above, the RESTful specification defines a transaction as a pair of request and response messages that are used for information interchange.
Note
Mandatory parameters will be marked with an asterisk (*) in the subsequent pages.Message Type | Description |
---|---|
Request | |
Response | Content-Type is specified in the Header (e.g., application/json .responseCode .null or ’empty’ values are automatically excluded from the response body. |
Status codes
Status Code | Description |
---|---|
200 |
The transaction was successful. |
401 |
The Collector account is not active. |
408 |
The transaction timed out. |
401 |
The Collector number is invalid. |
400 |
A mistake was made when submitting the request. Please correct the error and try again. |
503 |
The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
An unknown error occurred |
none | No valid Bearer token present. Please generate a valid Bearer token and submit to continue. |
5.2.1 - Health Check
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
This test endpoint ensures there are no known connectivity issues between AIR MILES and our partners. The HEALTH call functions similarly to a standard ‘ping’ request, determining if a client or host is online and accessible.
Note
To receive a Bearer token and authorize your request, use theclient_id
and client_secret
provided to you by AIR MILES.
Tip
It is highly recommended that all partners use the HEALTH endpoint upon starting their integration, to ensure both systems can communicate properly. Also at the partner’s discretion, we recommend performing periodic HEALTH tests at regular intervals to be notified immediately in the case of any unforeseen outages.Sample request
curl -X GET
https://cert.airmilesapis.ca/transaction-history/health \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsI...' \
--header 'Channel-Code: MOBAPP' \
--header 'Accept-Language: EN'
Header parameters
Parameter | Description |
---|---|
Content-Type | Default value: application/json |
Authorization | Token from authentication.
Example: |
Channel-Code | Channel by which the transaction is called. The response will differ for different channels.
Example: |
Accept-Language | Language parameters, either “EN” for English or “FR” for French.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2019 15:27:34 GMT
{
"status": "up"
}
Status codes
Status Code | Description |
---|---|
200 |
The transaction was successful. |
408 |
The transaction timed out. |
400 |
A mistake was made when submitting the request. Please correct the error and try again. |
503 |
The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
An unknown error occurred. |
none | No valid Bearer token present. Please generate a valid Bearer token and submit to continue. |
5.2.2 - Collector Request
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
Important
This API call is not intended for manual search queries, it only retrieves the transaction history for a Collector who is logged in.This endpoint is used to retrieve the transaction history for a Collector who is logged in to the website or the mobile application. A date range must be provided (with a start and end-date), and this will return results for all sponsors the Collector has transacted with during this time period.
Note
The Collector number is embedded in the Bearer access token automatically and therefore does not need to be included in the request itself.Sample request
curl -X GET \
https://cert.airmilesapis.ca/transaction-history/cards?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=0&size=2&sort=transactionDate,desc&sort=sponsorCode,asc \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCI...' \
--header 'Channel-Code: MOBAPP' \
--header 'Accept-Language: EN'
Header parameters
Parameter | Description |
---|---|
Content-Type | Default value: application/json |
Authorization | Token from authentication.
Example: |
Channel-Code | Channel by which the transaction is called. The response will differ for different channels.
Example: |
Accept-Language | Language parameters, either “EN” for English or “FR” for French.
Example: |
Query parameters
Parameter | Description |
---|---|
from |
The start of the search date range.
Example: |
to |
The end of the search date range.
Example: |
page |
The results page to start with.
Example: |
size |
The number of transactions per page.
Example: |
sort |
Sort by field, ascending or descending. You can include up to 3 sequential sort parameters.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2019 15:27:34 GMT
{
"_embedded": {
"genericActivityDtoList": [
{
"transactionId": "bfc52daa-b1ec-44fb-b8e2-babc6f93395e",
"memberId": 80000000001,
"cardNumber": "80000000001",
"activityType": "ISSUANCE",
"transactionDate": "2019-01-20T13:15:57.000Z",
"postingDate": "2019-03-20T13:15:57.000Z",
"transactionDescription": "P&S Goodwill",
"transactionValue": 50,
"cashMiles": 44,
"dreamMiles": 6,
"cashRatio": 0.88,
"dreamRatio": 0.12,
"externalReferenceNumber": "07753481468",
"externalReferenceType": null,
"channel": "ETS",
"initiatorId": "ETSets_user",
"sponsorCode": "AIRI",
"sponsorDescriptionEnglish": "AIR MILE TRAVEL INSURANCE",
"sponsorDescriptionFrench": "ASSURANCE VOYAGE AIR MILES",
"offerClass": "BONUS",
"offerCode": "GOODWILL",
"offerDescriptionEnglish": "P&S Goodwill",
"offerDescriptionFrench": "AJUSTEMENT",
"locationCode": "",
"locationDescription": "",
"redemptionStatus": null
},
{
"transactionId": "a27c7827-a865-4425-a407-d1969b3ddfc5",
"memberId": 80000000001,
"cardNumber": "80000000001",
"activityType": "ISSUANCE",
"transactionDate": "2019-01-07T17:03:49.000Z",
"postingDate": "2019-03-01T17:03:49.000Z",
"transactionDescription": "AIR MILES Travel Insurance",
"transactionValue": 50,
"cashMiles": 14,
"dreamMiles": 36,
"cashRatio": 0.29,
"dreamRatio": 0.71,
"externalReferenceNumber": "96561512670",
"externalReferenceType": null,
"channel": "ETS",
"initiatorId": "ETSets_user",
"sponsorCode": "AIRI",
"sponsorDescriptionEnglish": "AIR MILE TRAVEL INSURANCE",
"sponsorDescriptionFrench": "ASSURANCE VOYAGE AIR MILES",
"offerClass": "BONUS",
"offerCode": "TSRTRIPC",
"offerDescriptionEnglish": "AIR MILES Travel Insurance",
"offerDescriptionFrench": "RECLAMATION D'ASSURANCE",
"locationCode": "",
"locationDescription": "",
"redemptionStatus": null
}
]
},
"_links": {
"first": {
"href": "https://cert.airmilesapis.ca/transaction-history/cards?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=0&size=2&sort=transactionDate,desc&sort=sponsorCode,asc"
},
"self": {
"href": "https://cert.airmilesapis.ca/transaction-history/cards?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=0&size=2&sort=transactionDate,desc&sort=sponsorCode,asc"
},
"next": {
"href": "https://cert.airmilesapis.ca/transaction-history/cards?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=1&size=2&sort=transactionDate,desc&sort=sponsorCode,asc"
},
"last": {
"href": "https://cert.airmilesapis.ca/transaction-history/cards?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=22&size=2&sort=transactionDate,desc&sort=sponsorCode,asc"
}
},
"page": {
"size": 2,
"totalElements": 45,
"totalPages": 23,
"number": 0
}
}
Status codes
Status Code | Description |
---|---|
200 |
The transaction was successful. |
401 |
The Collector account is not active. |
408 |
The transaction timed out. |
401 |
The Collector number is invalid. |
400 |
A mistake was made when submitting the request. Please correct the error and try again. |
503 |
The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
An unknown error occurred. |
none | No valid Bearer token present. Please generate a valid Bearer token and submit to continue. |
5.2.3 - Sponsor Request
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
This endpoint is used to retrieve the transaction history for a specified Collector and filtered by sponsor. A date range must be provided (with a start and end-date), and at least one sponsor and a single Collector number. This will return the Collector’s transaction history at the sponsor, for the time period specified above.
Note
To receive a Bearer token and authorize your request, use theclient_id
and client_secret
provided to you by AIR MILES.
Sample request
curl -X GET \
https://cert.airmilesapis.ca/transaction-history/sponsors?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=0&size=2&sort=transactionDate,desc&sort=sponsorCode,asc&sponsorList=ABC,CBA&collectorNumber=80000000001 \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCI...' \
--header 'Channel-Code: MOBAPP' \
--header 'Accept-Language: EN'
Header parameters
Parameter | Description |
---|---|
Content-Type |
Default: |
Authorization | Token from authentication.
Example: |
Channel-Code | Channel by which the transaction is called. The response will differ for different channels.
Example: |
Accept-Language | Language parameters, either “EN” for English or “FR” for French.
Example: |
Query parameters
Parameter | Description |
---|---|
from |
The start of the search date range.
Example: |
to |
The end of the search date range.
Example: |
page |
The results page to start with.
Example: |
size |
The number of transactions per page.
Example: |
sort |
Sort by field, ascending or descending. You can include up to 3 sequential sort parameters.
Example: |
sponsorList |
The ID(s) of the sponsor(s) you wish to search by.
Example: |
collectorNumber |
The Collector number you wish to search for.
Example: |
Sample response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
"_embedded": {
"genericActivityDtoList": [
{
"transactionId": "a8354c14-6533-4550-b25d-b3e8c07340e3",
"memberId": 80000000001,
"cardNumber": "80000000001",
"activityType": "ISSUANCE",
"transactionDate": "2018-11-21T21:55:07",
"postingDate": "2018-12-08T21:55:07",
"transactionDescription": "MILLES DE RECOMPENSE EN PRIME",
"transactionValue": 6,
"cashMiles": 3,
"dreamMiles": 3,
"cashRatio": 0.56,
"dreamRatio": 0.44,
"externalReferenceNumber": "66367295746",
"externalReferenceType": null,
"channel": "WEB",
"initiatorId": "WEB423672",
"sponsorCode": "AMXJ",
"sponsorDescriptionEnglish": "AMEX AIR MILES BUSINESS",
"sponsorDescriptionFrench": "CARTE POUR ENTREPRISE AMEX",
"offerClass": "BONUS",
"offerCode": "MPOOL",
"offerDescriptionEnglish": "WELCOME BONUS",
"offerDescriptionFrench": "MILLES DE RECOMPENSE EN PRIME",
"locationCode": "",
"locationDescription": null,
"redemptionStatus": null
},
{
"transactionId": "2cd4b826-6f7a-4e93-87ac-82c215bd8fe5",
"memberId": 80000000001,
"cardNumber": "80000000001",
"activityType": "ISSUANCE",
"transactionDate": "2018-11-06T20:33:54",
"postingDate": "2018-11-26T20:33:54",
"transactionDescription": "GAGNANT(E) DU CONCOURS",
"transactionValue": 6,
"cashMiles": 2,
"dreamMiles": 4,
"cashRatio": 0.37,
"dreamRatio": 0.63,
"externalReferenceNumber": "14493747740",
"externalReferenceType": null,
"channel": "BATCH",
"initiatorId": "BATCH707530",
"sponsorCode": "AMRP",
"sponsorDescriptionEnglish": "AIR MILES REWARD PROGRAM",
"sponsorDescriptionFrench": "PROGRAMME DE RECOMPENSE AIR MILES",
"offerClass": "BONUS",
"offerCode": "4352932T",
"offerDescriptionEnglish": "Contest Winner",
"offerDescriptionFrench": "GAGNANT(E) DU CONCOURS",
"locationCode": "0705",
"locationDescription": "TRANSAT",
"redemptionStatus": null
}
]
},
"_links": {
"first": {
"href": "https://cert.airmilesapis.ca/transaction-history/sponsors?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=0&size=2&sort=transactionDate,desc&sort=sponsorCode,asc&sponsorList=ABC,CBA&collectorNumber=80000000001"
},
"self": {
"href": "https://cert.airmilesapis.ca/transaction-history/sponsors?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=0&size=2&sort=transactionDate,desc&sort=sponsorCode,asc&sponsorList=ABC,CBA&collectorNumber=80000000001"
},
"next": {
"href": "https://cert.airmilesapis.ca/transaction-history/sponsors?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=1&size=2&sort=transactionDate,desc&sort=sponsorCode,asc&sponsorList=ABC,CBA&collectorNumber=80000000001"
},
"last": {
"href": "https://cert.airmilesapis.ca/transaction-history/sponsors?from=2018-01-01T00:16:45.052035Z&to=2019-10-01T00:16:45.052035Z&page=9&size=2&sort=transactionDate,desc&sort=sponsorCode,asc&sponsorList=ABC,CBA&collectorNumber=80000000001"
}
},
"page": {
"size": 2,
"totalElements": 19,
"totalPages": 10,
"number": 0
}
}
Status codes
Status Code | Description |
---|---|
200 |
The transaction was successful. |
401 |
The Collector account is not active. |
408 |
The transaction timed out. |
401 |
The Collector number is invalid. |
400 |
A mistake was made when submitting the request. Please correct the error and try again. |
503 |
The system is unavailable due to scheduled maintenance. No requests can be sent. |
500 |
An unknown error occurred. |
none | No valid Bearer token present. Please generate a valid Bearer token and submit to continue. |