# Payment Methods

Use `addPaymentMethod` to create a new payment method for a customer. You can then use the `paymentMethod` ID in mutations that require a payment method.

## Example

{% code overflow="wrap" %}

```graphql
mutation {
  addPaymentMethod(
    customer: "TWVyY2hhbnRDdXN0b21lci05ODFmYzVjMy1jNjYwLTQyMzAtYTgzNi0xM2EyOWZlMjRiOWY="
    paymentMethodType: "mtn_momo"
    ownership: first_party
    fields: [
      { identifier: "name", value: "Jane Doe" }
      { identifier: "phone_number", value: "0246977890" }
    ]
  ) {
    id
    value # Friendly label (e.g., “Jane - 0246977890”)
    fields {
      identifier
      value
    }
  }
}
```

{% endcode %}

## Arguments

<table><thead><tr><th width="202.5555419921875">Name</th><th>Type</th><th width="95.4443359375">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>customer</code></td><td><code>ID!</code></td><td><strong>Yes</strong></td><td>Global ID of the customer who owns the payment method.</td></tr><tr><td><code>paymentMethodType</code></td><td><code>String!</code></td><td><strong>Yes</strong></td><td>Identifier of the rail to add (MoMo, bank transfer, etc.). <a href="/pages/PB7ZSAubotbpuwiDnhCH"><code>Payment rails</code></a>.</td></tr><tr><td><code>fields</code></td><td><code>[P2PPaymentMethodFieldInput!]!</code></td><td><strong>Yes</strong></td><td>Key–value pairs that capture the details required by the rail. <a href="#filling-fields"><code>Filling fields</code></a>.</td></tr><tr><td><code>ownership</code></td><td><code>P2PPaymentMethodOwnership</code></td><td>No</td><td>Enum indicating if the payment method is <code>first_party</code> or <code>third_party</code></td></tr></tbody></table>

## Filling `fields`

1. Call [`p2pPaymentMethodTypes`](/cashramp/cashramp-api/queries.md#p2p-payment-method-types) to list available payment rails.
2. Render inputs for each `field` definition in the chosen payment rail.
3. Collect the user’s answers and map them to `{ identifier, value }` objects.

Example for **“GH · MTN Mobile Money”**:

```json
[
  { "identifier": "name", "value": "Test User" },
  { "identifier": "phone_number", "value": "0247890890" }
]
```


---

# Agent Instructions: 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://docs.cashramp.co/cashramp/cashramp-api/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.
