API reference · CashBack

Update External Order Cashback

PUThttps://api.sandbox.cws.digital/v1/cashback/external-order/{externalOrderId}In homologation

Description

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

FieldTypeRequiredDescriptionValue
externalOrderIdstringYes

External order number, as sent in Grant Cashback for External Order.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
documentPartnerstringYes

Document of the credit's partner, the same sent in the grant, with or without mask.

valuenumberNo

New cashback value, in reais. Rounded to two decimal places; must be greater than zero. When omitted, the current one is kept.

deliveryDatestringNo

New delivery date, in the YYYY-MM-DD format. When omitted, the current one is kept.

timeToReleasePointsintegerNo

New grace period, in days, before the credit is released. From 0 to 65535; 0 goes back to the program's grace period. When omitted, the current one is kept.

statusstringNo

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.

Try it

Sandbox

Language

Credentials

Access token: saved in this tab and used on every endpoint.

Each token only reaches the partner's own data and that of the branches with an authorized link.

Don't have sandbox credentials yet? See how to request them

Request

cURL
curl --request PUT \
  --url 'https://api.sandbox.cws.digital/v1/cashback/external-order/PED-EXT-900201' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "documentPartner": "30.424.972/0001-74",
  "status": "RELEASED"
}'

Response

Click Try it to see the real response here, or pick a documented example: