Create a Direct API payment
Creates a new payment by charging a card directly. The full card details are submitted in the request body.
The response is returned immediately with status: pending (or
status: requires_action if 3D Secure authentication is required).
The payment is then processed asynchronously. Poll
GET /v1/payments/{id} until the status becomes succeeded or
failed.
For 3D Secure flows, supply return_url. When status is
requires_action, redirect the customer to next_action.redirect_url.
Use the Idempotency-Key header to safely retry requests without
creating duplicate charges.
Authorizations
Use your secret API key as the Bearer token. Test (sandbox) mode keys
start with fl_test_sk_ and live mode keys start with fl_live_sk_.
Both modes use the same API host; the mode is determined by the key.
Authorization: Bearer fl_test_sk_abc123def456Headers
A unique key to ensure the request is processed only once. If a request with the same idempotency key and the same body has already been processed successfully (HTTP 2xx), the cached response is returned. Non-2xx responses are not cached, so you may freely retry on errors. Keys expire after 24 hours.
For one-shot requests (e.g. creating a payment from a checkout
button) a random UUIDv4 is fine. For requests tied to a specific
business operation (e.g. refunding order #1234) a deterministic key
like refund-order-1234 is preferred so retries collapse correctly
across processes.
255Body
The payment amount in minor units (smallest currency unit).
For EUR, 4999 means EUR 49.99. Must be a positive integer.
x >= 14999
An arbitrary string to attach to the payment for your records.
500"Order #1234"
A set of key-value pairs for storing additional information about the payment. Maximum 50 keys; each value up to 500 characters. Key length is recommended to stay within 40 characters.
{
"order_id": "ord_1234",
"sku": "WIDGET-XL"
}URL the customer is redirected to after completing or abandoning
3D Secure authentication. Must use https (or http://localhost
for local development). Required when 3DS is triggered for the
payment.
Response
Payment created successfully.
A Payment object represents a single attempt to move money. It is created when you submit a payment request and is updated as the payment progresses through its lifecycle.
Unique identifier for the payment (pay_ prefix + UUID).
^pay_[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"pay_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Object type; always payment.
payment "payment"
The payment amount in minor units.
4999
Three-letter ISO 4217 currency code.
"eur"
The current status of the payment.
pending-- The payment has been created and is being processed asynchronously.succeeded-- The payment was successful. A succeeded payment may have refunds; checkrefundsarray andrefunded_amount.failed-- The payment was declined or failed.requires_action-- The payment requires customer action (e.g. 3D Secure authentication). Redirect the customer tonext_action.redirect_url.expired-- The required customer action (e.g. 3D Secure challenge) was not completed in time.canceled-- The payment was canceled before completion.
pending, succeeded, failed, requires_action, expired, canceled "succeeded"
Unix timestamp when the payment was created.
1719792000
Whether this payment was created using a live API key (true) or
a test API key (false).
false
The description attached to the payment.
"Order #1234"
The masked card details. null for HPP payments that have not
yet been completed.
The customer associated with the payment.
Arbitrary key-value metadata attached to the payment.
{ "order_id": "ord_1234" }If the payment was declined, the decline code indicating the reason.
Common codes include insufficient_funds, expired_card, lost_card,
stolen_card, and do_not_honor. For 3D Secure failures the code is
one of three_d_secure_failed, three_d_secure_timeout,
three_d_secure_not_supported, or three_d_secure_error.
See the decline codes reference for the
full list, and 3D Secure Declines for
3DS-specific codes.
null
If the payment was declined, a human-readable message explaining why.
null
For HPP payments, the URL of the hosted payment page to redirect the
customer to. null for direct API payments.
null
Unix timestamp when the payment was fully refunded (refunded_amount equals
the original amount), or null if not fully refunded.
null
Unix timestamp when the payment succeeded, or null if not yet succeeded.
1719792000
Unix timestamp when the payment failed, or null if not failed.
null
Present (non-null) when status is requires_action. Contains
information needed to complete the payment. Otherwise null.
Total amount refunded so far, in minor units. This accumulates across
partial refunds (only succeeded refunds contribute to the total).
0
The payment service provider's reference for this transaction.
Useful for dispute resolution and reconciliation with your PSP.
null while the payment is still being submitted to the provider.
"1402758057"
All refunds on this payment, oldest first. Each entry is created by
a call to POST /v1/payments/{id}/refund. A refund starts as
pending and transitions to succeeded or failed.
