Customers

Manage customers in Yassir Payment

Customers are automatically created when you create a payment intent with a new userId (phone number). You do not need to register customers before processing payments.

However, you can use the endpoints below to explicitly create customers, look up customer details, or update customer information.

Auto-creation

When you create a payment intent with a userId that doesn't exist yet, the customer is automatically created. No separate registration step is needed.

Create Customer#

Registers a new customer with the payment gateway. If the customer already exists (same phone number), a 409 Conflict is returned.

POST/api/v1/customers
Bearer Token
Register a new customer by phone number.

Request Body#

namestringrequired
The customer's display name.
phonestringrequired
The customer's phone number in international format (e.g., +213555123456). This will be used as the userId when creating payment intents.
emailstringoptional
The customer's email address (optional).
isActivebooleanoptional
Whether the customer should be active. Defaults to true.

Idempotent Registration

If a customer with the same phone number already exists, the API returns a 409 Conflict. This is safe to ignore.
Create Customer
curl -X POST https://api.payment.yassir.io/api/v1/customers \
  -H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
  -H "Content-Type: application/json" \
  -H "x-platform: API" \
  -H "x-service: YOUR_SERVICE" \
  -d '{
    "name": "John Doe",
    "phone": "+213555123456",
    "isActive": true
  }'
201 Created
{
  "code": 201,
  "status": "success",
  "message": "Successfully created customer",
  "data": {
    "name": "John Doe",
    "email": null,
    "phone": "+213555123456"
  }
}

Get Customer#

Retrieve a customer by their ID.

GET/api/v1/customers/:id
Bearer Token
Retrieve customer details by ID.

Search Customer by Phone#

Look up a customer by their phone number.

GET/api/v1/customers/search/:phone
Bearer Token
Search for a customer by phone number.
Search Customer by Phone
curl https://api.payment.yassir.io/api/v1/customers/search/+213555123456 \
  -H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
  -H "x-platform: API" \
  -H "x-service: YOUR_SERVICE"

Update Customer#

Update an existing customer's details.

PUT/api/v1/customers/:id
Bearer Token
Update customer details.
namestringoptional
Updated display name.
emailstringoptional
Updated email address.
phonestringoptional
Updated phone number in international format.
isActivebooleanoptional
Set to false to deactivate the customer.