curl --request POST \
--url https://api.paygentic.io/v0/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "10.50",
"currency": "USD",
"idempotencyKey": "order_12345",
"reference": "Order #12345",
"successRedirectUrl": "https://example.com/success",
"savePaymentMethod": false,
"expiresIn": "P7D",
"metadata": {
"orderId": "order_12345"
}
}
'import requests
url = "https://api.paygentic.io/v0/payments"
payload = {
"amount": "10.50",
"currency": "USD",
"idempotencyKey": "order_12345",
"reference": "Order #12345",
"successRedirectUrl": "https://example.com/success",
"savePaymentMethod": False,
"expiresIn": "P7D",
"metadata": { "orderId": "order_12345" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '10.50',
currency: 'USD',
idempotencyKey: 'order_12345',
reference: 'Order #12345',
successRedirectUrl: 'https://example.com/success',
savePaymentMethod: false,
expiresIn: 'P7D',
metadata: {orderId: 'order_12345'}
})
};
fetch('https://api.paygentic.io/v0/payments', 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.paygentic.io/v0/payments",
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' => '10.50',
'currency' => 'USD',
'idempotencyKey' => 'order_12345',
'reference' => 'Order #12345',
'successRedirectUrl' => 'https://example.com/success',
'savePaymentMethod' => false,
'expiresIn' => 'P7D',
'metadata' => [
'orderId' => 'order_12345'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.paygentic.io/v0/payments"
payload := strings.NewReader("{\n \"amount\": \"10.50\",\n \"currency\": \"USD\",\n \"idempotencyKey\": \"order_12345\",\n \"reference\": \"Order #12345\",\n \"successRedirectUrl\": \"https://example.com/success\",\n \"savePaymentMethod\": false,\n \"expiresIn\": \"P7D\",\n \"metadata\": {\n \"orderId\": \"order_12345\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.paygentic.io/v0/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"10.50\",\n \"currency\": \"USD\",\n \"idempotencyKey\": \"order_12345\",\n \"reference\": \"Order #12345\",\n \"successRedirectUrl\": \"https://example.com/success\",\n \"savePaymentMethod\": false,\n \"expiresIn\": \"P7D\",\n \"metadata\": {\n \"orderId\": \"order_12345\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"10.50\",\n \"currency\": \"USD\",\n \"idempotencyKey\": \"order_12345\",\n \"reference\": \"Order #12345\",\n \"successRedirectUrl\": \"https://example.com/success\",\n \"savePaymentMethod\": false,\n \"expiresIn\": \"P7D\",\n \"metadata\": {\n \"orderId\": \"order_12345\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "payment",
"amount": "<string>",
"currency": "<string>",
"status": "pending",
"createdAt": "2023-11-07T05:31:56Z",
"paymentUrl": "<string>",
"customerId": "<string>",
"idempotencyKey": "<string>",
"reference": "<string>",
"metadata": {},
"lineItems": [
{
"description": "<string>",
"amount": "<string>",
"quantity": 123
}
],
"expiresAt": "2023-11-07T05:31:56Z"
}{
"id": "<string>",
"object": "payment",
"amount": "<string>",
"currency": "<string>",
"status": "pending",
"createdAt": "2023-11-07T05:31:56Z",
"paymentUrl": "<string>",
"customerId": "<string>",
"idempotencyKey": "<string>",
"reference": "<string>",
"metadata": {},
"lineItems": [
{
"description": "<string>",
"amount": "<string>",
"quantity": 123
}
],
"expiresAt": "2023-11-07T05:31:56Z"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Create Payment
Create a new payment for collecting a one-off charge. Returns a payment URL that can be shared with the customer.
curl --request POST \
--url https://api.paygentic.io/v0/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "10.50",
"currency": "USD",
"idempotencyKey": "order_12345",
"reference": "Order #12345",
"successRedirectUrl": "https://example.com/success",
"savePaymentMethod": false,
"expiresIn": "P7D",
"metadata": {
"orderId": "order_12345"
}
}
'import requests
url = "https://api.paygentic.io/v0/payments"
payload = {
"amount": "10.50",
"currency": "USD",
"idempotencyKey": "order_12345",
"reference": "Order #12345",
"successRedirectUrl": "https://example.com/success",
"savePaymentMethod": False,
"expiresIn": "P7D",
"metadata": { "orderId": "order_12345" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '10.50',
currency: 'USD',
idempotencyKey: 'order_12345',
reference: 'Order #12345',
successRedirectUrl: 'https://example.com/success',
savePaymentMethod: false,
expiresIn: 'P7D',
metadata: {orderId: 'order_12345'}
})
};
fetch('https://api.paygentic.io/v0/payments', 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.paygentic.io/v0/payments",
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' => '10.50',
'currency' => 'USD',
'idempotencyKey' => 'order_12345',
'reference' => 'Order #12345',
'successRedirectUrl' => 'https://example.com/success',
'savePaymentMethod' => false,
'expiresIn' => 'P7D',
'metadata' => [
'orderId' => 'order_12345'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.paygentic.io/v0/payments"
payload := strings.NewReader("{\n \"amount\": \"10.50\",\n \"currency\": \"USD\",\n \"idempotencyKey\": \"order_12345\",\n \"reference\": \"Order #12345\",\n \"successRedirectUrl\": \"https://example.com/success\",\n \"savePaymentMethod\": false,\n \"expiresIn\": \"P7D\",\n \"metadata\": {\n \"orderId\": \"order_12345\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.paygentic.io/v0/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"10.50\",\n \"currency\": \"USD\",\n \"idempotencyKey\": \"order_12345\",\n \"reference\": \"Order #12345\",\n \"successRedirectUrl\": \"https://example.com/success\",\n \"savePaymentMethod\": false,\n \"expiresIn\": \"P7D\",\n \"metadata\": {\n \"orderId\": \"order_12345\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"10.50\",\n \"currency\": \"USD\",\n \"idempotencyKey\": \"order_12345\",\n \"reference\": \"Order #12345\",\n \"successRedirectUrl\": \"https://example.com/success\",\n \"savePaymentMethod\": false,\n \"expiresIn\": \"P7D\",\n \"metadata\": {\n \"orderId\": \"order_12345\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "payment",
"amount": "<string>",
"currency": "<string>",
"status": "pending",
"createdAt": "2023-11-07T05:31:56Z",
"paymentUrl": "<string>",
"customerId": "<string>",
"idempotencyKey": "<string>",
"reference": "<string>",
"metadata": {},
"lineItems": [
{
"description": "<string>",
"amount": "<string>",
"quantity": 123
}
],
"expiresAt": "2023-11-07T05:31:56Z"
}{
"id": "<string>",
"object": "payment",
"amount": "<string>",
"currency": "<string>",
"status": "pending",
"createdAt": "2023-11-07T05:31:56Z",
"paymentUrl": "<string>",
"customerId": "<string>",
"idempotencyKey": "<string>",
"reference": "<string>",
"metadata": {},
"lineItems": [
{
"description": "<string>",
"amount": "<string>",
"quantity": 123
}
],
"expiresAt": "2023-11-07T05:31:56Z"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Authorizations
API key authentication
Body
Payment amount in decimal format (e.g. '10.50'). Minimum 1.00, maximum 5,000.00. Contact support for higher limits.
^\d+(\.\d{1,2})?$ISO 4217 currency code.
USD, EUR, GBP, AUD Merchant organization ID. Required when using an API key that is not scoped to a single merchant.
Optional customer ID. Must belong to this merchant.
Client-provided key for safe retries. If a payment with the same key already exists, the existing payment is returned.
255Merchant-defined reference for this payment (e.g. order ID, invoice number).
255Arbitrary key-value string pairs to attach to the payment.
Show child attributes
Show child attributes
Optional breakdown of what the customer is being charged for.
100Show child attributes
Show child attributes
URL to redirect the customer to after a successful payment.
URL to redirect the customer to after a failed payment.
Whether to save the customer's payment method for future use. Defaults to false.
ISO 8601 duration for the payment lifetime. Defaults to P30D (30 days). Maximum is P31D (31 days). Examples: PT1H, P1D, P7D, P30D.
Response
Existing payment returned (idempotency match)
Unique payment identifier (pay_* prefixed).
payment Payment amount in decimal format (e.g. '10.50').
ISO 4217 currency code (e.g. 'USD').
Current status of the payment.
pending, processing, completed, expired, cancelled When the payment was created.
URL for the customer to complete the payment.
Customer ID if provided.
Client-provided idempotency key.
Merchant-defined reference for this payment.
Merchant-provided key-value metadata.
Show child attributes
Show child attributes
Breakdown of what the customer is being charged for.
Show child attributes
Show child attributes
When the payment expires.
Was this page helpful?