OuiPay
Getting Started

Test Transaction

Run a complete sandbox transaction, from customer creation to webhook confirmation.

This walkthrough runs a full sandbox payment end-to-end: create a customer, initiate a payment, and check the result.

Prerequisites

  • A sandbox API key (sk_test_...) from Dashboard > Developers > API keys
  • A webhook endpoint (use a tool like webhook.site for testing)

1. Create a customer

curl https://api.ouipay.com/v1/customers \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: test-cust-001" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Test Customer",
    "email": "test@example.com",
    "phone": "+2348012345678",
    "country_code": "NG"
  }'

Save the id from the response: you need it for the next step.

2. Create a test payment

curl https://api.ouipay.com/v1/payments \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: test-pay-001" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "CUSTOMER_ID_FROM_STEP_1",
    "amount_minor": 50000,
    "currency": "NGN",
    "method": "card",
    "reference": "test-order-001"
  }'

3. Check the result

The sandbox simulates the provider flow. Query the transaction to see the outcome:

curl https://api.ouipay.com/v1/transactions/TRANSACTION_ID \
  -H "Authorization: Bearer sk_test_..."

In sandbox, simulated payments complete within seconds. In production, the timing depends on the payment method and provider.

4. Confirm the webhook

If you registered a webhook subscription, you should see a payment.completed event delivered to your endpoint. Verify the signature and check the event_key for deduplication.

What to test

ScenarioHow to triggerExpected result
Successful paymentUse amount_minor: 50000completed
Failed paymentUse amount_minor: 99999 (sandbox trigger)failed with failure.code
Idempotent replayRepeat step 2 with the same Idempotency-KeySame response, no duplicate
Missing authOmit the Authorization header401 UNAUTHENTICATED

On this page