Skip to main content
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>",
  "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>",
"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

Authorization
string
header
required

API key authentication

Body

application/json
amount
string
required

Payment amount in decimal format (e.g. '10.50'). Minimum 1.00, maximum 5,000.00. Contact support for higher limits.

Pattern: ^\d+(\.\d{1,2})?$
currency
enum<string>
required

ISO 4217 currency code.

Available options:
USD,
EUR,
GBP,
AUD
merchantId
string

Merchant organization ID. Required when using an API key that is not scoped to a single merchant.

customerId
string

Optional customer ID. Must belong to this merchant.

idempotencyKey
string

Client-provided key for safe retries. If a payment with the same key already exists, the existing payment is returned.

Maximum string length: 255
reference
string

Merchant-defined reference for this payment (e.g. order ID, invoice number).

Maximum string length: 255
metadata
object

Arbitrary key-value string pairs to attach to the payment.

lineItems
object[]

Optional breakdown of what the customer is being charged for.

Maximum array length: 100
successRedirectUrl
string<uri>

URL to redirect the customer to after a successful payment.

failureRedirectUrl
string<uri>

URL to redirect the customer to after a failed payment.

savePaymentMethod
boolean
default:false

Whether to save the customer's payment method for future use. Defaults to false.

expiresIn
string<duration>

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)

id
string
required

Unique payment identifier (pay_* prefixed).

object
enum<string>
default:payment
required
Available options:
payment
amount
string
required

Payment amount in decimal format (e.g. '10.50').

currency
string
required

ISO 4217 currency code (e.g. 'USD').

status
enum<string>
required

Current status of the payment.

Available options:
pending,
processing,
completed,
expired,
cancelled
createdAt
string<date-time>
required

When the payment was created.

paymentUrl
string

URL for the customer to complete the payment.

customerId
string

Customer ID if provided.

idempotencyKey
string

Client-provided idempotency key.

reference
string

Merchant-defined reference for this payment.

metadata
object

Merchant-provided key-value metadata.

lineItems
object[]

Breakdown of what the customer is being charged for.

expiresAt
string<date-time>

When the payment expires.