Sign in

Partial cancellation

POST https://{organization}.myguper.com/api/loyalty/cancelPartial/{TID}

Cancels specific items from a confirmed transaction. Returns the redemption (cashback) that should be refunded to the customer and reverts the reward (cashback) generated for those items.

Items are matched by id (SKU) and, when needed, by price — never by the position of the item inside the request. When the same id appears in more than one line of the order:

  • All lines share the same unit price — price is optional. Lines are consumed in the order they were sent in rewardByOrder, so cancelling one unit takes the first line that still has an uncancelled quantity. The lines are interchangeable, so the refund is the same whichever one is picked.
  • The lines have different unit prices — price becomes required. Without it the request fails with 409 instead of guessing a line, since cancelling the wrong line would refund the wrong amount.

Re-sending every item of the original purchase remains the safest approach.

Try-it values populated from environment ACME (Demo)


Authentication

Token

Send your user token in the x-guper-authorization header. Endpoints that support a Public mode (e.g. acúmulo and resgate previews) accept the same request without the header — Private mode adds customer data and a confirmation token to the response.

Headers

Name Type Description
x-guper-authorization * string User token issued by Guper. Omit only on endpoints that explicitly support a Public mode.
Content-Type * string Always `application/json` for endpoints that accept a JSON body.

Path parameters

Name Type Description
TID * string Transaction ID (the `confirmToken` from the original confirmation).

Request body

Content-Type: application/json

{
    "items": [
        {
            "id": "1",
            "quantity": 1,                                      // optional
            "price": 96390                                      // optional, cents
        }
    ]
}

Responses

{
    "TID": "6ea795c61088f27baa304d3dce8e4e7a85b99f78378d1101dbfc82864759e798",
    "redemption": [
        { "cardId": 331467, "value": "949" },
        { "cardId": 331471, "value": "1748" },
        { "cardId": 331486, "value": "3432" }
    ],
    "reward": [
        { "cardId": 331532, "value": 1601 },
        { "cardId": 331533, "value": 6574 }
    ]
}

Related

Copied to clipboard