💸
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 Refund Resource
  • Creating a Refund
  • Listing Refunds
  • Retrieving a Refund

Was this helpful?

Export as PDF
  1. Reference
  2. API Reference

Refunds

Paymongo Refunds

PreviousPayment MethodsNextSources

Last updated 3 years ago

Was this helpful?

The Refund Resource

A Refund resource allows you to return full or partial amount of a payment to your customer's original payment method.

Creating a Refund

/**
 * These are the required properties
 * @param {string} secret API private key
 * @param {Object} data Data payload
 * @param {Object} data.attributes Payload attributes
 * @param {number} data.attributes.amount Amount of the refund. A positive integer with minimum amount of 100. See https://developers.paymongo.com/reference/create-a-refund
 * @param {string} data.attributes.notes Notes of the refund. You can use this value to save remarks about the refund. The maximum characters is 255.
 * @param {string} data.attributes.payment_id The ID of a Payment resource to be refunded.
 * @param {string} data.attributes.reason Reason for the refund. Possible values are duplicate, fraudulent, requested_by_customer and others.
 * @param {Object} data.attributes.metadata A set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the object in a structured format. Only string values are accepted.
 */asc
const result = await paymongo.refunds.create(data);

Payload

{
  "data": {
    "id": "ref_vPSqdAPD2pmtKj6Ac5SRfXjs",
    "type": "refund",
    "attributes": {
      "amount": 10000,
      "currency": "PHP",
      "livemode": true,
      "notes": "Double payment created",
      "payment_id": "pay_qOShdAuD3p8tKa6Ac4SRfbjs",
      "payout_id": null,
      "reason": "requested_by_customer",
      "status": "succeeded",
      "created_at": 1612746914,
      "updated_at": 1612746914
    }
  }
}

Listing Refunds

const result = await paymongo.refunds.list();

Retrieving a Refund

/**
 * @param {string} id ID of a Refund
 */
const result = await paymongo.refunds.retrieve(id);
More Details