Quick Start Guide

Process your first payment in 5 minutes

Prerequisites

Before you begin, make sure you have obtained your sandbox API credentials from the Yassir merchant dashboard.
1

Get your API credentials

Sign up for a Yassir merchant account and navigate to the API settings to obtain your:

  • Client ID (format: TENANT.SERVICE.ULID)
  • Client Secret
2

Register the customer

Before creating a payment, register the customer by phone number. This is idempotent — if the customer already exists, you'll get a 409 which you can safely ignore.

Bash
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
  }'
3

Create a payment intent

On your server, create a payment intent. Use the registered customer's phone number as userId:

Bash
curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents?countryCode=DZA" \
  -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 '{
    "actionId": "order_12345",
    "amount": 1500.00,
    "actionCurrencyCode": "DZD",
    "actionCountryCode": "DZA",
    "userId": "+213555123456"
  }'

Save the returned paymentId for the next step.

4

Proceed with payment

Submit the payment with a selected payment method:

Bash
curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents/{paymentId}/proceed" \
  -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" \
  -H "x-client-secret: pa_PAYMENT_ID_secret_HEX" \
  -H "x-country-code: DZA" \
  -d '{
    "paymentMethodCode": "WALLET_V2"
  }'
5

Handle the result

Check the statusCode in the response:

  • 2 — Payment succeeded
  • 12 — Redirect the user to the payUrl for verification (OTP / 3DS)
  • 3 — Payment rejected, allow the user to retry

You should also set up webhooks to receive server-side notifications for asynchronous payment updates.

Next Steps

  • Set up webhooks to receive payment notifications
  • Configure your production credentials
  • Review our security best practices