Adjust Points in a Basket (with Receipt)
POST/client/users/:correlation_id/sessions/:originalTransactionId/adjustments
-
This API call deducts the loyalty points based on the items returned in the cart inside reversalLineItems.
-
The correlationId for the original transaction is passed in the request path.
-
There may be restrictions on how old the transaction can be with adjustments still allowed. If so, adjustments cannot be made outside the adjustment period.
Notes:
-
For a single member, or In a household, if a redemption transaction begins, but one or more of the cards are subsequently set to a non-active state such as Suspended, Lost or Stolen, Fraud/Abuse, Cancelled, or Damaged and there is a subsequent adjustment (full, partial, or void), then to prevent fraud, the adjustment amount is still applied to single members or proportionally to all household members who had active cards before the redemption transaction began.
-
If a single member or household member is in a tier program, and points/status are set to roll over from one period to the next, then any adjustments that reduce or increase member point balances can affect the current tier. If the adjustment is to a previous period, then it can affect the rolled-over tier status as well. In a household, adjustments to this or previous periods may affect the tier status of all members of the household.
Legacy Endpoint
Note that the endpoint for this call has changed, but ESI still supports the old (legacy) endpoint:
{{pos_url}}/client/sessions/{{originalTransactionID}}/adjustments
Request
The correlation_id for the original transaction is passed in the request path. The cart details in ES Console will reflect the result of the adjustment in the currency used.
For more information about requests, view the documentation for the Send Finalize Transaction request.
Note that sending the call without the proper "currentCorrelationId" will result in a 400 error.
Path Variables
- correlation_id
Body
| Attribute | Definition | Format | Notes |
|---|---|---|---|
| currentCorrelationId | Correlates the session with the external system that is making the call. | Number | Recommend using GUID mapped to the value of your Session ID or something directly referenced in your system as long as it is always globally unique. The Correlation ID also becomes the Transaction ID used to log any session transactions. |
| externalTransactionID | Unique identifier for transaction used by the client. | String | Optional. |
| locale | The locale of the member from the POS system. | String | Optional. Currently "en-CA" or "fr-CA". If locale is set by the POS system in the Start Session request, this overrides locale set in the member provide and as the system default. |
| action | The action to be carried out for the adjustment. | Enum: "adjustment" | The action will always be adjustment for this type of request |
| channel | The channel through which the transaction was executed. | Enum: "STORE", "POS", "WEBSITE", "APP", or "PARTNER" | |
| transactionDate | Date and time of transaction. | String | Date of the Transaction (Full Date and Time) must be in an ISO-8601-compliant format, for example: 2022-01-17T13:48:59-04:00. |
| retailBanner | Name of company. | String | For instance, "BUYCO". |
| storeNumber | The store number of the store with which the transaction is associated. | Number | Required and must be non-empty. |
| tillNumber | The till number within the store with which the transaction is associated. | Number | This attribute is optional. |
| employeeCode | The employee number of the till operator. | Number | This attribute is optional for operations, but required for analytics. |
| priceMatrix | Retail or employee transaction. | Enum: "R" or "E" | R = Retail E = Employee |
| reversalLineItems | Details from each transaction item to be reversed. | Array | Object in array, can contain sku, quantity, and salesAmount |
| sku | The product identifier. | Number | For instance, may be scanned at Point of Sale. |
| quantity | Measure of the product amount sold. | Number | Can be partial value for unit of measure calculations where there is no directly-applicable SKU (for instance, rope sold by the foot). |
| salesAmount | MSRP less the discount, the actual sale price. | Number | MRSP minus item discount in pennies. |
Response
| Attribute | Definition | Format | Notes |
|---|---|---|---|
| loyaltyId | Unique member identifier for the transaction specified in the Request. | Number | |
| receiptMessage | Message to member. | String | May be a reminder to activate offers in future. |
| pointsAdjustment | Shows the amount of points involved in the adjustment. | Number | Shows negative number if the adjustment removes points. |
| pointsBalance | New points balance after adjustment. | Number |
Error Responses
| statusCode | errorMessage | errorCode | Definition |
|---|---|---|---|
| 400 Bad Request | Transaction is not adjustable | INVALID_REQUEST | When latest transaction is 'ADJ_NO_RECEIPT' |
| 400 Bad Request | Transaction is older than 30 days | INVALID_REQUEST | Transaction cannot be adjusted because it is more than 30 days old |
| 400 Bad Request | Adjustment transaction is locked | INVALID_REQUEST | Adjustment cannot be made to a locked transaction |
| 400 Bad Request | Adjustment is not unique (same adjustment is locked until it finishes) | INVALID_REQUEST | This adjustment is already underway and locked |
| 400 Bad Request | Adjustment Request of type EXCHANGE not supported | INVALID_REQUEST | When ‘action’ (body) is ‘EXCHANGE’ and exchange is disabled. See configuration ConfigType = ‘ADJUSTMENT_FEATURE’, attribute ‘Exchange’.’Enable’. |
| 400 Bad Request | Session account does not match | INVALID_REQUEST | When original transaction's account is different from the current session account |
| 400 Bad Request | Session does not exist. | INVALID_REQUEST | Session reference for the adjustment does not exist |
| 400 Bad Request | Cannot refund items that are not in the original cart | INVALID_REQUEST | Items that were not in the cart for the original transaction cannot be refunded |
| 400 Bad Request | LoyaltyID is not associated with the Original LoyaltyID | INVALID_REQUEST | When original transaction's loyalty ID is different from the current session's loyalty ID |
| 400 Bad Request | No Reversal Items Specified for Adjustment | INVALID_REQUEST | When 'reversalLineItems' is not provided in the request's body. It can be empty only for VOID transactions. |
| 400 Bad Request | Transaction does not exist | INVALID_REQUEST | The transaction referenced in the request does not exist |
| 400 Bad Request | storeNumber is mandatory and required to be non-empty. | MISSING_REQUIRED_FIELDS_ERROR | Require storeNumber field including a value |
| 400 Bad Request | Transaction is older than 30 days. | INVALID_REQUEST | Adjustment cannot be made outside the adjustment period |
| 409 Conflict | Too many simultaneous requests for the same account. | CONFLICT_REQUEST | FIFO sweep process for an account has been blocked because lock has been acquired for processing Adjustment. The event should be sent to the retry module, to be retried with exponential backoff. |
Request
Responses
- 200
- 400
- 409
200 - Points Adjusted
Response Headers
Thu, 21 May 2020 03:42:00 GMT186keep-alive973d2962-e98a-489d-a8dd-aa8207c21302no-referrer1;mode=block*max-age=86400max-age=31536000vibrate 'none'; geolocation 'none'sameoriginconnect-src 'none';object-src https://*.cloudfront.net;script-src https://*.cloudfront.netM3PFJEVroAMFs6g=no-cache, no-store, must-revalidatenosniffRoot=1-5ec5f887-3b4fc2ee177c7637d58565af;Sampled=0400 - Original Transaction is Not Adjustable
Response Headers
Thu, 21 May 2020 03:42:35 GMT96keep-alive0a15b1fe-3f6f-4ab2-b4d5-a29bb652c1f3no-referrer1;mode=block*max-age=86400max-age=31536000vibrate 'none'; geolocation 'none'sameoriginconnect-src 'none';object-src https://*.cloudfront.net;script-src https://*.cloudfront.netM3PKsHkKoAMFnTQ=no-cache, no-store, must-revalidatenosniffRoot=1-5ec5f8aa-1b25b7eb8c8cb4b192a0eb26;Sampled=0409 - Too Many Simultaneous Requests