curl --request POST \
--url https://api-dashboard.payra.com/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_method": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"amount": 12550,
"currency": "USD",
"description": "Invoice INV-1042",
"reference": "INV-1042",
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api-dashboard.payra.com/v1/payments"
payload = {
"payment_method": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"amount": 12550,
"currency": "USD",
"description": "Invoice INV-1042",
"reference": "INV-1042",
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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({
payment_method: 'pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf',
amount: 12550,
currency: 'USD',
description: 'Invoice INV-1042',
reference: 'INV-1042',
customer: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api-dashboard.payra.com/v1/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-dashboard.payra.com/v1/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([
'payment_method' => 'pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf',
'amount' => 12550,
'currency' => 'USD',
'description' => 'Invoice INV-1042',
'reference' => 'INV-1042',
'customer' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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-dashboard.payra.com/v1/payments"
payload := strings.NewReader("{\n \"payment_method\": \"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf\",\n \"amount\": 12550,\n \"currency\": \"USD\",\n \"description\": \"Invoice INV-1042\",\n \"reference\": \"INV-1042\",\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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-dashboard.payra.com/v1/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_method\": \"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf\",\n \"amount\": 12550,\n \"currency\": \"USD\",\n \"description\": \"Invoice INV-1042\",\n \"reference\": \"INV-1042\",\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.com/v1/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 \"payment_method\": \"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf\",\n \"amount\": 12550,\n \"currency\": \"USD\",\n \"description\": \"Invoice INV-1042\",\n \"reference\": \"INV-1042\",\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"object": "payment",
"id": "pay_test_7Hs2kQ9mL1pXv4cR8tWzAbCdEf",
"status": "succeeded",
"amount": 12550,
"currency": "USD",
"payment_method": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"customer": null,
"description": "Invoice INV-1042",
"reference": "INV-1042",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2030
},
"failure": {
"code": "card_declined",
"message": "The card was declined."
},
"next_action": null,
"livemode": false,
"created_at": "2026-09-18T20:00:00.000Z",
"succeeded_at": "2026-09-18T20:00:01.312Z",
"amount_refunded": 0,
"payment_method_type": "card",
"us_bank_account": null
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Create a payment
Charges one of your payment methods through the same path the dashboard uses, so the payment shows in RevOS like any other. Requires an Idempotency-Key: the same key with the same body returns the same payment; a processor refusal answers 402 with the payment it left behind.
curl --request POST \
--url https://api-dashboard.payra.com/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_method": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"amount": 12550,
"currency": "USD",
"description": "Invoice INV-1042",
"reference": "INV-1042",
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api-dashboard.payra.com/v1/payments"
payload = {
"payment_method": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"amount": 12550,
"currency": "USD",
"description": "Invoice INV-1042",
"reference": "INV-1042",
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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({
payment_method: 'pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf',
amount: 12550,
currency: 'USD',
description: 'Invoice INV-1042',
reference: 'INV-1042',
customer: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api-dashboard.payra.com/v1/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-dashboard.payra.com/v1/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([
'payment_method' => 'pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf',
'amount' => 12550,
'currency' => 'USD',
'description' => 'Invoice INV-1042',
'reference' => 'INV-1042',
'customer' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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-dashboard.payra.com/v1/payments"
payload := strings.NewReader("{\n \"payment_method\": \"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf\",\n \"amount\": 12550,\n \"currency\": \"USD\",\n \"description\": \"Invoice INV-1042\",\n \"reference\": \"INV-1042\",\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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-dashboard.payra.com/v1/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_method\": \"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf\",\n \"amount\": 12550,\n \"currency\": \"USD\",\n \"description\": \"Invoice INV-1042\",\n \"reference\": \"INV-1042\",\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.com/v1/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 \"payment_method\": \"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf\",\n \"amount\": 12550,\n \"currency\": \"USD\",\n \"description\": \"Invoice INV-1042\",\n \"reference\": \"INV-1042\",\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"object": "payment",
"id": "pay_test_7Hs2kQ9mL1pXv4cR8tWzAbCdEf",
"status": "succeeded",
"amount": 12550,
"currency": "USD",
"payment_method": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"customer": null,
"description": "Invoice INV-1042",
"reference": "INV-1042",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2030
},
"failure": {
"code": "card_declined",
"message": "The card was declined."
},
"next_action": null,
"livemode": false,
"created_at": "2026-09-18T20:00:00.000Z",
"succeeded_at": "2026-09-18T20:00:01.312Z",
"amount_refunded": 0,
"payment_method_type": "card",
"us_bank_account": null
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Authorizations
A secret key, sk_test_... or sk_live_...; a publishable key (pk_...) on the browser routes only
Body
A payment method of yours that is active. A one-time method is spent by this charge.
1 - 64"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf"
In the smallest unit of the currency.
12550
USD, CAD "USD"
1 - 500"Invoice INV-1042"
Your own reference for this charge, such as an order or invoice number; shown on the payment.
1 - 100"INV-1042"
Optional. When given, must be the customer the payment method is saved on.
Response
The payment
payment "pay_test_7Hs2kQ9mL1pXv4cR8tWzAbCdEf"
processing until the processor answers, and, on a bank debit, until it settles, that is until the processor sends it to the bank in its next batch; authorized when it approved but has not captured; succeeded once a card is captured or a bank debit has settled, which does not make a bank debit final (see returned); failed when it refused (the create then answers 402 and this object stays readable); canceled after a void; returned when the money came back after success (a bank return or a chargeback, see failure); requires_action if the processor asked for a step this server-side charge cannot take.
processing, requires_action, authorized, succeeded, failed, canceled, returned "succeeded"
In the smallest unit of the currency (cents).
12550
USD, CAD "USD"
"pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf"
null
"Invoice INV-1042"
Your reference, as you sent it.
"INV-1042"
Set when payment_method_type is card.
Show child attributes
Show child attributes
Set when status is failed or returned: why, in a fixed vocabulary. card_declined, insufficient_funds, authentication_failed, invalid_payment_method and duplicate_transaction are the processor refusing the card; ach_returned and chargeback are money coming back after success; processing_error is a fault on the way to the processor or in the request, safe to retry later; a refusal in words Payra cannot classify reads card_declined. The processor's own text is never relayed.
Show child attributes
Show child attributes
A server-side charge sends no 3-D Secure return address, so this is normally null; if a processor asks for a redirect anyway, it is here.
Show child attributes
Show child attributes
null
false
"2026-09-18T20:00:00.000Z"
When the card was captured, or the bank debit settled.
"2026-09-18T20:00:01.312Z"
How much of amount has been refunded so far, counting refunds that succeeded, wherever they were made. status stays succeeded; GET /v1/refunds?payment= lists them.
0
card, us_bank_account "card"
Set when payment_method_type is us_bank_account.
Show child attributes
Show child attributes
null