A `PaymentIntent` resource is used to track and handle different states of the payment until it succeeds.
The Payment Intent Resource
A PaymentIntent resource is used to track and handle different states of the payment until it succeeds. To learn how to receive credit/debit card payments using PaymentIntent, you can check this section. To learn how to receive PayMaya payments using PaymentIntent, you can check this section.
/** * These are the required properties * @param{Object} data The payload. * @param{Object} data.attributes Payload attributes. * @param{number} data.attributes.amount Amount to be collected by the PaymentIntent. * @param {string[]} data.attributes.payment_method_allowed The list of payment method types that the PaymentIntent is allowed to use. Possible value is card for now.
* @param {string} data.attributes.currency Three-letter ISO currency code, in uppercase. PHP is the only supported currency as of the moment.
*/constresult=awaitpaymongo.paymentIntents.create(data);
Payload
{ data: { attributes: { amount:10000,// 10000 or 100 in money value is the smallest allowed amount. currency:'PHP',// Three-letter ISO currency code. Only supports PHP for now. payment_method_allowed: ['card'] // The only available value for now is 'card'. } }}
Retrieving a Payment Intent
/** * @param{string} id PaymentIntent id */constresult=awaitpaymongo.paymentIntents.retrieve(id);
Attach to PaymentIntent
/** * These are the required properties * @param{string} id PaymentIntent id. * @param{Object} data The payload. * @param{Object} data.attributes Payload attributes. * @param{string} data.attributes.payment_method Id of PaymentMethod to attach to the PaymentIntent. */constresult=awaitpaymongo.paymentIntents.attach(id, data);