# 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="../introduction/payment-rails"><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`](https://docs.cashramp.co/cashramp/queries#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" }
]
```
