Pay as a known customer
Charge a customer by its id, and what a known customer changes on the checkout page.
Once you hold an id, from the customer object of an earlier payment or from
POST /customers, pass it and skip the
contact fields entirely. The customer field accepts the id as a plain string, and customer_id
accepts the same value; they are two spellings of one thing.
curl https://api.wajub.com/payments \
-H "Authorization: sk_test.xxxxxxxxxxxxxxxx…" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "XAF",
"customer": "cus_test_sAaim5apjocIgtlhzJY3wQ8s",
"reference": "order-4173"
}'The identifier does not have to be an id. If the value you pass matches no customer id, Wajub
tries it as a phone number, then as an email address. So "customer": "amina@example.com" and
"customer": "+237670000000" both resolve, which is convenient when your own database stores the
email and not the Wajub id.
An identifier that resolves to nothing is a 422, not a new customer
This is the one place where the API refuses to create. Pass customer or customer_id and Wajub
will find that customer or fail the call with a 422 on the field you used, Customer not found.;
it never falls back to creating one. A stale id, a customer deleted last week, or a live id sent to sandbox all kill the
payment outright. Send email or phone instead when you are not certain the record exists.
What a customer changes on the checkout page
This is the part that pays for the extra call. A payment attached to a known customer renders a different page.
| What the customer carries | What the checkout does with it |
|---|---|
| Past cards and Mobile Money numbers | Offers them as one-tap saved methods, default first, ten at most |
preferred_language | Sets the page locale, unless the team or branding setting overrides it |
currency | Becomes the pre-selected currency when auto-convert is enabled |
Saved methods are the real win for returning payers: the number is already there, masked, and they confirm on the handset without typing it again.
Saving a method is the payer's decision
A card or Mobile Money number is only kept when the payer ticks the box on the checkout page. It is never inferred and never defaulted on, so a customer record with no saved methods is the normal state until someone opts in. Only cards and Mobile Money are reusable; wallets and bank transfers are not stored.