💸
Paymongo for Node.js
OSSPHBlog
  • Paymongo for Node.js!
  • Quick Start
  • Reference
    • API Reference
      • Links
      • Payments
      • Payment Intents
      • Payment Methods
      • Refunds
      • Sources
      • Webhooks
  • Test Cards
  • Change Logs
  • FAQs
Powered by GitBook
On this page
  • The Payment Method Resource
  • Creating a Payment Method
  • Retrieving a Payment Method

Was this helpful?

Export as PDF
  1. Reference
  2. API Reference

Payment Methods

A `PaymentMethod` resource describes which payment method was used to fulfill a payment. It is used with a `PaymentIntent` to collect payments.

PreviousPayment IntentsNextRefunds

Last updated 3 years ago

Was this helpful?

The Payment Method Resource

A PaymentMethod resource describes which payment method was used to fulfill a payment. It is used with a PaymentIntent to collect payments.

Creating a Payment Method



/**
 * These are the required properties
 * @param {Object} data The payload.
 * @param {Object} data.attributes Payload attributes.
 * @param {string} data.attributes.type The type of payment method. The possible value is card for now.
 * @param {string} data.attributes.details.card_number Credit/Debit Card number of the PaymentMethod.
 * @param {number} data.attributes.details.exp_month Expiry month of the Credit/Debit Card.
 * @param {number} data.attributes.details.exp_year Expiry year of the Credit/Debit Card.
 * @param {string} data.attributes.details.cvc CVC of the Credit/Debit Card.
 */
const result = await paymongo.paymentMethods.create(data);

Payload

{
  data: {
    attributes: {
      type: 'card', // The only available type for now is 'card'.
      details: {
        card_number: '4343434343434345',
        exp_month: 02,
        exp_year: 23,
        cvc: '123',
      }
    }
  }
}

Retrieving a Payment Method

/**
 * @param {string} id The PaymentMethod id
 */
const result = await paymongo.paymentMethods.retrieve(id);
More Details