curl --request POST \
--url https://api-dashboard.payra.com/v1/payment-method-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method_types": [
"card"
],
"amount": 21375,
"currency": "USD"
}
'import requests
url = "https://api-dashboard.payra.com/v1/payment-method-sessions"
payload = {
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method_types": ["card"],
"amount": 21375,
"currency": "USD"
}
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({
customer: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
payment_method_types: ['card'],
amount: 21375,
currency: 'USD'
})
};
fetch('https://api-dashboard.payra.com/v1/payment-method-sessions', 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-method-sessions",
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([
'customer' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'payment_method_types' => [
'card'
],
'amount' => 21375,
'currency' => 'USD'
]),
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-method-sessions"
payload := strings.NewReader("{\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"payment_method_types\": [\n \"card\"\n ],\n \"amount\": 21375,\n \"currency\": \"USD\"\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-method-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"payment_method_types\": [\n \"card\"\n ],\n \"amount\": 21375,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.com/v1/payment-method-sessions")
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 \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"payment_method_types\": [\n \"card\"\n ],\n \"amount\": 21375,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"object": "payment_method_session",
"id": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"status": "requires_payment_method",
"customer": null,
"payment_method_types": [
"card"
],
"amount": null,
"currency": null,
"livemode": false,
"expires_at": "2026-09-17T18:30:00.000Z",
"canceled_at": null,
"succeeded_at": null,
"card": null,
"us_bank_account": null,
"acss_debit": null,
"ach_authorization": null,
"pad_agreement": null,
"payment_method": null,
"created_at": "2026-09-17T18:00:00.000Z",
"client_secret": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd_secret_9qmY2w6f0Rj8XpLs3vTb1nHc7KdGaZe4"
}{
"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 session
Creates a short-lived context for collecting a card, a US or Canadian bank account, or a wallet payment in a browser. Your server calls this with a secret key and hands the client_secret to the page, which opens the session with your publishable key. A us_bank_account or acss_debit session without a customer names the amount the account holder will authorize, in USD or CAD respectively; an acss_debit session is refused where the workspace is not set up for Canadian pre-authorized debits. An apple_pay or google_pay session names the amount its sheet shows, and is refused where the workspace does not offer that wallet. The session expires 30 minutes after creation and can only collect: it cannot charge or refund.
curl --request POST \
--url https://api-dashboard.payra.com/v1/payment-method-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method_types": [
"card"
],
"amount": 21375,
"currency": "USD"
}
'import requests
url = "https://api-dashboard.payra.com/v1/payment-method-sessions"
payload = {
"customer": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method_types": ["card"],
"amount": 21375,
"currency": "USD"
}
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({
customer: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
payment_method_types: ['card'],
amount: 21375,
currency: 'USD'
})
};
fetch('https://api-dashboard.payra.com/v1/payment-method-sessions', 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-method-sessions",
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([
'customer' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'payment_method_types' => [
'card'
],
'amount' => 21375,
'currency' => 'USD'
]),
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-method-sessions"
payload := strings.NewReader("{\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"payment_method_types\": [\n \"card\"\n ],\n \"amount\": 21375,\n \"currency\": \"USD\"\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-method-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"payment_method_types\": [\n \"card\"\n ],\n \"amount\": 21375,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.com/v1/payment-method-sessions")
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 \"customer\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"payment_method_types\": [\n \"card\"\n ],\n \"amount\": 21375,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"object": "payment_method_session",
"id": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd",
"status": "requires_payment_method",
"customer": null,
"payment_method_types": [
"card"
],
"amount": null,
"currency": null,
"livemode": false,
"expires_at": "2026-09-17T18:30:00.000Z",
"canceled_at": null,
"succeeded_at": null,
"card": null,
"us_bank_account": null,
"acss_debit": null,
"ach_authorization": null,
"pad_agreement": null,
"payment_method": null,
"created_at": "2026-09-17T18:00:00.000Z",
"client_secret": "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd_secret_9qmY2w6f0Rj8XpLs3vTb1nHc7KdGaZe4"
}{
"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 customer of your workspace the collected method will belong to.
One type. card when omitted; us_bank_account collects a US account for ACH, acss_debit a Canadian one for a pre-authorized debit (EFT), which the workspace must be set up for; apple_pay or google_pay opens a wallet session, which needs amount.
1card, us_bank_account, acss_debit, apple_pay, google_pay ["card"]
Required for a us_bank_account or acss_debit session without a customer (the amount the account holder authorizes) and for a wallet session (the amount the sheet shows), in the smallest unit of currency. The charge must match it.
21375
With amount. USD for a US bank account, CAD for a Canadian one; USD or CAD for a wallet.
USD, usd, CAD, cad "USD"
Response
The session, with its client secret
payment_method_session "pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd"
requires_payment_method, succeeded, canceled, expired "requires_payment_method"
null
card, us_bank_account, acss_debit, apple_pay, google_pay ["card"]
What a one-time bank debit will authorize, or what a wallet sheet shows, in the smallest unit of currency. Null on a card session and when a bank account is being saved.
null
USD on a us_bank_account session, CAD on an acss_debit one, either on a wallet session.
USD, CAD null
false
"2026-09-17T18:30:00.000Z"
null
null
Set once the browser confirmed a card, or a wallet confirmed with its card.
Show child attributes
Show child attributes
null
Set once the browser confirmed a US bank account.
Show child attributes
Show child attributes
null
Set once the browser confirmed a Canadian bank account.
Show child attributes
Show child attributes
null
On a us_bank_account session: the authorization shown to the account holder, and when they accepted it.
Show child attributes
Show child attributes
null
On an acss_debit session: the pre-authorized debit agreement shown to the account holder, and when they accepted it.
Show child attributes
Show child attributes
null
The payment method your server created from this session, once it did.
null
"2026-09-17T18:00:00.000Z"
Returned only here. Hand it to the browser; never store it server-side.
"pms_test_7Hs2kQ9mL1pXv4cR8tWzAbCd_secret_9qmY2w6f0Rj8XpLs3vTb1nHc7KdGaZe4"