Charges
Create recurring charge
POST
/
api
/
v1
/
charges
/
recurring
Create recurring charge
curl --request POST \
--url https://pay-api.pagoramp.com/api/v1/charges/recurring \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"amount": 20,
"recurringToken": "RCT-390393-3903",
"description": "Payment for services rendered"
}
'import requests
url = "https://pay-api.pagoramp.com/api/v1/charges/recurring"
payload = {
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"amount": 20,
"recurringToken": "RCT-390393-3903",
"description": "Payment for services rendered"
}
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({
reference: 'tx-12345',
customer: {firstname: 'John', lastname: 'Doe', email: '[email protected]'},
metadata: {orderId: '12345', additionalInfo: 'Some additional metadata'},
currency: 'USD',
amount: 20,
recurringToken: 'RCT-390393-3903',
description: 'Payment for services rendered'
})
};
fetch('https://pay-api.pagoramp.com/api/v1/charges/recurring', 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://pay-api.pagoramp.com/api/v1/charges/recurring",
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([
'reference' => 'tx-12345',
'customer' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[email protected]'
],
'metadata' => [
'orderId' => '12345',
'additionalInfo' => 'Some additional metadata'
],
'currency' => 'USD',
'amount' => 20,
'recurringToken' => 'RCT-390393-3903',
'description' => 'Payment for services rendered'
]),
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://pay-api.pagoramp.com/api/v1/charges/recurring"
payload := strings.NewReader("{\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"amount\": 20,\n \"recurringToken\": \"RCT-390393-3903\",\n \"description\": \"Payment for services rendered\"\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://pay-api.pagoramp.com/api/v1/charges/recurring")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"amount\": 20,\n \"recurringToken\": \"RCT-390393-3903\",\n \"description\": \"Payment for services rendered\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay-api.pagoramp.com/api/v1/charges/recurring")
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 \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"amount\": 20,\n \"recurringToken\": \"RCT-390393-3903\",\n \"description\": \"Payment for services rendered\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
application/json
Example:
"tx-12345"
Hide child attributes
Hide child attributes
Example:
Example:
"John"
Example:
"Doe"
ISO 3166-1 alpha-2 country code for where the customer is located. This is separate from the top-level country field on InitiatePaymentDto, which selects the currency's rails, not the customer's location.
Example:
"US"
Example:
{
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
}
Example:
{
"orderId": "12345",
"additionalInfo": "Some additional metadata"
}
Available options:
BDT, BIF, BWP, CAD, CDF, EGP, ETB, EUR, GBP, GHS, GMD, KES, LRD, LSL, MUR, MWK, MZN, NGN, RWF, SLE, SSP, TZS, UGX, USD, XAF, XOF, ZAR, ZMW Example:
"USD"
Example:
20
The provider-agnostic recurring token returned when the card was first saved
Example:
"RCT-390393-3903"
Example:
"Payment for services rendered"
Response
201 - application/json
Create recurring charge
curl --request POST \
--url https://pay-api.pagoramp.com/api/v1/charges/recurring \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"amount": 20,
"recurringToken": "RCT-390393-3903",
"description": "Payment for services rendered"
}
'import requests
url = "https://pay-api.pagoramp.com/api/v1/charges/recurring"
payload = {
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"amount": 20,
"recurringToken": "RCT-390393-3903",
"description": "Payment for services rendered"
}
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({
reference: 'tx-12345',
customer: {firstname: 'John', lastname: 'Doe', email: '[email protected]'},
metadata: {orderId: '12345', additionalInfo: 'Some additional metadata'},
currency: 'USD',
amount: 20,
recurringToken: 'RCT-390393-3903',
description: 'Payment for services rendered'
})
};
fetch('https://pay-api.pagoramp.com/api/v1/charges/recurring', 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://pay-api.pagoramp.com/api/v1/charges/recurring",
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([
'reference' => 'tx-12345',
'customer' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[email protected]'
],
'metadata' => [
'orderId' => '12345',
'additionalInfo' => 'Some additional metadata'
],
'currency' => 'USD',
'amount' => 20,
'recurringToken' => 'RCT-390393-3903',
'description' => 'Payment for services rendered'
]),
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://pay-api.pagoramp.com/api/v1/charges/recurring"
payload := strings.NewReader("{\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"amount\": 20,\n \"recurringToken\": \"RCT-390393-3903\",\n \"description\": \"Payment for services rendered\"\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://pay-api.pagoramp.com/api/v1/charges/recurring")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"amount\": 20,\n \"recurringToken\": \"RCT-390393-3903\",\n \"description\": \"Payment for services rendered\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay-api.pagoramp.com/api/v1/charges/recurring")
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 \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"amount\": 20,\n \"recurringToken\": \"RCT-390393-3903\",\n \"description\": \"Payment for services rendered\"\n}"
response = http.request(request)
puts response.read_body
