Initialize recurring
Create a new recurring billing agreement and process the first payment in the series.
curl --request POST \
--url https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id} \
--header 'Content-Type: application/json' \
--header 'x-signature: <api-key>' \
--header 'x-timestamp: <api-key>' \
--data '
{
"amount": 500000,
"recurring": {
"first_payment_date": "<string>",
"time_interval": 2,
"number_of_payments": 2,
"cancellation_date": "<string>"
},
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 2061,
"card_cardholder_name": "<string>",
"card_profile": {
"fingerprint": "<string>"
},
"cvv": "<string>"
},
"payer_fingerprint": "<string>",
"payment_collection": "hosted_page"
}
'import requests
url = "https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}"
payload = {
"amount": 500000,
"recurring": {
"first_payment_date": "<string>",
"time_interval": 2,
"number_of_payments": 2,
"cancellation_date": "<string>"
},
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 2061,
"card_cardholder_name": "<string>",
"card_profile": { "fingerprint": "<string>" },
"cvv": "<string>"
},
"payer_fingerprint": "<string>",
"payment_collection": "hosted_page"
}
headers = {
"x-timestamp": "<api-key>",
"x-signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-timestamp': '<api-key>',
'x-signature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 500000,
recurring: {
first_payment_date: '<string>',
time_interval: 2,
number_of_payments: 2,
cancellation_date: '<string>'
},
payment_instrument: {
card_number: '<string>',
expiry_month: 6,
expiry_year: 2061,
card_cardholder_name: '<string>',
card_profile: {fingerprint: '<string>'},
cvv: '<string>'
},
payer_fingerprint: '<string>',
payment_collection: 'hosted_page'
})
};
fetch('https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}', 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://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}",
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([
'amount' => 500000,
'recurring' => [
'first_payment_date' => '<string>',
'time_interval' => 2,
'number_of_payments' => 2,
'cancellation_date' => '<string>'
],
'payment_instrument' => [
'card_number' => '<string>',
'expiry_month' => 6,
'expiry_year' => 2061,
'card_cardholder_name' => '<string>',
'card_profile' => [
'fingerprint' => '<string>'
],
'cvv' => '<string>'
],
'payer_fingerprint' => '<string>',
'payment_collection' => 'hosted_page'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-signature: <api-key>",
"x-timestamp: <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://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}"
payload := strings.NewReader("{\n \"amount\": 500000,\n \"recurring\": {\n \"first_payment_date\": \"<string>\",\n \"time_interval\": 2,\n \"number_of_payments\": 2,\n \"cancellation_date\": \"<string>\"\n },\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 2061,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"payer_fingerprint\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-timestamp", "<api-key>")
req.Header.Add("x-signature", "<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://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}")
.header("x-timestamp", "<api-key>")
.header("x-signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 500000,\n \"recurring\": {\n \"first_payment_date\": \"<string>\",\n \"time_interval\": 2,\n \"number_of_payments\": 2,\n \"cancellation_date\": \"<string>\"\n },\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 2061,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"payer_fingerprint\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-timestamp"] = '<api-key>'
request["x-signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 500000,\n \"recurring\": {\n \"first_payment_date\": \"<string>\",\n \"time_interval\": 2,\n \"number_of_payments\": 2,\n \"cancellation_date\": \"<string>\"\n },\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 2061,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"payer_fingerprint\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}"
response = http.request(request)
puts response.read_body{
"transaction_id": "<string>",
"recurring_id": "<string>",
"accepted": true,
"order_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}recurring_id for later recurring and future-transaction operations.
Payment instrument
payment_instrument is required — unlike sale and pre-authorization, a hosted-page collection does
not make it optional here, since the new recurring series and its stored credential are created in
the same step. It accepts exactly one credential source: raw card details, a SmartRetry token, or a
processor provider_token. See Payment methods for the full field
reference.
Provide either payer or payer_fingerprint — not both. payer_fingerprint is a pre-computed
identifier from an earlier transaction for the same payer.
Retry a previous initialization
Use this same endpoint to create a new retry attempt. In the request body, provideretry.originating_id for the previous SmartRetry recurring initialization transaction.
Idempotency-Key. See Idempotency.Authorizations
Current Unix time in seconds. Must be within 5 minutes of server time. Included in the signed string.
Lowercase hex HMAC-SHA256 of {timestamp}.{METHOD}.{path_with_query}.{raw_body}, keyed with your API Secret. See the Authentication guide.
Headers
Optional idempotency key, scoped to terminal + matched route pattern. A replayed request returns the cached response with Idempotency-Replayed: true.
255^[\w-]+$Path Parameters
The unique identifier of the terminal.
6^[\dA-Za-z]{6}$Body
- Option 1
- Option 2
payment_instrument must be supplied, as a raw card, a SmartRetry token, or a provider_token, unless payment_collection is hosted_page.
Payment amount in major currency units (e.g. 10.00 for $10.00 USD).
0.01 <= x <= 999999.99AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VED, VES, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWL Show child attributes
Show child attributes
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Pre-computed payer fingerprint from an existing transaction. Mutually exclusive with payer.
88hosted_page curl --request POST \
--url https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id} \
--header 'Content-Type: application/json' \
--header 'x-signature: <api-key>' \
--header 'x-timestamp: <api-key>' \
--data '
{
"amount": 500000,
"recurring": {
"first_payment_date": "<string>",
"time_interval": 2,
"number_of_payments": 2,
"cancellation_date": "<string>"
},
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 2061,
"card_cardholder_name": "<string>",
"card_profile": {
"fingerprint": "<string>"
},
"cvv": "<string>"
},
"payer_fingerprint": "<string>",
"payment_collection": "hosted_page"
}
'import requests
url = "https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}"
payload = {
"amount": 500000,
"recurring": {
"first_payment_date": "<string>",
"time_interval": 2,
"number_of_payments": 2,
"cancellation_date": "<string>"
},
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 2061,
"card_cardholder_name": "<string>",
"card_profile": { "fingerprint": "<string>" },
"cvv": "<string>"
},
"payer_fingerprint": "<string>",
"payment_collection": "hosted_page"
}
headers = {
"x-timestamp": "<api-key>",
"x-signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-timestamp': '<api-key>',
'x-signature': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 500000,
recurring: {
first_payment_date: '<string>',
time_interval: 2,
number_of_payments: 2,
cancellation_date: '<string>'
},
payment_instrument: {
card_number: '<string>',
expiry_month: 6,
expiry_year: 2061,
card_cardholder_name: '<string>',
card_profile: {fingerprint: '<string>'},
cvv: '<string>'
},
payer_fingerprint: '<string>',
payment_collection: 'hosted_page'
})
};
fetch('https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}', 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://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}",
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([
'amount' => 500000,
'recurring' => [
'first_payment_date' => '<string>',
'time_interval' => 2,
'number_of_payments' => 2,
'cancellation_date' => '<string>'
],
'payment_instrument' => [
'card_number' => '<string>',
'expiry_month' => 6,
'expiry_year' => 2061,
'card_cardholder_name' => '<string>',
'card_profile' => [
'fingerprint' => '<string>'
],
'cvv' => '<string>'
],
'payer_fingerprint' => '<string>',
'payment_collection' => 'hosted_page'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-signature: <api-key>",
"x-timestamp: <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://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}"
payload := strings.NewReader("{\n \"amount\": 500000,\n \"recurring\": {\n \"first_payment_date\": \"<string>\",\n \"time_interval\": 2,\n \"number_of_payments\": 2,\n \"cancellation_date\": \"<string>\"\n },\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 2061,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"payer_fingerprint\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-timestamp", "<api-key>")
req.Header.Add("x-signature", "<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://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}")
.header("x-timestamp", "<api-key>")
.header("x-signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 500000,\n \"recurring\": {\n \"first_payment_date\": \"<string>\",\n \"time_interval\": 2,\n \"number_of_payments\": 2,\n \"cancellation_date\": \"<string>\"\n },\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 2061,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"payer_fingerprint\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://terminal.smartretry.com/v1/payments/recurring/init/{terminal_friendly_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-timestamp"] = '<api-key>'
request["x-signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 500000,\n \"recurring\": {\n \"first_payment_date\": \"<string>\",\n \"time_interval\": 2,\n \"number_of_payments\": 2,\n \"cancellation_date\": \"<string>\"\n },\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 2061,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"payer_fingerprint\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}"
response = http.request(request)
puts response.read_body{
"transaction_id": "<string>",
"recurring_id": "<string>",
"accepted": true,
"order_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}