Managing Customers
The Modem Pay API’s customer management is built to help you store and manage customer details efficiently. Below are detailed steps and example requests for creating, retrieving, updating, deleting, and listing customers, as well as listing their payment methods. This allows you to manage customer profiles and payment preferences seamlessly.
Create a Customer
To create a customer, use the modempay.customers.create()
method, which allows you to add key information like the customer’s name, email, phone number, and an optional starting balance. The distinct
option, when set to true
, checks for existing customers with matching fields (e.g., email) to avoid duplicate entries. If distinct
is omitted or set to false
, a new customer entry will be created without duplicate checks.
Sample Request:
Sample Response:
Retrieve a Customer
To fetch a customer’s details, use modempay.customers.retrieve(customerId)
. Replace customerId
with the customer’s unique ID.
Sample Request:
Sample Response:
Update a Customer
Update a customer’s information using modempay.customers.update(customerId, params)
. Specify the customer ID and the fields to update.
Sample Request:
Sample Response:
Delete a Customer
Remove a customer from your records using modempay.customers.delete(customerId)
. This action is irreversible.
Sample Request:
List All Customers
To view all customers, use modempay.customers.list()
. This returns a list of customers, with pagination options if there are many entries.
Sample Request:
Sample Response:
List Payment Methods for a Customer
To retrieve the payment methods associated with a specific customer, use their customer ID. This is useful to manage or display available payment methods during checkout.
Sample Request:
Sample Response: