Skip to main content
POST
/
v0
/
customers
/
{id}
/
paymentMethods
Set up a payment method
curl --request POST \
  --url https://api.paygentic.io/v0/customers/{id}/paymentMethods \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "successRedirectUrl": "<string>",
  "failureRedirectUrl": "<string>",
  "metadata": {}
}
'
{
  "object": "paymentSession",
  "id": "<string>",
  "mode": "payment",
  "status": "pending",
  "url": "<string>",
  "expiresAt": "2023-11-07T05:31:56Z",
  "createdAt": "2023-11-07T05:31:56Z",
  "successRedirectUrl": "<string>",
  "failureRedirectUrl": "<string>",
  "metadata": {},
  "completedAt": "2023-11-07T05:31:56Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.paygentic.io/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required

The unique identifier of the customer. Unique identifier for a customer

Pattern: ^cus_[a-zA-Z0-9]+$

Body

application/json
successRedirectUrl
string<uri>

URL the customer is redirected to on success. When the page is iframed, success is reported via postMessage instead.

failureRedirectUrl
string<uri>

URL the customer is redirected to on failure. When the page is iframed, failure is reported via postMessage instead.

metadata
object

Arbitrary key/value pairs to attach to the session.

Response

Payment session created successfully

object
enum<string>
required
Available options:
paymentSession
id
string
required

Payment session identifier (e.g. ps_...).

mode
enum<string>
required
Available options:
payment,
setup
status
enum<string>
required
Available options:
pending,
processing,
completed,
failed,
expired,
cancelled
url
string<uri>
required

Hosted page URL. Redirect the customer here, or load it inside an iframe — when iframed, the page reports outcomes via postMessage (payment_success / payment_error) to the parent window.

expiresAt
string<date-time>
required
createdAt
string<date-time>
required
successRedirectUrl
string<uri> | null
failureRedirectUrl
string<uri> | null
metadata
object
completedAt
string<date-time> | null