Skip to main content
POST
/
checkouts
/
preview
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 response = await client.checkoutSessions.preview({
  product_cart: [{ product_id: 'product_id', quantity: 0 }],
});

console.log(response.billing_country);
{
  "billing_country": "AF",
  "currency": "AED",
  "current_breakup": {
    "discount": 1,
    "subtotal": 1,
    "total_amount": 1,
    "tax": 1
  },
  "product_cart": [
    {
      "currency": "AED",
      "discounted_price": 1,
      "is_subscription": true,
      "is_usage_based": true,
      "meters": [
        {
          "measurement_unit": "<string>",
          "name": "<string>",
          "price_per_unit": "10.50",
          "description": "<string>",
          "free_threshold": 123
        }
      ],
      "og_currency": "AED",
      "og_price": 1,
      "product_id": "<string>",
      "quantity": 1,
      "tax_category": "digital_products",
      "tax_inclusive": true,
      "tax_rate": 123,
      "addons": [
        {
          "addon_id": "<string>",
          "currency": "AED",
          "discounted_price": 1,
          "name": "<string>",
          "og_currency": "AED",
          "og_price": 1,
          "quantity": 1,
          "tax_category": "digital_products",
          "tax_inclusive": true,
          "tax_rate": 123,
          "description": "<string>",
          "discount_amount": 123,
          "tax": 123
        }
      ],
      "description": "<string>",
      "discount_amount": 123,
      "discount_cycle": 123,
      "name": "<string>",
      "tax": 123
    }
  ],
  "total_price": 1,
  "recurring_breakup": "<unknown>",
  "total_tax": 1
}

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.

Available options:
credit,
debit,
upi_collect,
upi_intent,
apple_pay,
cashapp,
google_pay,
multibanco,
bancontact_card,
eps,
ideal,
przelewy24,
paypal,
affirm,
klarna,
sepa,
ach,
amazon_pay,
afterpay_clearpay
billing_address
Checkout Session Billing Address · object

Billing address information for the session

billing_currency
null | enum<string>

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
Attach Existing Customer · object

Customer details for the session

customization
Checkout Session Customization · object

Customization for the checkout session page

discount_code
string | null
feature_flags
Checkout Session Flags · object
force_3ds
boolean | null

Override merchant default 3DS behaviour for this session

metadata
object

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

minimal_address
boolean

If true, only zipcode is required when confirm is true; other address fields remain optional

payment_method_id
string | null

Optional payment method ID to use for this checkout session. Only allowed when confirm is true. If provided, existing customer id must also be provided.

product_collection_id
string | null

Product collection ID for collection-based checkout flow

return_url
string | null

The url to redirect after payment failure or success.

If true, returns a shortened checkout URL. Defaults to false if not specified.

show_saved_payment_methods
boolean

Display saved payment methods of a returning customer False by default

subscription_data
Subscription Data · object

Response

Checkout session preview calculated successfully

Data returned by the calculate checkout session API

billing_country
enum<string>
required

Billing country

Available options:
AF,
AX,
AL,
DZ,
AS,
AD,
AO,
AI,
AQ,
AG,
AR,
AM,
AW,
AU,
AT,
AZ,
BS,
BH,
BD,
BB,
BY,
BE,
BZ,
BJ,
BM,
BT,
BO,
BQ,
BA,
BW,
BV,
BR,
IO,
BN,
BG,
BF,
BI,
KH,
CM,
CA,
CV,
KY,
CF,
TD,
CL,
CN,
CX,
CC,
CO,
KM,
CG,
CD,
CK,
CR,
CI,
HR,
CU,
CW,
CY,
CZ,
DK,
DJ,
DM,
DO,
EC,
EG,
SV,
GQ,
ER,
EE,
ET,
FK,
FO,
FJ,
FI,
FR,
GF,
PF,
TF,
GA,
GM,
GE,
DE,
GH,
GI,
GR,
GL,
GD,
GP,
GU,
GT,
GG,
GN,
GW,
GY,
HT,
HM,
VA,
HN,
HK,
HU,
IS,
IN,
ID,
IR,
IQ,
IE,
IM,
IL,
IT,
JM,
JP,
JE,
JO,
KZ,
KE,
KI,
KP,
KR,
KW,
KG,
LA,
LV,
LB,
LS,
LR,
LY,
LI,
LT,
LU,
MO,
MK,
MG,
MW,
MY,
MV,
ML,
MT,
MH,
MQ,
MR,
MU,
YT,
MX,
FM,
MD,
MC,
MN,
ME,
MS,
MA,
MZ,
MM,
NA,
NR,
NP,
NL,
NC,
NZ,
NI,
NE,
NG,
NU,
NF,
MP,
NO,
OM,
PK,
PW,
PS,
PA,
PG,
PY,
PE,
PH,
PN,
PL,
PT,
PR,
QA,
RE,
RO,
RU,
RW,
BL,
SH,
KN,
LC,
MF,
PM,
VC,
WS,
SM,
ST,
SA,
SN,
RS,
SC,
SL,
SG,
SX,
SK,
SI,
SB,
SO,
ZA,
GS,
SS,
ES,
LK,
SD,
SR,
SJ,
SZ,
SE,
CH,
SY,
TW,
TJ,
TZ,
TH,
TL,
TG,
TK,
TO,
TT,
TN,
TR,
TM,
TC,
TV,
UG,
UA,
AE,
GB,
UM,
US,
UY,
UZ,
VU,
VE,
VN,
VG,
VI,
WF,
EH,
YE,
ZM,
ZW
currency
enum<string>
required

Currency in which the calculations were made

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
current_breakup
object
required

Breakup of the current payment

product_cart
object[]
required

The total product cart

total_price
integer<int32>
required

Total calculate price of the product cart

Required range: x >= 0
recurring_breakup
object

Breakup of recurring payments (None for one-time only)

total_tax
integer<int32> | null

Total tax

Required range: x >= 0