Create Payment
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"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Payments
Create Payment
Create a new payment for collecting a one-off charge. Returns a payment URL that can be shared with the customer.
POST
/
v0
/
payments
Create Payment
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"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Body
application/json
Response
Existing payment returned (idempotency match)
Was this page helpful?