Cashramp
  • Introduction
    • Getting Started
    • API Endpoints
    • Authentication
    • Webhooks
    • Integration Guide
    • SDKs
  • Hosted payments
    • Deposits
    • Withdrawals
    • Cancel Payment
  • Onchain Payments
    • On-Off Ramp
  • Cashramp API
    • Queries
    • Customers
    • Payment Methods
    • Withdraw Onchain
Powered by GitBook
On this page
  • Add a customer's payment method
  • How to fill in fields
  • Get a customer's payment methods
  1. Cashramp API

Payment Methods

Manage your customer's payment methods

Add a customer's payment method

addPaymentMethod.gql
mutation {
    addPaymentMethod(
        customer: "TWVyY2hhbnRDdXN0b21lci05ODFmYzVjMy1jNjYwLTQyMzAtYTgzNi0xM2EyOWZlMjRiOWY=",
        p2pPaymentMethodType: "UDJQUGF5bWVudE1ldGhvZFR5cGVUeXBlLTg0ZjU4YWJjLThkZTItNDljYS04ZTE2LTQ0ZjYzMjYxNTBmMg==",
        fields: [
            {identifier: "name", value: "Jane Doe"},
            {identifier: "phone_number", value: "0246977890"}
        ]
    ) {
        id
        value
        fields {
            identifier
            value
        }
    }
}

Request

  • customer: The ID of the customer you want to add a payment method for

  • fields: The customer filled in fields of the type of payment method you're adding for the customer.

How to fill in fields

This section assumes that you've displayed the list of available payment method types to your customer, who has chosen to add an "MTN Mobile Money" payment method.

Your app should render a number of text inputs corresponding to the fields available on the payment method type. When the user enters the right text, you should add it to the fields array you'll provide when calling addPaymentMethod.

For example, if the user types Test User into the name input, and 0247890890 into the phone_number input, your fields array would look like this:

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

Get a customer's payment methods

paymentMethods.gql
query {
    node(id: "TWVyY2hhbnRDdXN0b21lci05ODFmYzVjMy1jNjYwLTQyMzAtYTgzNi0xM2EyOWZlMjRiOWY=") {
        ... on MerchantCustomer {
            p2pPaymentMethods {
                id
                value
            }
        }
    }
}
  • id: The ID of the customer

PreviousCustomersNextWithdraw Onchain

Last updated 10 days ago

p2pPaymentMethodType: The ID of the payment method type you're adding for the customer. You can get a list of the available payment method types using the .

GH MTN Mobile Money Payment Method Type
p2pPaymentMethodTypes query