Skip to main content

Payment Intent

Official Docs

Payment Intent Resource#

export interface PaymentIntentResource<Metadata = MetadataType> {  id: string;  type: 'payment_intent';  attributes: {    amount: number;    currency: Currency;    description?: string;    statement_descriptor: string;    status: PaymentIntentStatus;    livemode: boolean;    client_key: string;    last_payment_error?: LastPaymentError;    next_action?: NextAction;    payment_method_allowed: ['card'];    payments: PaymentResource[];    payment_method_options: PaymentMethodOptions;    metadata: Metadata;  };}

id *

string

type *

string
Possible value(s):
payment_intent

attributes *

object

amount *

number

currency *

string
Possible value(s):
PHP

description

string

statment_descriptor *

string

status *

string
Possible value(s):
awaiting_payment_method
|
awaiting_next_action
|
processing
|
succeeded

livemode *

boolean

client_key *

string

last_payment_error

object

payment

string

failed_code

PossibleErrorCodes

failed_message

string

failed_method

string

next_action

NextAction

payment_method_allowed *

string[]
Possible value(s):
card

payments *

PaymentResource[]

payment_method_options *

object

card *

object

request_three_d_secure *

string
Possible value(s):
any
|
automatic

metadata

MetaData

Create Payment Intent#

caution

Only works in the when using the secret key

paymongo.paymentIntent.create(CreatePaymentIntentParams): PaymentIntentResource#

Example
paymongo.paymentIntent.create({  data: {    attributes: {      amount: 10000,      currency: 'PHP',      payment_method_allowed: ['card'],    },  },});

Create Payment Intent Params#

data *

object

attributes

object

amount *

number
In cents (P100 = 10000)

payment_method_allowed *

string[]
Possible value(s):
card

curreny *

string
Possible value(s):
PHP

payment_method_options

object

card

object

request_three_d_secure

string
Possible value(s):
any
|
automatic

description

string

metadata

Metadata

Retrieve Payment Intent#

paymongo.paymentIntent.retrieve(RetrievePaymentIntentParams): PaymentIntentResource#

Example
paymongo.paymentIntent.retrieve({  client_key: 'pi_1JvFbEiRRnh2fsUE5nJ2F1z7_client_mpe6tJkgaX3pSoiYeSp1AbEU',  id: 'pi_1JvFbEiRRnh2fsUE5nJ2F1z7',});

Retrieve Payment Intent Params#

id *

string

client_key

string
Required when using the public key

Attach Payment Intent#

paymongo.paymentIntent.attach(AttachPaymentIntentParams): PaymentIntentResource#

Example
paymongo.paymentIntent.attach({  id: 'pi_1JvFbEiRRnh2fsUE5nJ2F1z7',  data: {    attributes: {      client_key: 'pi_1JvFbEiRRnh2fsUE5nJ2F1z7_client_mpe6tJkgaX3pSoiYeSp1AbEU',      payment_method: 'pm_ajeDG2y6WgnrCXaamWFmPUw2',    },  },});

Attach Payment Intent Params#

id *

string
ID of the payment intent

data *

object

attributes *

object

payment_method *

string
ID of the payment method

client_key

string
Required when using the public key

return_url

string