💸
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 Source Resource
  • Creating a Source
  • Retrieving a Source

Was this helpful?

Export as PDF
  1. Reference
  2. API Reference

Sources

A Source is a resource to generate your customer's payment instrument.

PreviousRefundsNextWebhooks

Last updated 3 years ago

Was this helpful?

The Source Resource

A Source is a resource to generate your customer's payment instrument. This is normally used to generate check out URLs for e-wallet payments. To learn more about e-wallet integrations, you can visit or integration.

Creating a Source

/**
 * These are the required properties
 * @param {Object} data Data paypload
 * @param {Object} data.attributes Payload attributes
 * @param {string} data.attributes.type The type of source. Possible values are gcash and grab_pay.
 * @param {number} data.attributes.amount Amount int32
 * @param {string} data.attributes.currency Three-letter ISO currency code, in uppercase. PHP is the only supported currency as of the moment.
 * @param {Object} data.attributes.redirect
 * @param {string} data.attributes.redirect.success Success url
 * @param {string} data.attributes.redirect.failed Error url
 */
const result = await paymongo.sources.create(data);
{
  data: {
    attributes: {
      type: 'gcash',
      amount: 20000, // PHP200,
      currency: 'PHP',
      redirect: {
        success: 'https://yoururl.com/success',
        failed: 'https://yoururl.com/failed'
      }
    }
  }
}

Retrieving a Source

/**
 * @param {string} id Source id
 */
const result = await paymongo.sources.retrieve(id);
GCash
GrabPay
More Details