Intro
Khaime has a few read-only calls that answer “what will the customer pay?” at different points in checkout. Used together, they let your UI show the right price, fee and total at every step — and the charge always matches what the customer saw.The calls, in checkout order
For fees and totals, Preview Payment is the one call you need. It returns exactly what the intent will charge, so there is nothing to reconcile.
Hows
Keep four things the same
- One currency everywhere. Send the customer’s chosen code to Get Product, Preview Payment and the intent.
- Same body for preview and intent. Preview Payment takes exactly the body you’ll send to Create Product Payment Intent, so build it once and send it twice.
- Show the fee when the customer pays it. When
customer_pays_feesistrue, show the transaction fee as its own line. See Fees. - The intent is the charge. The breakdown and preview are for display. What the customer pays is the intent’s
amount.
Example: review step, then pay
Why nots
- Don’t compute fees or totals yourself. Fees depend on currency, gateway, country and the merchant’s settings, and they change. Read them from Khaime.
- Preview Payment needs the full cart. It validates everything the intent does, including required custom fields, so call it on your review step, once those are filled in. Before that, show the product price.
- Charging an amount, not catalog products? Use
preview: trueon Create Payment Intent instead. - A preview isn’t a reservation. Rates can move between preview and payment. If the customer waits a long time, preview again.
