> 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/payment-methods.md).

# Payment Methods

## 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.

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

## Creating a Payment Method

```javascript


/**
 * 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

```javascript
{
  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

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

```


---

# 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/payment-methods.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.
