curl --request POST \
--url https://api-dashboard.payra.com/v1/payment-methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"session": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"account_holder_authorization": true
}
'import requests
url = "https://api-dashboard.payra.com/v1/payment-methods"
payload = {
"session": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"account_holder_authorization": True
}
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({
session: 'pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd',
account_holder_authorization: true
})
};
fetch('https://api-dashboard.payra.com/v1/payment-methods', 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/payment-methods",
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([
'session' => 'pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd',
'account_holder_authorization' => true
]),
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/payment-methods"
payload := strings.NewReader("{\n \"session\": \"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd\",\n \"account_holder_authorization\": true\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/payment-methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session\": \"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd\",\n \"account_holder_authorization\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.com/v1/payment-methods")
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 \"session\": \"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd\",\n \"account_holder_authorization\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "payment_method",
"id": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"type": "card",
"usage": "saved",
"status": "active",
"customer": null,
"session": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2030,
"funding": "credit"
},
"us_bank_account": null,
"billing_details": {
"name": "Ada Lovelace",
"postal_code": "94110"
},
"livemode": false,
"expires_at": null,
"created_at": "2026-09-18T14:00:00.000Z"
}{
"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 method
Turns a succeeded payment method session into a payment method your server can charge. When the session named a customer, the card or bank account is verified with the processor and saved on their file (usage: saved), a bank account together with the standing ACH authorization its holder accepted; otherwise it can be charged once, soon (usage: one_time). The tokenized details never appear in the response.
curl --request POST \
--url https://api-dashboard.payra.com/v1/payment-methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"session": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"account_holder_authorization": true
}
'import requests
url = "https://api-dashboard.payra.com/v1/payment-methods"
payload = {
"session": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"account_holder_authorization": True
}
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({
session: 'pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd',
account_holder_authorization: true
})
};
fetch('https://api-dashboard.payra.com/v1/payment-methods', 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/payment-methods",
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([
'session' => 'pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd',
'account_holder_authorization' => true
]),
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/payment-methods"
payload := strings.NewReader("{\n \"session\": \"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd\",\n \"account_holder_authorization\": true\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/payment-methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session\": \"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd\",\n \"account_holder_authorization\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.com/v1/payment-methods")
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 \"session\": \"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd\",\n \"account_holder_authorization\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "payment_method",
"id": "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf",
"type": "card",
"usage": "saved",
"status": "active",
"customer": null,
"session": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2030,
"funding": "credit"
},
"us_bank_account": null,
"billing_details": {
"name": "Ada Lovelace",
"postal_code": "94110"
},
"livemode": false,
"expires_at": null,
"created_at": "2026-09-18T14:00:00.000Z"
}{
"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 session of yours that has succeeded. Each session creates one payment method.
1 - 64"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd"
Required, and true, when a card session named a customer: your attestation that the cardholder agreed to keep the card on file. Not used for a bank account: the account holder accepted the ACH authorization in Payra Elements.
true
Response
The payment method
payment_method "pm_test_9kQ2mL7Hs1pXv4cR8tWzAbCdEf"
card, us_bank_account "card"
saved when the session named a customer: the instrument is vaulted and stays on their file. one_time otherwise: chargeable once, before expires_at.
one_time, saved "saved"
active, consumed, expired, detached "active"
null
The session the card was collected in.
"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd"
Set when type is card.
Show child attributes
Show child attributes
Set when type is us_bank_account.
Show child attributes
Show child attributes
null
Show child attributes
Show child attributes
false
Set on a one-time method.
null
"2026-09-18T14:00:00.000Z"