Initiate payment
This endpoint initiates a payment using the specified payment gateway.
curl --request POST \
--url https://pay-api.pagoramp.com/api/v1/checkout/initiate-payment \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": 20,
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"description": "Payment for services rendered",
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"country": "SN",
"redirectUrl": "https://your-app.example.com/checkout/callback",
"isRecurring": false
}
'import requests
url = "https://pay-api.pagoramp.com/api/v1/checkout/initiate-payment"
payload = {
"amount": 20,
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"description": "Payment for services rendered",
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"country": "SN",
"redirectUrl": "https://your-app.example.com/checkout/callback",
"isRecurring": False
}
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({
amount: 20,
reference: 'tx-12345',
customer: {firstname: 'John', lastname: 'Doe', email: '[email protected]'},
description: 'Payment for services rendered',
metadata: {orderId: '12345', additionalInfo: 'Some additional metadata'},
currency: 'USD',
country: 'SN',
redirectUrl: 'https://your-app.example.com/checkout/callback',
isRecurring: false
})
};
fetch('https://pay-api.pagoramp.com/api/v1/checkout/initiate-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://pay-api.pagoramp.com/api/v1/checkout/initiate-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' => 20,
'reference' => 'tx-12345',
'customer' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[email protected]'
],
'description' => 'Payment for services rendered',
'metadata' => [
'orderId' => '12345',
'additionalInfo' => 'Some additional metadata'
],
'currency' => 'USD',
'country' => 'SN',
'redirectUrl' => 'https://your-app.example.com/checkout/callback',
'isRecurring' => false
]),
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/checkout/initiate-payment"
payload := strings.NewReader("{\n \"amount\": 20,\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"description\": \"Payment for services rendered\",\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"country\": \"SN\",\n \"redirectUrl\": \"https://your-app.example.com/checkout/callback\",\n \"isRecurring\": false\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/checkout/initiate-payment")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 20,\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"description\": \"Payment for services rendered\",\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"country\": \"SN\",\n \"redirectUrl\": \"https://your-app.example.com/checkout/callback\",\n \"isRecurring\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay-api.pagoramp.com/api/v1/checkout/initiate-payment")
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 \"amount\": 20,\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"description\": \"Payment for services rendered\",\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"country\": \"SN\",\n \"redirectUrl\": \"https://your-app.example.com/checkout/callback\",\n \"isRecurring\": false\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
20
"tx-12345"
Hide child attributes
Hide child attributes
"John"
"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.
"US"
{
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
}
"Payment for services rendered"
{
"orderId": "12345",
"additionalInfo": "Some additional metadata"
}
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 "USD"
ISO 3166-1 alpha-2 country code. Required for currencies shared by multiple countries, such as XOF.
"SN"
Where the customer is sent back to after completing (or abandoning) checkout.
"https://your-app.example.com/checkout/callback"
Merchant-declared intent to charge this saved payment method again later. Purely a signal for reporting - tokenization happens whenever the provider supports it regardless of this flag.
false
Response
curl --request POST \
--url https://pay-api.pagoramp.com/api/v1/checkout/initiate-payment \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": 20,
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"description": "Payment for services rendered",
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"country": "SN",
"redirectUrl": "https://your-app.example.com/checkout/callback",
"isRecurring": false
}
'import requests
url = "https://pay-api.pagoramp.com/api/v1/checkout/initiate-payment"
payload = {
"amount": 20,
"reference": "tx-12345",
"customer": {
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
},
"description": "Payment for services rendered",
"metadata": {
"orderId": "12345",
"additionalInfo": "Some additional metadata"
},
"currency": "USD",
"country": "SN",
"redirectUrl": "https://your-app.example.com/checkout/callback",
"isRecurring": False
}
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({
amount: 20,
reference: 'tx-12345',
customer: {firstname: 'John', lastname: 'Doe', email: '[email protected]'},
description: 'Payment for services rendered',
metadata: {orderId: '12345', additionalInfo: 'Some additional metadata'},
currency: 'USD',
country: 'SN',
redirectUrl: 'https://your-app.example.com/checkout/callback',
isRecurring: false
})
};
fetch('https://pay-api.pagoramp.com/api/v1/checkout/initiate-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://pay-api.pagoramp.com/api/v1/checkout/initiate-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' => 20,
'reference' => 'tx-12345',
'customer' => [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => '[email protected]'
],
'description' => 'Payment for services rendered',
'metadata' => [
'orderId' => '12345',
'additionalInfo' => 'Some additional metadata'
],
'currency' => 'USD',
'country' => 'SN',
'redirectUrl' => 'https://your-app.example.com/checkout/callback',
'isRecurring' => false
]),
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/checkout/initiate-payment"
payload := strings.NewReader("{\n \"amount\": 20,\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"description\": \"Payment for services rendered\",\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"country\": \"SN\",\n \"redirectUrl\": \"https://your-app.example.com/checkout/callback\",\n \"isRecurring\": false\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/checkout/initiate-payment")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 20,\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"description\": \"Payment for services rendered\",\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"country\": \"SN\",\n \"redirectUrl\": \"https://your-app.example.com/checkout/callback\",\n \"isRecurring\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay-api.pagoramp.com/api/v1/checkout/initiate-payment")
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 \"amount\": 20,\n \"reference\": \"tx-12345\",\n \"customer\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"email\": \"[email protected]\"\n },\n \"description\": \"Payment for services rendered\",\n \"metadata\": {\n \"orderId\": \"12345\",\n \"additionalInfo\": \"Some additional metadata\"\n },\n \"currency\": \"USD\",\n \"country\": \"SN\",\n \"redirectUrl\": \"https://your-app.example.com/checkout/callback\",\n \"isRecurring\": false\n}"
response = http.request(request)
puts response.read_body
