Skip to main content
POST
/
v1
/
redemptions
/
{id}
/
reverse
Reverse a redemption
curl --request POST \
  --url https://api.scrip.dev/v1/redemptions/{id}/reverse \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "reason": "Customer refund request",
  "amount": "500.00",
  "idempotency_key": "reverse-12345",
  "quantity": 1
}
'
import requests

url = "https://api.scrip.dev/v1/redemptions/{id}/reverse"

payload = {
"reason": "Customer refund request",
"amount": "500.00",
"idempotency_key": "reverse-12345",
"quantity": 1
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
reason: 'Customer refund request',
amount: '500.00',
idempotency_key: 'reverse-12345',
quantity: 1
})
};

fetch('https://api.scrip.dev/v1/redemptions/{id}/reverse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrip.dev/v1/redemptions/{id}/reverse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'Customer refund request',
'amount' => '500.00',
'idempotency_key' => 'reverse-12345',
'quantity' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.scrip.dev/v1/redemptions/{id}/reverse"

payload := strings.NewReader("{\n \"reason\": \"Customer refund request\",\n \"amount\": \"500.00\",\n \"idempotency_key\": \"reverse-12345\",\n \"quantity\": 1\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.scrip.dev/v1/redemptions/{id}/reverse")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Customer refund request\",\n \"amount\": \"500.00\",\n \"idempotency_key\": \"reverse-12345\",\n \"quantity\": 1\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.scrip.dev/v1/redemptions/{id}/reverse")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"Customer refund request\",\n \"amount\": \"500.00\",\n \"idempotency_key\": \"reverse-12345\",\n \"quantity\": 1\n}"

response = http.request(request)
puts response.read_body
{
  "amount": "500.00",
  "created_at": "2024-01-15T10:30:00Z",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "journal_entry_id": "550e8400-e29b-41d4-a716-446655440002",
  "quantity": 1,
  "reason": "Customer refund request",
  "redemption_id": "550e8400-e29b-41d4-a716-446655440001"
}
{
"amount": "500.00",
"created_at": "2024-01-15T10:30:00Z",
"id": "550e8400-e29b-41d4-a716-446655440000",
"journal_entry_id": "550e8400-e29b-41d4-a716-446655440002",
"quantity": 1,
"reason": "Customer refund request",
"redemption_id": "550e8400-e29b-41d4-a716-446655440001"
}
{
"code": "bad_request",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Invalid request parameters"
}
{
"code": "unauthorized",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Missing or invalid credentials"
}
{
"code": "not_found",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Resource not found"
}
{
"code": "conflict",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Resource already exists or state conflict"
}
{
"code": "unsupported_media_type",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Content-Type must be application/json"
}
{
"code": "internal_error",
"message": "An internal error occurred"
}
Reverses a redemption, either fully or partially. To reverse the full amount, omit the amount and quantity fields. For a partial reversal, specify the amount (for raw and AMOUNT_BASED redemptions) or quantity (for UNIT_BASED catalog redemptions) to reverse. The reason field is required and must be between 1 and 500 characters. For UNIT_BASED catalog items, reversals decrement the reward’s redeemed_count, which means a reward that was OUT_OF_STOCK can transition back to ACTIVE if the reversal brings the count below max_total. For assets configured in LOT mode, reversals restore the specific lots that were consumed, following LIFO (last-in, first-out) order. Multiple partial reversals are allowed on a single redemption. The cumulative reversed amount cannot exceed the original redemption amount. Check reversed_amount on the redemption to verify headroom before issuing a partial reversal. A redemption that has already been fully reversed returns 409 with code already_reversed. Pass an idempotency_key to safely retry requests. Duplicate requests return 200 with the existing reversal instead of 201.
For usage patterns and examples, see the Redemptions guide.

Authorizations

X-API-Key
string
header
required

API key passed in the X-API-Key header.

Path Parameters

id
string<uuid>
required

Redemption ID

Body

application/json

Reversal details

reason
string
required

Why this reversal is being made (1-500 chars)

Required string length: 1 - 500
Example:

"Customer refund request"

amount
string

Amount to reverse for raw or AMOUNT_BASED redemptions (omit for full reversal, decimal string)

Example:

"500.00"

idempotency_key
string

Prevents duplicate reversals when retrying requests

Example:

"reverse-12345"

quantity
integer

Units to reverse for UNIT_BASED catalog redemptions (omit for full reversal)

Example:

1

Response

Duplicate request (idempotency key matched, returns existing record)

amount
string

Amount credited back to the participant's balance (decimal string)

Example:

"500.00"

created_at
string<date-time>

When this reversal was created

Example:

"2024-01-15T10:30:00Z"

id
string<uuid>

Unique identifier for this reversal

Example:

"550e8400-e29b-41d4-a716-446655440000"

journal_entry_id
string<uuid>

The ledger journal entry created by this reversal

Example:

"550e8400-e29b-41d4-a716-446655440002"

quantity
integer

Units reversed (UNIT_BASED catalog redemptions only)

Example:

1

reason
string

Why this reversal was made

Example:

"Customer refund request"

redemption_id
string<uuid>

The redemption that was reversed

Example:

"550e8400-e29b-41d4-a716-446655440001"