Getting started
Authentication
Resources
- Access Passes
- Attachments
- Authentication
- Chats
- Direct Messages
- Experiences
- Forums
- Notifications
- Payments
- Users
Payments
Charge User
import { whopApi } from "@/lib/whop-api";
const result = await whopApi.chargeUser({
input: {
// The affiliate code to use for the checkout session
affiliateCode: "some string",
// The amount to charge the user
amount: 10 /* Required! */,
// The currency to charge in
currency:
"aed" /* Valid values: aed | all | amd | ape | ars | aud | bam | bgn | bhd | bob | brl | bsd | cad | chf | clp | cop | crc | czk | dkk | dop | dzd | egp | etb | eth | eur | gbp | ghs | gmd | gtq | gyd | hkd | huf | idr | ils | inr | jmd | jod | jpy | kes | khr | krw | kwd | lkr | mad | mdl | mga | mkd | mnt | mop | mur | mxn | myr | nad | ngn | nok | nzd | omr | pen | php | pkr | pln | pyg | qar | ron | rsd | rub | rwf | sar | sek | sgd | thb | tnd | try | ttd | twd | tzs | usd | uyu | uzs | vnd | xcd | xof | zar */ /* Required! */,
// The description of the charge. Maximum 200 characters.
description: "some string",
// Additional metadata for the charge
metadata: "Error(Unknown scalar type: JSON)",
// The URL to redirect the user to after the checkout session is created
redirectUrl: "some string",
// The ID of the user to charge
userId: "user_XXXXXXXX" /* Required! */,
},
});
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.