Initialize Direct Payment

Initialize a new direct payment transaction with mobile service integration.

Endpoint

POST /api/paiements/initialize-direct-paiement

Request Body

amountrequirednumber
The payment amount
descriptionrequiredstring
Description of the payment
phonerequiredstring
Recipient phone number
service_mobile_codestring
Mobile service code (optional)
extra_dataobject
Optional JSON object with additional data

Example Request

POST /api/paiements/initialize-direct-paiement
X-API-Key: sk_test_your_api_key_here
Content-Type: application/json
{
  "amount": 500,
  "description": "Direct payment to mobile",
  "phone": "+2250102030405",
  "service_mobile_code": "ORANGE_CI",
  "extra_data": {
    "reference": "PAY_001"
  }
}

Response

Success Response Example

{
  "id": "direct_payment_987654321",
  "reference": "DIRECT_PAY_REF_987654321",
  "amount": 500,
  "description": "Direct payment to mobile",
  "phone": "+2250102030405",
  "service_mobile_code": "ORANGE_CI",
  "status": "INIT",
  "extra_data": {
    "reference": "PAY_001",
    "callback_url": "https://example.com/callback"
  },
  "createdAt": "2024-01-15T11:00:00Z",
  "updatedAt": "2024-01-15T11:00:00Z"
}

Error Responses

400 Error Example

{
  "statusCode": 400,
  "message": [
    "phone must be a valid phone number",
    "amount must be a positive number",
    "service_mobile_code is required for direct payments"
  ],
  "error": "Bad Request"
}

401 Error Example

{
  "statusCode": 401,
  "message": "Invalid or missing API key",
  "error": "Unauthorized"
}