Skip to main content

Payment Method

Official Docs

Payment Method Resource#

export interface PaymentMethodResource<Metadata = MetadataType> {  id: string;  type: 'payment_method';  attributes: {    livemode: boolean;    type: 'card';    details: {      last4: string;      exp_month: number;      exp_year: number;    };    billing?: Billing;    metadata: Metadata;  };}

id *

string

type *

string
Possible value(s):
payment_method

attributes *

object

livemode *

boolean

type *

string
Possible value(s):
card

details *

object

last4 *

string

exp_month *

number
In the form of
MM

exp_year *

number
In the form of
YYYY

billing

Billing

metadata

Metadata

Create Payment Method#

paymongo.paymentMethod.create(CreatePaymentMethodParams): PaymentMethodResource#

Example
paymongo.paymentMethod.create({  data: {    attributes: {      type: 'card',      details: {        card_number: '4343434343434345',        cvc: '123',        exp_month: 12,        exp_year: 2025,      },    },  },});

Create Payment Method Params#

data *

object

attributes *

object

card

string
Possible value(s):
card

details *

object

card_number *

string

exp_month *

month
In the form of
MM

exp_year *

month
In the form of
YYYY

cvc *

string

billing

Billing

metadata

Metadata

Retrieve Payment Method#

paymongo.paymentMethod.retrieve(RetrievePaymentMethodParams): PaymentMethodResource

Example
paymongo.paymentMethod.retrieve({  id: 'pm_ajeDG2y6WgnrCXaamWFmPUw2',});

Retrieve Payment Method Params#

id *

string