Skip to main content
POST
/
v1
/
payment_intents
Create a PaymentIntent
curl --request POST \
  --url https://api.leanrails.com/v1/payment_intents \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --data '
{
  "amount": 2,
  "currency": "<string>",
  "capture_method": "automatic",
  "confirmation_method": "automatic",
  "customer": "<string>",
  "description": "<string>",
  "metadata": {}
}
'
{
  "id": "pi_xxx",
  "object": "payment_intent",
  "amount": 2000,
  "currency": "usd",
  "status": "requires_payment_method",
  "created": 1234567890,
  "livemode": false,
  "amount_received": 2000,
  "capture_method": "automatic",
  "confirmation_method": "automatic",
  "customer": "cus_xxx",
  "payment_method": "pm_xxx",
  "description": "<string>",
  "metadata": {},
  "merchant_id": "mer_xxx",
  "client_secret": "pi_xxx_secret_xxx",
  "last_payment_error": {
    "type": "payment_error",
    "code": "<string>",
    "message": "<string>"
  },
  "charges": {
    "object": "list",
    "data": [
      {
        "id": "ch_xxx",
        "object": "charge",
        "amount": 2000,
        "currency": "usd",
        "status": "succeeded",
        "created": 1234567890,
        "livemode": false,
        "amount_captured": 2000,
        "amount_refunded": 0,
        "payment_intent": "pi_xxx",
        "payment_method": "pm_xxx",
        "failure_code": "<string>",
        "failure_message": "<string>",
        "metadata": {}
      }
    ],
    "has_more": true,
    "next_cursor": "<string>",
    "url": "/v1/charges?payment_intent=pi_xxx"
  },
  "canceled_at": 1234567890,
  "cancellation_reason": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.fluveo.com/llms.txt

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

Authorizations

Authorization
string
header
required

Use your secret API key as the username with an empty password.

Headers

Idempotency-Key
string
required

Unique key to ensure idempotent requests.

Maximum string length: 255
X-API-Version
string

Override the API version for this request.

Body

application/json
amount
integer
required

Amount in smallest currency unit (e.g. cents).

Required range: x >= 1
currency
string
required

Three-letter ISO currency code.

Required string length: 3
capture_method
enum<string>
default:automatic
Available options:
automatic,
manual
confirmation_method
enum<string>
default:automatic
Available options:
automatic,
manual
customer
string

ID of the customer (cus_ prefix).

Pattern: ^cus_
description
string
metadata
object

Set of key-value pairs for storing additional information.

Response

The created PaymentIntent.

id
string
required
Example:

"pi_xxx"

object
enum<string>
required
Available options:
payment_intent
amount
integer
required
Example:

2000

currency
string
required
Example:

"usd"

status
enum<string>
required
Available options:
requires_payment_method,
requires_confirmation,
requires_action,
processing,
requires_capture,
canceled,
succeeded,
partially_refunded,
refunded
created
integer
required

Unix timestamp.

Example:

1234567890

livemode
boolean
required
Example:

false

amount_received
integer
Example:

2000

capture_method
enum<string>
Available options:
automatic,
manual
confirmation_method
enum<string>
Available options:
automatic,
manual
customer

The customer associated with this PaymentIntent. Returns a string ID by default, or a full Customer object when expanded via expand[]=customer.

Example:

"cus_xxx"

payment_method
string | null
Example:

"pm_xxx"

description
string | null
metadata
object

Set of key-value pairs for storing additional information.

merchant_id
string
Example:

"mer_xxx"

client_secret
string
Example:

"pi_xxx_secret_xxx"

last_payment_error
object
charges
object
canceled_at
integer | null

Unix timestamp of cancellation.

Example:

1234567890

cancellation_reason
string | null