curl --request POST \
--url https://api.scrip.dev/v1/redemptions/{id}/fail \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"idempotency_key": "fail-12345",
"reason": "provider_rejected"
}
'import requests
url = "https://api.scrip.dev/v1/redemptions/{id}/fail"
payload = {
"idempotency_key": "fail-12345",
"reason": "provider_rejected"
}
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({idempotency_key: 'fail-12345', reason: 'provider_rejected'})
};
fetch('https://api.scrip.dev/v1/redemptions/{id}/fail', 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}/fail",
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([
'idempotency_key' => 'fail-12345',
'reason' => 'provider_rejected'
]),
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}/fail"
payload := strings.NewReader("{\n \"idempotency_key\": \"fail-12345\",\n \"reason\": \"provider_rejected\"\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}/fail")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"fail-12345\",\n \"reason\": \"provider_rejected\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/redemptions/{id}/fail")
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 \"idempotency_key\": \"fail-12345\",\n \"reason\": \"provider_rejected\"\n}"
response = http.request(request)
puts response.read_body{
"amount": "1000.00",
"asset_id": "550e8400-e29b-41d4-a716-446655440003",
"capture_journal_entry_id": "550e8400-e29b-41d4-a716-446655440007",
"captured_at": "2024-01-15T10:45:00Z",
"created_at": "2024-01-15T10:30:00Z",
"description": "Redeemed: Gift Card",
"expires_at": "2024-01-15T11:30:00Z",
"failure_reason": "fulfillment_failed",
"fulfillment": {
"claim_url": "https://claim.example.com/abc123",
"created_at": "2024-01-15T10:30:00Z",
"face_currency": "USD",
"face_value_minor": 2500,
"failure_reason": "provider_permanent_error",
"provider": "TREMENDOUS",
"provider_order_id": "ord_abc123",
"resolved_at": "2024-01-15T10:45:00Z",
"status": "PROCESSING",
"updated_at": "2024-01-15T10:30:00Z"
},
"id": "550e8400-e29b-41d4-a716-446655440000",
"journal_entry_id": "550e8400-e29b-41d4-a716-446655440005",
"participant_id": "550e8400-e29b-41d4-a716-446655440002",
"program_id": "550e8400-e29b-41d4-a716-446655440001",
"quantity": 2,
"release_journal_entry_id": "550e8400-e29b-41d4-a716-446655440008",
"released_amount": "1000.00",
"reservation_id": "550e8400-e29b-41d4-a716-446655440006",
"resolved_at": "2024-01-15T10:45:00Z",
"reversed_amount": "0.00",
"reversed_quantity": 0,
"reward_id": "550e8400-e29b-41d4-a716-446655440004",
"status": "COMPLETED",
"unit_cost": "500.00",
"updated_at": "2024-01-15T10:30:00Z"
}{
"code": "bad_request",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Missing or invalid credentials"
}{
"code": "not_found",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource not found"
}{
"code": "conflict",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource already exists or state conflict"
}{
"code": "unsupported_media_type",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Content-Type must be application/json"
}{
"code": "internal_error",
"message": "An internal error occurred"
}Fail a pending redemption
Release the reservation backing a pending redemption and mark fulfillment failed. Replaying an already-failed redemption returns the same record.
curl --request POST \
--url https://api.scrip.dev/v1/redemptions/{id}/fail \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"idempotency_key": "fail-12345",
"reason": "provider_rejected"
}
'import requests
url = "https://api.scrip.dev/v1/redemptions/{id}/fail"
payload = {
"idempotency_key": "fail-12345",
"reason": "provider_rejected"
}
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({idempotency_key: 'fail-12345', reason: 'provider_rejected'})
};
fetch('https://api.scrip.dev/v1/redemptions/{id}/fail', 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}/fail",
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([
'idempotency_key' => 'fail-12345',
'reason' => 'provider_rejected'
]),
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}/fail"
payload := strings.NewReader("{\n \"idempotency_key\": \"fail-12345\",\n \"reason\": \"provider_rejected\"\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}/fail")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"fail-12345\",\n \"reason\": \"provider_rejected\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/redemptions/{id}/fail")
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 \"idempotency_key\": \"fail-12345\",\n \"reason\": \"provider_rejected\"\n}"
response = http.request(request)
puts response.read_body{
"amount": "1000.00",
"asset_id": "550e8400-e29b-41d4-a716-446655440003",
"capture_journal_entry_id": "550e8400-e29b-41d4-a716-446655440007",
"captured_at": "2024-01-15T10:45:00Z",
"created_at": "2024-01-15T10:30:00Z",
"description": "Redeemed: Gift Card",
"expires_at": "2024-01-15T11:30:00Z",
"failure_reason": "fulfillment_failed",
"fulfillment": {
"claim_url": "https://claim.example.com/abc123",
"created_at": "2024-01-15T10:30:00Z",
"face_currency": "USD",
"face_value_minor": 2500,
"failure_reason": "provider_permanent_error",
"provider": "TREMENDOUS",
"provider_order_id": "ord_abc123",
"resolved_at": "2024-01-15T10:45:00Z",
"status": "PROCESSING",
"updated_at": "2024-01-15T10:30:00Z"
},
"id": "550e8400-e29b-41d4-a716-446655440000",
"journal_entry_id": "550e8400-e29b-41d4-a716-446655440005",
"participant_id": "550e8400-e29b-41d4-a716-446655440002",
"program_id": "550e8400-e29b-41d4-a716-446655440001",
"quantity": 2,
"release_journal_entry_id": "550e8400-e29b-41d4-a716-446655440008",
"released_amount": "1000.00",
"reservation_id": "550e8400-e29b-41d4-a716-446655440006",
"resolved_at": "2024-01-15T10:45:00Z",
"reversed_amount": "0.00",
"reversed_quantity": 0,
"reward_id": "550e8400-e29b-41d4-a716-446655440004",
"status": "COMPLETED",
"unit_cost": "500.00",
"updated_at": "2024-01-15T10:30:00Z"
}{
"code": "bad_request",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Missing or invalid credentials"
}{
"code": "not_found",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource not found"
}{
"code": "conflict",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource already exists or state conflict"
}{
"code": "unsupported_media_type",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Content-Type must be application/json"
}{
"code": "internal_error",
"message": "An internal error occurred"
}PENDING redemption as FAILED and returns the reserved value still in HELD to AVAILABLE in one RELEASE journal entry. Include an optional reason to retain the fulfillment outcome on the redemption. The response names that entry in release_journal_entry_id and the amount it returned in released_amount.
Reserved LOT value can expire before failure. The RELEASE returns only the part still held and never recreates expired value. If all of the reserved value has expired, no RELEASE is created and both fields are null. Repeating failure returns the stored redemption; a different terminal outcome returns 409 redemption_already_resolved.
Authorizations
API key passed in the X-API-Key header.
Path Parameters
Redemption ID
Body
Failure details
Response
Redemption failed or same-outcome replay
Total amount debited from the participant's balance (decimal string)
"1000.00"
The asset that was debited
"550e8400-e29b-41d4-a716-446655440003"
Ledger entry that captured a pending redemption
"550e8400-e29b-41d4-a716-446655440007"
When the pending redemption was captured
"2024-01-15T10:45:00Z"
When this redemption was created
"2024-01-15T10:30:00Z"
Context for this redemption, used in journal entries
"Redeemed: Gift Card"
Effective deadline of the backing reservation. Always present for pending redemptions; defaults to 90 days and may be configured up to one year.
"2024-01-15T11:30:00Z"
Machine-readable or operator-supplied terminal failure detail
"fulfillment_failed"
Gift-card vendor order status, present only for provider-backed (fulfillment) redemptions
Show child attributes
Show child attributes
Unique identifier for this redemption
"550e8400-e29b-41d4-a716-446655440000"
Immutable ledger anchor: the hold entry for pending redemptions, otherwise the instant redemption entry
"550e8400-e29b-41d4-a716-446655440005"
The participant who redeemed
"550e8400-e29b-41d4-a716-446655440002"
The program this redemption belongs to
"550e8400-e29b-41d4-a716-446655440001"
Number of units redeemed (catalog redemptions only)
2
Ledger entry that released a pending redemption's reserved value back to AVAILABLE. Present only on FAILED and CANCELLED redemptions whose reservation resolved RELEASED; null while PENDING, after capture (see capture_journal_entry_id), and when every reserved lot had already expired before release (the reservation resolved EXPIRED and no release entry was posted).
"550e8400-e29b-41d4-a716-446655440008"
Amount the release entry returned to AVAILABLE (decimal string). Equals the authorized amount unless part of the reserved value expired before release, in which case only the live remainder is reported. Present exactly when release_journal_entry_id is present.
"1000.00"
Reservation backing a pending redemption
"550e8400-e29b-41d4-a716-446655440006"
When the pending redemption reached a terminal state
"2024-01-15T10:45:00Z"
Cumulative amount reversed so far (decimal string)
"0.00"
Cumulative units reversed so far (UNIT_BASED catalog redemptions only)
0
The reward catalog item that was redeemed (catalog redemptions only)
"550e8400-e29b-41d4-a716-446655440004"
Current lifecycle and reversal state
PENDING, COMPLETED, FAILED, CANCELLED, PARTIALLY_REVERSED, FULLY_REVERSED "COMPLETED"
Cost per unit at the time of redemption (catalog redemptions only, decimal string)
"500.00"
When this redemption was last updated (e.g., after a reversal)
"2024-01-15T10:30:00Z"