Skip to main content
POST
/
checkouts
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: 'My Bearer Token',
});

const checkoutSessionResponse = await client.checkoutSessions.create({
  product_cart: [{ product_id: 'product_id', quantity: 0 }],
});

console.log(checkoutSessionResponse.session_id);
{
  "checkout_url": "<string>",
  "session_id": "<string>"
}

Authorizations

Authorization
string
header
required

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

Body

application/json
product_cart
Product Item Request · object[]
required
allowed_payment_method_types
enum<string>[] | null

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).

Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment methods are unavailable, checkout session will fail.

billing_address
object | null

Billing address information for the session

billing_currency
enum<string> | null

This field is ingored if adaptive pricing is disabled

Available options:
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
confirm
boolean

If confirm is true, all the details will be finalized. If required data is missing, an API error is thrown.

customer
object | null

Customer details for the session

  • Attach Existing Customer
  • New Customer
customization
object

Customization for the checkout session page

discount_code
string | null
feature_flags
object
metadata
object | null

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

return_url
string | null

The url to redirect after payment failure or success.

show_saved_payment_methods
boolean

Display saved payment methods of a returning customer False by default

subscription_data
object | null

Response

Checkout session successfully created

checkout_url
string
required

Checkout url

session_id
string
required

The ID of the created checkout session