Skip to main content
POST
/
payments
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  apiKey: 'My API Key',
});

const payment = await client.payments.create({
  company_id: 'biz_xxxxxxxxxxxxxx',
  member_id: 'mber_xxxxxxxxxxxxx',
  payment_method_id: 'pmt_xxxxxxxxxxxxxx',
  plan: { currency: 'usd' },
});

console.log(payment.id);
{
  "id": "pay_xxxxxxxxxxxxxx",
  "status": "draft",
  "substatus": "auto_refunded",
  "refundable": true,
  "retryable": true,
  "voidable": true,
  "created_at": "2023-12-01T05:00:00.401Z",
  "paid_at": "2023-12-01T05:00:00.401Z",
  "last_payment_attempt": "2023-12-01T05:00:00.401Z",
  "dispute_alerted_at": "2023-12-01T05:00:00.401Z",
  "refunded_at": "2023-12-01T05:00:00.401Z",
  "plan": {
    "id": "plan_xxxxxxxxxxxxx"
  },
  "product": {
    "id": "prod_xxxxxxxxxxxxx",
    "title": "<string>",
    "route": "<string>"
  },
  "user": {
    "id": "user_xxxxxxxxxxxxx",
    "name": "John Doe",
    "username": "johndoe42",
    "email": "[email protected]"
  },
  "membership": {
    "id": "mem_xxxxxxxxxxxxxx",
    "status": "trialing"
  },
  "member": {
    "id": "<string>",
    "phone": "<string>"
  },
  "payment_method": {
    "id": "payt_xxxxxxxxxxxxx",
    "created_at": "2023-12-01T05:00:00.401Z",
    "payment_method_type": "acss_debit",
    "card": {
      "brand": "mastercard",
      "last4": "<string>",
      "exp_month": 42,
      "exp_year": 42
    }
  },
  "company": {
    "id": "biz_xxxxxxxxxxxxxx",
    "title": "<string>",
    "route": "<string>"
  },
  "promo_code": {
    "id": "promo_xxxxxxxxxxxx",
    "code": "<string>",
    "amount_off": 6.9,
    "base_currency": "usd",
    "promo_type": "percentage",
    "number_of_intervals": 42
  },
  "currency": "usd",
  "total": 6.9,
  "subtotal": 6.9,
  "usd_total": 6.9,
  "refunded_amount": 6.9,
  "auto_refunded": true,
  "amount_after_fees": 6.9,
  "card_brand": "mastercard",
  "card_last4": "<string>",
  "billing_address": {
    "name": "<string>",
    "line1": "<string>",
    "line2": "<string>",
    "city": "<string>",
    "state": "<string>",
    "postal_code": "<string>",
    "country": "<string>"
  },
  "payment_method_type": "acss_debit",
  "billing_reason": "subscription_create",
  "failure_message": "<string>",
  "metadata": {}
}

Authorizations

Authorization
string
header
required

The app API key from an app from the /dashboard/developer page

Body

application/json
  • CreatePaymentInputWithPlan
  • CreatePaymentInputWithPlanId

Parameters for CreatePayment Autogenerated input type of CreatePayment

company_id
string
required

The ID of the company to create the payment for.

Example:

"biz_xxxxxxxxxxxxxx"

member_id
string
required

The ID of the member to create the payment for.

Example:

"mber_xxxxxxxxxxxxx"

payment_method_id
string
required

The ID of the payment method to use for the payment. It must be connected to the Member being charged.

Example:

"pmt_xxxxxxxxxxxxxx"

plan
object
required

Pass this object to create a new plan for this payment

Response

A successful response

An object representing a receipt for a membership.

id
string
required

The payment ID

Example:

"pay_xxxxxxxxxxxxxx"

status
enum<string> | null
required

The current state of the payment.

Available options:
draft,
open,
paid,
pending,
uncollectible,
unresolved,
void
substatus
enum<string>
required

The friendly status of the payment.

Available options:
auto_refunded,
refunded,
partially_refunded,
dispute_warning,
open_resolution,
open_dispute,
failed,
price_too_low,
succeeded,
drafted,
uncollectible,
unresolved,
past_due,
pending,
incomplete,
canceled
refundable
boolean
required

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

retryable
boolean
required

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due); otherwise false. Used to decide if Whop can attempt the charge again.

voidable
boolean
required

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

created_at
string<date-time>
required

The datetime the payment was created

Example:

"2023-12-01T05:00:00.401Z"

paid_at
string<date-time> | null
required

The datetime the payment was paid

Example:

"2023-12-01T05:00:00.401Z"

last_payment_attempt
string<date-time> | null
required

The time of the last payment attempt.

Example:

"2023-12-01T05:00:00.401Z"

dispute_alerted_at
string<date-time> | null
required

When an alert came in that this transaction will be disputed

Example:

"2023-12-01T05:00:00.401Z"

refunded_at
string<date-time> | null
required

When the payment was refunded (if applicable).

Example:

"2023-12-01T05:00:00.401Z"

plan
object
required

The plan attached to this payment.

product
object
required

The product this payment was made for

user
object
required

The user that made this payment.

membership
object
required

The membership attached to this payment.

member
object
required

The member attached to this payment.

payment_method
object
required

The payment method used for the payment, if available.

company
object
required

The company for the payment.

promo_code
object
required

The promo code used for this payment.

currency
enum<string> | null
required

The currency of the payment.

Available options:
usd,
sgd,
inr,
aud,
brl,
cad,
dkk,
eur,
nok,
gbp,
sek,
chf,
hkd,
huf,
jpy,
mxn,
myr,
pln,
czk,
nzd,
aed,
eth,
ape,
cop,
ron,
thb,
bgn,
idr,
dop,
php,
try,
krw,
twd,
vnd,
pkr,
clp,
uyu,
ars,
zar,
dzd,
tnd,
mad,
kes,
kwd,
jod,
all,
xcd,
amd,
bsd,
bhd,
bob,
bam,
khr,
crc,
xof,
egp,
etb,
gmd,
ghs,
gtq,
gyd,
ils,
jmd,
mop,
mga,
mur,
mdl,
mnt,
nad,
ngn,
mkd,
omr,
pyg,
pen,
qar,
rwf,
sar,
rsd,
lkr,
tzs,
ttd,
uzs,
rub,
btc,
cny
total
number | null
required

The total to show to the creator (excluding buyer fees).

Example:

6.9

subtotal
number | null
required

The subtotal to show to the creator (excluding buyer fees).

Example:

6.9

usd_total
number | null
required

The total in USD to show to the creator (excluding buyer fees).

Example:

6.9

refunded_amount
number | null
required

The payment refund amount(if applicable).

Example:

6.9

auto_refunded
boolean
required

Whether this payment was auto refunded or not

amount_after_fees
number
required

How much the payment is for after fees

Example:

6.9

card_brand
enum<string> | null
required

Card network reported by the processor (for example visa, mastercard, amex). Present only when the underlying payment method type is card.

Available options:
mastercard,
visa,
amex,
discover,
unionpay,
jcb,
diners,
link,
troy,
visadankort,
visabancontact,
china_union_pay,
rupay,
jcbrupay,
elo,
maestro,
unknown
card_last4
string | null
required

The last 4 digits of the card used to make the payment.

billing_address
object
required

The address of the user who made the payment.

payment_method_type
enum<string> | null
required

Machine-readable identifier for the payment method used on the payment. Examples include card, cashapp ..., local methods such as ideal, sofort, ... BNPL options like klarna, affirm, ..., or crypto. Returns null when the processor does not supply a type.

Available options:
acss_debit,
affirm,
afterpay_clearpay,
alipay,
alma,
amazon_pay,
apple_pay,
au_becs_debit,
bacs_debit,
bancontact,
billie,
blik,
boleto,
card,
cashapp,
crypto,
eps,
fpx,
giropay,
google_pay,
grabpay,
ideal,
kakao_pay,
klarna,
konbini,
kr_card,
link,
mobilepay,
multibanco,
naver_pay,
nz_bank_account,
oxxo,
p24,
pay_by_bank,
payco,
paynow,
pix,
promptpay,
revolut_pay,
samsung_pay,
satispay,
sepa_debit,
sofort,
swish,
twint,
us_bank_account,
wechat_pay,
zip,
bizum,
capchase_pay,
kriya,
mondu,
ng_wallet,
paypay,
sequra,
scalapay,
vipps,
custom,
customer_balance,
gopay,
mb_way,
ng_bank,
ng_bank_transfer,
ng_card,
ng_market,
ng_ussd,
paypal,
payto,
qris,
rechnung,
south_korea_market,
kr_market,
shopeepay,
upi,
sunbit,
netbanking,
id_bank_transfer,
demo_pay,
shop_pay,
sezzle,
coinbase,
splitit,
platform_balance,
apple,
venmo,
unknown
billing_reason
enum<string> | null
required

The reason for the charge.

Available options:
subscription_create,
subscription_cycle,
subscription_update,
one_time,
manual,
subscription
failure_message
string | null
required

If the payment failed, the reason for the failure.

metadata
object
required

The custom metadata stored on this payment. This will be copied the checkout configuration for which this payment was made