API reference · CashBack
Update External Order Cashback
https://api.sandbox.cws.digital/v1/cashback/external-order/{externalOrderId}In homologationDescription
Changes a cashback already granted for an external order: releases the credit that was in the grace period, cancels the grant, fixes the value, the delivery date or the grace period.
The credit is identified by the externalOrderId in the route and by the documentPartner in the body, the same ones used in Grant Cashback for External Order.
Parameters
Path parameters
| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| externalOrderId | string | Yes | External order number, as sent in Grant Cashback for External Order. |
Request body
application/jsonRequired| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| documentPartner | string | Yes | Document of the credit's partner, the same sent in the grant, with or without mask. | |
| value | number | No | New cashback value, in reais. Rounded to two decimal places; must be greater than zero. When omitted, the current one is kept. | |
| deliveryDate | string | No | New delivery date, in the | |
| timeToReleasePoints | integer | No | New grace period, in days, before the credit is released. From 0 to 65535; | |
| status | string | No | New status of the credit. When omitted, the current one is kept. See Status and release date. Allowed values: TO_RELEASERELEASEDCANCELLEDINVALID_EXPIRED |
Business rules
Only what you send changes
An omitted field keeps the current value. value follows the grant rule: rounded to two decimal places and greater than zero. timeToReleasePoints equal to 0 goes back to the grace period of the store's loyalty program.
Status and release date
With status: RELEASED, the credit is released with today's date. With another status, the release date is cleared. Without status, the current status and date stay as they are.
Released cashback is not changed
A credit that is already RELEASED is rejected with 422, and nothing is changed.
Cashback granted per item is not changed
An external order granted by the previous version of this API, with one entry per item, has more than one credit for the same externalOrderId and partner. It is rejected with 422 by this route, and nothing is changed.
A credit from another store responds as nonexistent
Only the credits of your store are found. An externalOrderId from another store responds with the same 404 as an order that does not exist.
Responses
- 401
Missing, malformed or expired token.