Partner Calculated Endpoints
Includes the API endpoints POST, POST/EVENT, REVERSE, REVERSE/EVENT, and RECORD.
Table of contents
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.
1 - POST
Used to issue Miles to a Collector’s account in real-time for a basket transaction at checkout.
POST
/checkout/issuance/post
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The POST
endpoint is used to issue Miles to a Collector’s account in real-time for a basket transaction at checkout. With this method selected The total Miles to be issued 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
- 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
- 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
- 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
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.
|
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
|
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
|
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
|
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
|
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
|
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples: "2019-05-30T14:12:59.479Z" "1972-07-16T13:32:05.234+04:00"
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
|
collectorNumber * |
The customer’s AIR MILES account number.
Must be 11 digits in length and must start with an 8 |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: {"key1": "value1","key2": "value2"}
|
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: ["57841","57862"]
|
deviceId |
ID number used to identify the POS terminal currently in use.
|
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
[{"issuanceOfferCode": "STANDARD","locationCode": "1100"}]
- contributingItemIds
- Basket item SKUs that contributed for the Issuance.
- Example:
"SKU123"
- issuanceOfferCode*
- The offer code that miles are issued against. This is the offer code that is setup by the Partner and AIR MILES for the
sponsorCode in the transaction.
- Example:
"STANDARD"
- locationCode
- A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
- Example:
ST90
- milesAmount*
- The number of miles to be issued to the Collector.
- Example:
2
- offerDescription
- The description of the offer that the issuance is based on.
- Example:
"This is a sample description."
- offerId*
- The identifier for an offer in the Partner's system. This can be the same value as your
issuanceOfferCode OR an internal marketing code shared with AIR MILES.
- Example:
"11234"
|
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:
[{"id": "SKU1234","name": "Dog Food"}]
- id*
- The basket item's SKU.
- Example:
"1234"
- name*
- The name of the item.
- Example:
"Dog food"
- number*
- The order in which items were added to the basket.
- Example:
2
- quantity*
- The quantity of an item in the basket.
- Example:
3
- baseAmount*
- The pre-tax dollar amount for a single quantity of an item in the basket.
- Example:
9.99
- finalAmount*
- The pre-tax dollar amount for all identical items in the basket (i.e.,
baseAmount x quantity ).
- Example:
29.97
- departmentId
- This field is mapped to a department value you would use to issue bonus miles at a department level
- Example:
10001
- categoryId
- This field is mapped to a category value you would use to issue bonus miles at a category level
- Example:
CAT2
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
|
sponsorCode * |
Alpha-numeric value used to identify the Partner.
To be provided by AIR MILES |
tender |
The method of payment used to pay for the transaction at checkout.
Example: ["CASH","CREDIT"]
|
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:
[{"confirmationNumber: 0ed100a4-fc9a-41bb-a747-942c2593b683", "status": "confirmed"}]
- confirmationNumber
- The UUID generated after processing an issuance request.
- Example:
"0ed100a4-fc9a-41bb-a747-942c2593b683"
- errors
- Errors that occur during an issuance transaction.
- Example -
errorCode ): "CollectorNotFound"
- Example -
errorReason ): "The requested collector does not exist."
- Click here to view the "Error Codes" table
- processedDateTime
- The date/time (see ISO-8601) that miles were issued to the Collector.
- Example:
"2019-05-30T14:12:59.479Z"
- status
- The status of the transaction. (Statuses include:
PENDING , CONFIRMED , REJECTED )
- Example:
"CONFIRMED"
|
transactionId |
A unique ID created for the particular transaction.
Example: "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
To be provided by AIR MILES |
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 - POST/EVENT
Used to issue Miles to a Collector’s account in real-time for a non-transactional reason.
POST
/checkout/issuance/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 Miles to a Collector’s account in real-time for a non-transactional reason (e.g., issuing Miles for desired activity or issuing a manual correction to a Collector’s account). With this method selected the total Miles to be issued 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
- 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
- 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
- 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
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.
|
collectorNumber * |
The customer’s AIR MILES account number.
Must be 11 digits in length and must start with an 8 |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: {"key1": "value1","key2": "value2"}
|
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: ["57841","57862"]
|
deviceId |
ID number used to identify the POS terminal currently in use.
|
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
[{"issuanceOfferCode": "STANDARD","locationCode": "1100"}]
- issuanceOfferCode*
- The offer code that miles are issued against. This is the offer code that is setup by the Partner and AIR MILES for the
sponsorCode in the transaction.
- Example:
"STANDARD"
- locationCode
- A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
- Example:
ST90
- milesAmount*
- The number of miles to be issued to the Collector.
- Example:
2
- offerDescription
- The description of the offer that the issuance is based on.
- Example:
"This is a sample description."
- offerId*
- The identifier for an offer in the Partner's system. This can be the same value as your
issuanceOfferCode OR an internal marketing code shared with AIR MILES.
- Example:
"11234"
|
sponsorCode * |
Alpha-numeric value used to identify the Partner.
To be provided by AIR MILES |
transactionDateTime * |
The date and time the request was sent.
Example: "2021-11-09T21:04:45.930Z"
|
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:
[{"status": "PENDING"}]
- status
- The status of the transaction. (Statuses include:
PENDING , CONFIRMED , REJECTED )
- Example:
"CONFIRMED"
|
transactionId |
A unique ID created for the particular transaction.
Example: "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
To be provided by AIR MILES |
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. |
3 - REVERSE
Used to reverse Miles from a Collector’s account for returns or corrections.
POST
/checkout/issuance/reverse
Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.
The REVERSE
endpoint is used to reverse 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
- 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.
- 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
- 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
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.
|
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
|
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
|
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
|
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
|
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
|
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples: "2019-05-30T14:12:59.479Z" "1972-07-16T13:32:05.234+04:00"
|
checkoutTransactionId * |
Unique identifier generated by the Partner for the transaction at checkout.
|
collectorNumber * |
The customer’s AIR MILES account number.
Must be 11 digits in length and must start with an 8 |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: {"key1": "value1","key2": "value2"}
|
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: ["57841","57862"]
|
deviceId |
ID number used to identify the POS terminal currently in use.
|
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
[{"issuanceOfferCode": "STANDARD","locationCode": "1100"}]
- contributingItemIds
- Basket item SKUs that contributed for the Issuance.
- Example:
"SKU123"
- issuanceOfferCode*
- The offer code that miles are issued against. This is the offer code that is setup by the Partner and AIR MILES for the
sponsorCode in the transaction.
- Example:
"STANDARD"
- locationCode
- A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
- Example:
ST90
- milesAmount*
- The number of miles to be issued to the Collector.
- Example:
2
- offerDescription
- The description of the offer that the issuance is based on.
- Example:
"This is a sample description."
- offerId*
- The identifier for an offer in the Partner's system. This can be the same value as your
issuanceOfferCode OR an internal marketing code shared with AIR MILES.
- Example:
"11234"
|
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:
[{"id": "SKU1234","name": "Dog Food"}]
- id*
- The basket item's SKU.
- Example:
"1234"
- name*
- The name of the item.
- Example:
"Dog food"
- number*
- The order in which items were added to the basket.
- Example:
2
- quantity*
- The quantity of an item in the basket.
- Example:
3
- baseAmount*
- The pre-tax dollar amount for a single quantity of an item in the basket.
- Example:
9.99
- finalAmount*
- The pre-tax dollar amount for all identical items in the basket (i.e.,
baseAmount x quantity ).
- Example:
29.97
- departmentId
- This field is mapped to a department value you would use to issue bonus miles at a department level
- Example:
10001
- categoryId
- This field is mapped to a category value you would use to issue bonus miles at a category level
- Example:
CAT2
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
|
originalTransactionId |
This value represents the transactionId 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: "d445b671-7a7f-490f-a3f8-adfc443408a5"
|
sponsorCode * |
Alpha-numeric value used to identify the Partner.
To be provided by AIR MILES |
tender |
The method of payment used to pay for the transaction at checkout.
Example: ["CASH","CREDIT"]
|
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:
[{"confirmationNumber: 0ed100a4-fc9a-41bb-a747-942c2593b683", "status": "confirmed"}]
- confirmationNumber
- The UUID generated after processing an issuance request.
- Example:
"0ed100a4-fc9a-41bb-a747-942c2593b683"
- errors
- Errors that occur during an issuance transaction.
- Example -
errorCode ): "CollectorNotFound"
- Example -
errorReason ): "The requested collector does not exist."
- Click here to view the "Error Codes" table
- processedDateTime
- The date/time (see ISO-8601) that miles were issued to the Collector.
- Example:
"2019-05-30T14:12:59.479Z"
- status
- The status of the transaction. (Statuses include:
PENDING , CONFIRMED , REJECTED )
- Example:
"CONFIRMED"
|
transactionId |
A unique ID created for the particular transaction.
Example: "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
To be provided by AIR MILES |
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. |
4 - REVERSE/EVENT
Used to reverse Miles from a Collector’s account in real-time for a non-transactional reason.
POST
/checkout/issuance/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 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 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
- 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
- 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
- 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
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.
|
collectorNumber * |
The customer’s AIR MILES account number.
Must be 11 digits in length and must start with an 8 |
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: ["57841","57862"]
|
context |
Notes or additional information that is desired on each request as a key value pair.
Example: {"key1": "value1","key2": "value2"}
|
deviceId |
ID number used to identify the POS terminal currently in use.
|
issuances * |
This mandatory object contains data elements related to issuance data.
Example:
[{"issuanceOfferCode": "STANDARD","locationCode": "1100"}]
- issuanceOfferCode*
- The offer code that miles are issued against. This is the offer code that is setup by the Partner and AIR MILES for the
sponsorCode in the transaction.
- Example:
"STANDARD"
- locationCode
- A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
- Example:
ST90
- milesAmount*
- The number of miles to be issued to the Collector.
- Example:
2
- offerDescription
- The description of the offer that the issuance is based on.
- Example:
"This is a sample description."
- offerId*
- The identifier for an offer in the Partner's system. This can be the same value as your
issuanceOfferCode OR an internal marketing code shared with AIR MILES.
- Example:
"11234"
|
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.
|
sponsorCode * |
Alpha-numeric value used to identify the Partner.
To be provided by AIR MILES |
transactionDateTime * |
The date and time the request was sent.
Example: "2021-11-09T21:04:45.930Z"
|
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:
[{"status": "PENDING"}]
- status
- The status of the transaction. (Statuses include:
PENDING , CONFIRMED , REJECTED )
- Example:
"CONFIRMED"
|
transactionId |
A unique ID created for the particular transaction.
Example: "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
To be provided by AIR MILES |
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. |
5 - RECORD
Used to test and verify the transmission of transactions to AIR MILES.
POST
/checkout/issuance/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
- 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
- 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
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.
|
basketHSTAmount |
The dollar amount of HST (Harmonized Sales Tax) to be added.
|
basketPSTAmount |
The dollar amount of PST (Provincial Sales Tax) to be added.
|
basketQSTAmount |
The dollar amount of QST (Quebec Sales Tax) to be added.
|
basketPostTaxAmount * |
The total dollar amount of the basket, POST-TAX (i.e., what the Collector spent at checkout).
|
basketPreTaxAmount * |
The total dollar amount of the basket, PRE-TAX (i.e., before taxes are calculated and added to the total).
|
checkoutDateTime * |
Standard date/time format for the transaction at checkout. (see ISO-8601)
Examples: "2019-05-30T14:12:59.479Z" "1972-07-16T13:32:05.234+04:00"
|
checkoutTransactionId * |
Unique identifier generated by the partner for the transaction at checkout.
|
collectorNumber |
The customer’s AIR MILES account number.
Must be 11 digits in length and must start with an 8 |
context |
Notes or additional information that is desired on each request as a key value pair.
Example: {"key1": "value1","key2": "value2"}
|
coupon |
A list of all coupon codes applied to the bill at checkout.
Example: ["57841","57862"]
|
deviceId |
ID number used to identify the POS terminal currently in use.
|
issuances |
This optional object contains data elements related to issuance data.
Example:
[{"issuanceOfferCode": "STANDARD","locationCode": "1100"}]
- contributingItemIds
- Basket item SKUs that contributed for the Issuance.
- Example:
"SKU123"
- issuanceOfferCode*
- The offer code that miles are issued against. This is the offer code that is setup by the Partner and AIR MILES for the
sponsorCode in the transaction.
- Example:
"STANDARD"
- locationCode
- A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
- Example:
ST90
- milesAmount*
- The number of miles to be issued to the Collector.
- Example:
2
- offerDescription
- The description of the offer that the issuance is based on.
- Example:
"This is a sample description."
- offerId*
- The identifier for an offer in the Partner's system. This can be the same value as your
issuanceOfferCode OR an internal marketing code shared with AIR MILES.
- Example:
"11234"
|
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:
[{"id": "SKU1234","name": "Dog Food"}]
- id*
- The basket item's SKU.
- Example:
"1234"
- name*
- The name of the item.
- Example:
"Dog food"
- number*
- The order in which items were added to the basket.
- Example:
2
- quantity*
- The quantity of an item in the basket.
- Example:
3
- baseAmount*
- The pre-tax dollar amount for a single quantity of an item in the basket.
- Example:
9.99
- finalAmount*
- The pre-tax dollar amount for all identical items in the basket (i.e.,
baseAmount x quantity ).
- Example:
29.97
- departmentId
- This field is mapped to a department value you would use to issue bonus miles at a department level
- Example:
10001
- categoryId
- This field is mapped to a category value you would use to issue bonus miles at a category level
- Example:
CAT2
|
locationCode |
A maximum of four alpha-numeric characters created by the Partner and used to identify the Partner’s location.
|
originalTransactionId |
This value represents the transactionId 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: "d445b671-7a7f-490f-a3f8-adfc443408a5"
|
sponsorCode * |
Alpha-numeric value used to identify the Partner.
To be provided by AIR MILES |
tender |
The method of payment used to pay for the transaction at checkout.
Example: ["CASH","CREDIT"]
|
transactionType * |
Transaction Type can be PURCHASE or RETURN .
|
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: "c4f6cd00-dd00-4aaf-9099-b0685ab710b3"
To be provided by AIR MILES |
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. |