# PayPoint store payments

> Customers pay WhatsApp orders with mobile money through PayPoint inside the checkout; the money goes to the store's own PayPoint account.

Source: https://docs.nexafone.so/v1/commerce/payments/

The customer pays without leaving WhatsApp, and the money goes straight to the **store’s own PayPoint account**.
Nexafon never holds the sale money; its own fee is charged to the store’s wallet ([billing](/v1/billing/#order-fees)).

## Set up the store

1. Save the store’s PayPoint API key and merchant id with
   `PUT /api/v1/workspaces/{workspaceId}/payments/paypoint` (or in the embedded **Payments** screen, with
   `payments:manage`). Nexafon answers only “saved” and the last 4 characters; the key is encrypted and never
   returned or logged.
2. `POST …/payments/paypoint/test` checks the key with PayPoint without charging anyone.
3. `PUT …/payments/paypoint/wallets` picks the wallets customers may use: `evc_plus`, `zaad`, `sahal`, `jeeb`,
   `edahab`, `premier_wallet`.

## What the customer sees

1. After delivery details the checkout shows **Pay with PayPoint**: the store’s wallets, the number to charge
   (their WhatsApp number, editable) and the total.
2. On **Pay**, Nexafon starts the charge with the store’s key and closes the checkout. A “waiting” message asks the
   customer to enter their PIN on their phone.
3. When PayPoint confirms, the order is marked `paid` **exactly once**, the customer gets a confirmation with the
   order number, items, total, wallet and reference, and `order.paid` goes out.
4. If it fails, the customer gets the reason in plain words (not enough balance, cancelled, no PIN in time, no
   account on this wallet) with **Try again** and **Another wallet**; `order.payment_failed` goes out.

Only one payment attempt runs at a time per order. If no payment is started 10 minutes after checkout, the payment
step is sent once more. A payment confirmed late, after another attempt already paid, never pays twice: it is flagged
for a refund decision.

## Guarantees

- No public endpoint can start a charge or mark an order paid: charges start only from the checkout, and only
  PayPoint’s confirmation of Nexafon’s own payment reference settles an order.
- The amount charged is the order’s server-computed total.
- Payment status is polled from PayPoint for up to 24 hours, so a PIN approved late is still recorded.
