Trigger Recurring Payment
curl --request POST \
--url https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/ \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"reference_id": "<string>"
}
'import requests
url = "https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/"
payload = {
"amount": 123,
"reference_id": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({amount: 123, reference_id: '<string>'})
};
fetch('https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/', 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.example.com/pg/subscriptions/{subscription_id}/recurring_payment/",
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' => 123,
'reference_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/pg/subscriptions/{subscription_id}/recurring_payment/"
payload := strings.NewReader("{\n \"amount\": 123,\n \"reference_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/pg/subscriptions/{subscription_id}/recurring_payment/")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"reference_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"reference_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Recurring payment triggered successfully",
"data": {
"subscription_id": "SUB7989707770",
"payment_id": "REC-SUB7989707770-a1b2c3d4",
"payment_amount": 500.00,
"status": "success",
"message": "ADHOC recurring payment initiated successfully"
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"amount": "Recurring amount must be less than or equal to the subscription billing amount"
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"reference_id": "Reference ID already exists"
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"recurring": "A recurring charge is already in progress for this subscription; wait for it to complete before initiating another."
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_003",
"message": "API error",
"details": {
"message": "Failed to trigger recurring payment"
}
}
}
Subscriptions
Trigger Recurring Payment
Trigger a recurring payment for an ADHOC subscription.
POST
/
pg
/
subscriptions
/
{subscription_id}
/
recurring_payment
/
Trigger Recurring Payment
curl --request POST \
--url https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/ \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"reference_id": "<string>"
}
'import requests
url = "https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/"
payload = {
"amount": 123,
"reference_id": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({amount: 123, reference_id: '<string>'})
};
fetch('https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/', 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.example.com/pg/subscriptions/{subscription_id}/recurring_payment/",
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' => 123,
'reference_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/pg/subscriptions/{subscription_id}/recurring_payment/"
payload := strings.NewReader("{\n \"amount\": 123,\n \"reference_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/pg/subscriptions/{subscription_id}/recurring_payment/")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"reference_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/pg/subscriptions/{subscription_id}/recurring_payment/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"reference_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Recurring payment triggered successfully",
"data": {
"subscription_id": "SUB7989707770",
"payment_id": "REC-SUB7989707770-a1b2c3d4",
"payment_amount": 500.00,
"status": "success",
"message": "ADHOC recurring payment initiated successfully"
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"amount": "Recurring amount must be less than or equal to the subscription billing amount"
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"reference_id": "Reference ID already exists"
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"recurring": "A recurring charge is already in progress for this subscription; wait for it to complete before initiating another."
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_003",
"message": "API error",
"details": {
"message": "Failed to trigger recurring payment"
}
}
}
Trigger a charge on an active ADHOC subscription. The call initiates the payment — the outcome (success, failure, or cancellation) arrives asynchronously by webhook, and the order and payment records are created at that point.
This endpoint only supports ADHOC subscriptions. The subscription must have an active mandate before a recurring payment can be triggered — check it with Get Subscription Mandate Status.
A
409 means the subscription’s own state refused the charge — there is no active pre-debit notification for today, or a charge is already in progress. A 400 means the amount is above the billing amount or above the pre-debit notified amount, or the reference_id is invalid or already used. In both cases nothing reached the bank: fix the cause, then call again. A 502 means the payment network failed.For methods that use a pre-debit notification, the charge needs an active pre-debit notification for today.
Path Parameters
string
required
The unique identifier (uid) of the subscription.
Request Body
number
Amount to charge for this execution. Defaults to the subscription’s
billing_amount, and must not exceed it. With a pre-debit notification it must also not exceed the notified amount.string
Your reference for this charge: 1–50 letters, numbers and hyphens. It becomes this debit’s
payment_id, so the outcome comes back under your own reference. Must be unique across your orders, including failed ones. If omitted, a payment_id is generated with a REC- prefix.Response Fields
string
The subscription identifier.
string
Identifier of this debit: the
reference_id you sent, or one generated with a REC- prefix. Store it against your order: when the debit’s outcome arrives, its payment carries this value as merchant_reference_id in the Payment Successful and Payment Failed webhooks, and as reference_id in Get Subscription Payments. A retried debit has -attempt-1, -attempt-2, and so on appended. It is not the ID of a payment record, so Get Payment does not accept it.number
The amount charged for this recurring payment.
string
Status of the API call.
success means the payment was initiated — not that it has been captured.{
"success": true,
"message": "Recurring payment triggered successfully",
"data": {
"subscription_id": "SUB7989707770",
"payment_id": "REC-SUB7989707770-a1b2c3d4",
"payment_amount": 500.00,
"status": "success",
"message": "ADHOC recurring payment initiated successfully"
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"amount": "Recurring amount must be less than or equal to the subscription billing amount"
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"reference_id": "Reference ID already exists"
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_001",
"message": "Validation error",
"details": {
"recurring": "A recurring charge is already in progress for this subscription; wait for it to complete before initiating another."
}
}
}
{
"success": false,
"error": {
"code": "ERR_PAYMENT_003",
"message": "API error",
"details": {
"message": "Failed to trigger recurring payment"
}
}
}