> For the complete documentation index, see [llms.txt](https://paymongo.ossph.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://paymongo.ossph.org/reference/api-reference/payments.md).

# Payments

## The Payment Resource

A `Payment` resource is an attempt by your customer to send you money in exchange for your product. This is a reference to an amount that you are expecting to receive if a payment resource with paid status becomes a part of a payout. If the payment status is `failed`, you can determine the reason for failure.

[More Details](https://developers.paymongo.com/reference/payment-source)

## Creating a Payment

```javascript
/**
 * These are the required properties
 * @param {Object} data Data payload
 * @param {Object} data.attributes Payload attributes
 * @param {number} data.attributes.amount Amount int32
 * @param {number} data.attributes.currency Three-letter ISO currency code, in uppercase. PHP is the only supported currency as of the moment.
 * @param {Object} data.attributes.source The source object from checkout
 * @param {string} data.attributes.source.id Id of a Source resource
 * @param {string} data.attributes.source.type Type of a Source resource. Possible value is 'source'.
 */
const result = await paymongo.payments.create(data);

```

#### Payload

```javascript
{
  data: {
    attributes: {
      amount: 30000,
      currency: 'PHP',
      source: {
        id: 'abc', // Id of the Source resource.
        type: 'source', // 
      }
    }
  }
}

```

## Listing Payments

```javascript
const result = await paymongo.payments.list();
```

#### Results

```javascript
{
  data: [] // array of payments
}
```

## Retrieving a Payment

```javascript
/**
 * @param {string} id Payment id
 */
const result = await paymongo.payments.retrieve();

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://paymongo.ossph.org/reference/api-reference/payments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
