Zum Hauptinhalt springen
POST
/
payments
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

const payment = await client.payments.create({
  billing: { country: 'AF' },
  customer: { customer_id: 'customer_id' },
  product_cart: [{ product_id: 'product_id', quantity: 0 }],
});

console.log(payment.payment_id);
{
  "client_secret": "<string>",
  "customer": {
    "customer_id": "<string>",
    "email": "<string>",
    "name": "<string>",
    "metadata": {},
    "phone_number": "<string>"
  },
  "metadata": {},
  "payment_id": "<string>",
  "total_amount": 1,
  "discount_id": "<string>",
  "discount_ids": [
    "<string>"
  ],
  "expires_on": "2023-11-07T05:31:56Z",
  "payment_link": "<string>",
  "product_cart": [
    {
      "product_id": "<string>",
      "quantity": 1,
      "amount": 123
    }
  ]
}

Documentation Index

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

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

Veraltete API: Diese API wird bald veraltet sein. Wir empfehlen stattdessen die Verwendung von Checkout Sessions, die eine leistungsfähigere und anpassbare API bieten, um Zahlungslinks für einmalige Zahlungen und Abonnements zu erstellen.

Autorisierungen

Authorization
string
header
erforderlich

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
billing
object
erforderlich

Billing address details for the payment

customer
Attach Existing Customer · object
erforderlich

Customer information for the payment

product_cart
One-Time Product Cart Item · object[]
erforderlich

List of products in the cart. Must contain at least 1 and at most 100 items.

adaptive_currency_fees_inclusive
boolean | null

Whether adaptive currency fees should be included in the price (true) or added on top (false). If not specified, defaults to the business-level setting.

allowed_payment_method_types
enum<string>[] | null

List of payment methods allowed during checkout.

Customers will never see payment methods that are not in this list. However, adding a method here does not guarantee customers will see it. Availability still depends on other factors (e.g., customer location, merchant settings).

All supported payment method types (from Hyperswitch).

Used for disabled-payment-methods filtering and validation.

Verfügbare Optionen:
ach,
affirm,
afterpay_clearpay,
alfamart,
ali_pay,
ali_pay_hk,
alma,
amazon_pay,
apple_pay,
atome,
bacs,
bancontact_card,
becs,
benefit,
bizum,
blik,
boleto,
bca_bank_transfer,
bni_va,
bri_va,
card_redirect,
cimb_va,
classic,
credit,
crypto_currency,
cashapp,
dana,
danamon_va,
debit,
duit_now,
efecty,
eft,
eps,
fps,
evoucher,
giropay,
givex,
google_pay,
go_pay,
gcash,
ideal,
interac,
indomaret,
klarna,
kakao_pay,
local_bank_redirect,
mandiri_va,
knet,
mb_way,
mobile_pay,
momo,
momo_atm,
multibanco,
online_banking_thailand,
online_banking_czech_republic,
online_banking_finland,
online_banking_fpx,
online_banking_poland,
online_banking_slovakia,
oxxo,
pago_efectivo,
permata_bank_transfer,
open_banking_uk,
pay_bright,
paypal,
paze,
pix,
pay_safe_card,
przelewy24,
prompt_pay,
pse,
red_compra,
red_pagos,
samsung_pay,
sepa,
sepa_bank_transfer,
sofort,
swish,
touch_n_go,
trustly,
twint,
upi_collect,
upi_intent,
vipps,
viet_qr,
venmo,
walley,
we_chat_pay,
seven_eleven,
lawson,
mini_stop,
family_mart,
seicomart,
pay_easy,
local_bank_transfer,
mifinity,
open_banking_pis,
direct_carrier_billing,
instant_bank_transfer,
billie,
zip,
revolut_pay,
naver_pay,
payco
billing_currency
null | enum<string>

Fix the currency in which the end customer is billed. If Dodo Payments cannot support that currency for this transaction, it will not proceed

Verfügbare Optionen:
AED,
ALL,
AMD,
ANG,
AOA,
ARS,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
BMD,
BND,
BOB,
BRL,
BSD,
BWP,
BYN,
BZD,
CAD,
CHF,
CLP,
CNY,
COP,
CRC,
CUP,
CVE,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
ETB,
EUR,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MAD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRU,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
NGN,
NIO,
NOK,
NPR,
NZD,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SEK,
SGD,
SHP,
SLE,
SLL,
SOS,
SRD,
SSP,
STN,
SVC,
SZL,
THB,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
USD,
UYU,
UZS,
VES,
VND,
VUV,
WST,
XAF,
XCD,
XOF,
XPF,
YER,
ZAR,
ZMW
discount_code
string | null
veraltet

DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.

discount_codes
string[] | null

Stacked discount codes to apply, in order of application. Max 20. Cannot be used together with discount_code.

force_3ds
boolean | null

Override merchant default 3DS behaviour for this payment

metadata
object

Additional metadata associated with the payment. Defaults to empty if not provided.

Whether to generate a payment link. Defaults to false if not specified.

payment_method_id
string | null

Optional payment method ID to use for this payment. If provided, customer_id must also be provided. The payment method will be validated for eligibility with the payment's currency.

redirect_immediately
boolean

If true, redirects the customer immediately after payment completion False by default

require_phone_number
boolean

If true, the customer's phone number is required to create this payment. Typically set alongside payment_link=true so merchants can enforce phone collection on the hosted payment page. Defaults to false.

return_url
string | null

Optional URL to redirect the customer after payment. Must be a valid URL if provided.

If true, returns a shortened payment link. Defaults to false if not specified.

show_saved_payment_methods
boolean

Display saved payment methods of a returning customer False by default

tax_id
string | null

Tax ID in case the payment is B2B. If tax id validation fails the payment creation will fail

Antwort

One Time payment successfully initiated

client_secret
string
erforderlich

Client secret used to load Dodo checkout SDK NOTE : Dodo checkout SDK will be coming soon

customer
object
erforderlich

Limited details about the customer making the payment

metadata
object
erforderlich

Additional metadata associated with the payment

payment_id
string
erforderlich

Unique identifier for the payment

total_amount
integer<int32>
erforderlich

Total amount of the payment in smallest currency unit (e.g. cents)

Erforderlicher Bereich: x >= 0
discount_id
string | null
veraltet

DEPRECATED: Use discount_ids instead. Returns the first discount's ID if present.

discount_ids
string[] | null

All stacked discount IDs applied, in order of application

expires_on
string<date-time> | null

Expiry timestamp of the payment link

Optional URL to a hosted payment page

product_cart
One-Time Product Cart Item · object[] | null

Optional list of products included in the payment

Last modified on April 1, 2026