curl --request POST \
--url https://api.scrip.dev/v1/programs \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Q1 Sales Bonus",
"description": "Quarterly sales incentive program for the sales team",
"fulfillment_max_face_value_minor": 10000,
"fulfillment_mode": "ASYNC",
"fulfillment_participant_max_amount_minor": 25000,
"fulfillment_participant_max_count": 3,
"fulfillment_participant_window_seconds": 86400,
"on_unknown_participant": "CREATE",
"pending_redemption_ttl": "24h"
}
'import requests
url = "https://api.scrip.dev/v1/programs"
payload = {
"name": "Q1 Sales Bonus",
"description": "Quarterly sales incentive program for the sales team",
"fulfillment_max_face_value_minor": 10000,
"fulfillment_mode": "ASYNC",
"fulfillment_participant_max_amount_minor": 25000,
"fulfillment_participant_max_count": 3,
"fulfillment_participant_window_seconds": 86400,
"on_unknown_participant": "CREATE",
"pending_redemption_ttl": "24h"
}
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({
name: 'Q1 Sales Bonus',
description: 'Quarterly sales incentive program for the sales team',
fulfillment_max_face_value_minor: 10000,
fulfillment_mode: 'ASYNC',
fulfillment_participant_max_amount_minor: 25000,
fulfillment_participant_max_count: 3,
fulfillment_participant_window_seconds: 86400,
on_unknown_participant: 'CREATE',
pending_redemption_ttl: '24h'
})
};
fetch('https://api.scrip.dev/v1/programs', 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/programs",
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([
'name' => 'Q1 Sales Bonus',
'description' => 'Quarterly sales incentive program for the sales team',
'fulfillment_max_face_value_minor' => 10000,
'fulfillment_mode' => 'ASYNC',
'fulfillment_participant_max_amount_minor' => 25000,
'fulfillment_participant_max_count' => 3,
'fulfillment_participant_window_seconds' => 86400,
'on_unknown_participant' => 'CREATE',
'pending_redemption_ttl' => '24h'
]),
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/programs"
payload := strings.NewReader("{\n \"name\": \"Q1 Sales Bonus\",\n \"description\": \"Quarterly sales incentive program for the sales team\",\n \"fulfillment_max_face_value_minor\": 10000,\n \"fulfillment_mode\": \"ASYNC\",\n \"fulfillment_participant_max_amount_minor\": 25000,\n \"fulfillment_participant_max_count\": 3,\n \"fulfillment_participant_window_seconds\": 86400,\n \"on_unknown_participant\": \"CREATE\",\n \"pending_redemption_ttl\": \"24h\"\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/programs")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q1 Sales Bonus\",\n \"description\": \"Quarterly sales incentive program for the sales team\",\n \"fulfillment_max_face_value_minor\": 10000,\n \"fulfillment_mode\": \"ASYNC\",\n \"fulfillment_participant_max_amount_minor\": 25000,\n \"fulfillment_participant_max_count\": 3,\n \"fulfillment_participant_window_seconds\": 86400,\n \"on_unknown_participant\": \"CREATE\",\n \"pending_redemption_ttl\": \"24h\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs")
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 \"name\": \"Q1 Sales Bonus\",\n \"description\": \"Quarterly sales incentive program for the sales team\",\n \"fulfillment_max_face_value_minor\": 10000,\n \"fulfillment_mode\": \"ASYNC\",\n \"fulfillment_participant_max_amount_minor\": 25000,\n \"fulfillment_participant_max_count\": 3,\n \"fulfillment_participant_window_seconds\": 86400,\n \"on_unknown_participant\": \"CREATE\",\n \"pending_redemption_ttl\": \"24h\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-15T10:30:00Z",
"deleted_at": "2024-06-01T00:00:00Z",
"description": "Quarterly sales incentive program",
"fulfillment_max_face_value_minor": 10000,
"fulfillment_mode": "INSTANT",
"fulfillment_participant_max_amount_minor": 25000,
"fulfillment_participant_max_count": 3,
"fulfillment_participant_window_seconds": 86400,
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Q1 Sales Bonus",
"on_unknown_participant": "CREATE",
"pending_redemption_ttl": "24h",
"redemption_target_entity_id": "550e8400-e29b-41d4-a716-446655440002",
"redemption_target_type": "SYSTEM_REDEMPTION",
"status": "ACTIVE",
"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": "forbidden",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Insufficient permissions for this action"
}{
"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": "unprocessable",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Business rule violation"
}{
"code": "internal_error",
"message": "An internal error occurred"
}Create a program
Create a new program.
curl --request POST \
--url https://api.scrip.dev/v1/programs \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Q1 Sales Bonus",
"description": "Quarterly sales incentive program for the sales team",
"fulfillment_max_face_value_minor": 10000,
"fulfillment_mode": "ASYNC",
"fulfillment_participant_max_amount_minor": 25000,
"fulfillment_participant_max_count": 3,
"fulfillment_participant_window_seconds": 86400,
"on_unknown_participant": "CREATE",
"pending_redemption_ttl": "24h"
}
'import requests
url = "https://api.scrip.dev/v1/programs"
payload = {
"name": "Q1 Sales Bonus",
"description": "Quarterly sales incentive program for the sales team",
"fulfillment_max_face_value_minor": 10000,
"fulfillment_mode": "ASYNC",
"fulfillment_participant_max_amount_minor": 25000,
"fulfillment_participant_max_count": 3,
"fulfillment_participant_window_seconds": 86400,
"on_unknown_participant": "CREATE",
"pending_redemption_ttl": "24h"
}
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({
name: 'Q1 Sales Bonus',
description: 'Quarterly sales incentive program for the sales team',
fulfillment_max_face_value_minor: 10000,
fulfillment_mode: 'ASYNC',
fulfillment_participant_max_amount_minor: 25000,
fulfillment_participant_max_count: 3,
fulfillment_participant_window_seconds: 86400,
on_unknown_participant: 'CREATE',
pending_redemption_ttl: '24h'
})
};
fetch('https://api.scrip.dev/v1/programs', 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/programs",
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([
'name' => 'Q1 Sales Bonus',
'description' => 'Quarterly sales incentive program for the sales team',
'fulfillment_max_face_value_minor' => 10000,
'fulfillment_mode' => 'ASYNC',
'fulfillment_participant_max_amount_minor' => 25000,
'fulfillment_participant_max_count' => 3,
'fulfillment_participant_window_seconds' => 86400,
'on_unknown_participant' => 'CREATE',
'pending_redemption_ttl' => '24h'
]),
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/programs"
payload := strings.NewReader("{\n \"name\": \"Q1 Sales Bonus\",\n \"description\": \"Quarterly sales incentive program for the sales team\",\n \"fulfillment_max_face_value_minor\": 10000,\n \"fulfillment_mode\": \"ASYNC\",\n \"fulfillment_participant_max_amount_minor\": 25000,\n \"fulfillment_participant_max_count\": 3,\n \"fulfillment_participant_window_seconds\": 86400,\n \"on_unknown_participant\": \"CREATE\",\n \"pending_redemption_ttl\": \"24h\"\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/programs")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q1 Sales Bonus\",\n \"description\": \"Quarterly sales incentive program for the sales team\",\n \"fulfillment_max_face_value_minor\": 10000,\n \"fulfillment_mode\": \"ASYNC\",\n \"fulfillment_participant_max_amount_minor\": 25000,\n \"fulfillment_participant_max_count\": 3,\n \"fulfillment_participant_window_seconds\": 86400,\n \"on_unknown_participant\": \"CREATE\",\n \"pending_redemption_ttl\": \"24h\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs")
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 \"name\": \"Q1 Sales Bonus\",\n \"description\": \"Quarterly sales incentive program for the sales team\",\n \"fulfillment_max_face_value_minor\": 10000,\n \"fulfillment_mode\": \"ASYNC\",\n \"fulfillment_participant_max_amount_minor\": 25000,\n \"fulfillment_participant_max_count\": 3,\n \"fulfillment_participant_window_seconds\": 86400,\n \"on_unknown_participant\": \"CREATE\",\n \"pending_redemption_ttl\": \"24h\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-15T10:30:00Z",
"deleted_at": "2024-06-01T00:00:00Z",
"description": "Quarterly sales incentive program",
"fulfillment_max_face_value_minor": 10000,
"fulfillment_mode": "INSTANT",
"fulfillment_participant_max_amount_minor": 25000,
"fulfillment_participant_max_count": 3,
"fulfillment_participant_window_seconds": 86400,
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Q1 Sales Bonus",
"on_unknown_participant": "CREATE",
"pending_redemption_ttl": "24h",
"redemption_target_entity_id": "550e8400-e29b-41d4-a716-446655440002",
"redemption_target_type": "SYSTEM_REDEMPTION",
"status": "ACTIVE",
"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": "forbidden",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Insufficient permissions for this action"
}{
"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": "unprocessable",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Business rule violation"
}{
"code": "internal_error",
"message": "An internal error occurred"
}name. By default, on_unknown_participant is set to CREATE, which means participants are auto-created on their first event. Set it to REJECT if you need explicit registration before processing events.
Programs start as ACTIVE. You can suspend or archive them later via Update a program.
Authorizations
API key passed in the X-API-Key header.
Body
Program details
Program name
1 - 255"Q1 Sales Bonus"
Optional program description
1000"Quarterly sales incentive program for the sales team"
Maximum face value of one gift-card redemption, in fiat minor units. Omit for no limit.
10000
Default redemption behavior when capture is omitted. Defaults to INSTANT.
INSTANT, ASYNC "ASYNC"
Maximum total face value per participant in the rolling period, in fiat minor units. Counts the same order statuses as fulfillment_participant_max_count. Omit for no limit.
25000
Maximum gift-card redemptions per participant in the rolling period. Counts PENDING, PROCESSING, AWAITING_FUNDS, and SUCCEEDED orders. Omit for no limit.
3
Rolling period, in seconds, used for each participant's gift-card limits. Required when either limit is set.
86400
How to handle events for unregistered participants. Defaults to CREATE when absent or null; an explicit "" or any non-enum value is rejected.
CREATE, REJECT "CREATE"
Optional program-specific bound between 60 seconds and one year. Accepts Go-style durations plus d/w; without a request or program bound, pending redemptions default to 90 days.
"24h"
Response
Program created
When the program was created
"2024-01-15T10:30:00Z"
Set when the program is archived
"2024-06-01T00:00:00Z"
Optional program description
"Quarterly sales incentive program"
Maximum face value of one gift-card redemption, in fiat minor units. Absent means unlimited.
10000
Default redemption behavior when capture is omitted
INSTANT, ASYNC "INSTANT"
Maximum total face value per participant in the rolling period, in fiat minor units. Counts the same order statuses as fulfillment_participant_max_count. Absent means unlimited.
25000
Maximum gift-card redemptions per participant in the rolling period. Counts PENDING, PROCESSING, AWAITING_FUNDS, and SUCCEEDED orders. Absent means unlimited.
3
Rolling period, in seconds, used for each participant's gift-card limits. Present only when at least one limit is set.
86400
Program ID
"550e8400-e29b-41d4-a716-446655440000"
Program name
"Q1 Sales Bonus"
How events for unregistered participants are handled
"CREATE"
Optional program-specific bound between 60 seconds and one year. Without a request or program bound, pending redemptions default to 90 days.
"24h"
Target ledger entity ID. Present only when redemption_target_type is LEDGER_ENTITY.
"550e8400-e29b-41d4-a716-446655440002"
Where redeemed value is posted: SYSTEM_REDEMPTION, SYSTEM_BREAKAGE, or LEDGER_ENTITY
"SYSTEM_REDEMPTION"
Lifecycle state
"ACTIVE"
When the program was last modified
"2024-01-15T10:30:00Z"