API Documentation
Pay In
Init Payment

Initiate Payment API Documentation

This documentation provides information about the "Initiate Payment" API, which allows merchants to initiate online payments for their services. This API is designed to facilitate secure and seamless payment processing.

Endpoint

POST https://api.secure.payment.loov-solutions.com/v1/payment/init

Request Headers

  • Accept: application/json
  • Content-Type: application/json
  • app-key: Your unique application key for authentication.
  • merchant-key: Your unique merchant key for identification.

Request Body

The request body contains details required to initiate the payment.

{
    "amount": 200,
    "currency": "XOF",
    "payment_mode": "CARD",
    "return_url": "https://google.com?state=return_url",
    "cancel_url": "https://google.com?state=cancel",
    "callback_url": "https://webhook.site/9c647add-6b43-4832-bd5d-db529c7c9b79",
    "description": "test payment de service en ligne",
    "customer": {
        "name": "John Doe",
        "email": "john@gmail.com",
        "phoneNumber": "23769*******"
    }
}
  • amount: The payment amount in the specified currency.
  • currency: The currency code of the payment amount.
  • payment_mode: The chosen payment mode. value: ALL, CARD, MOBILE_MONEY.
  • return_url: URL to redirect after successful payment.
  • cancel_url: URL to redirect if payment is canceled.
  • callback_url: URL for payment notifications (webhook).
  • description: Description of the payment purpose.
  • customer: Customer details including name, email, and phone number.

Success Response

Upon successful payment initiation, the API will respond with a status code of 200 along with the following response body:

{
    "status": 200,
    "message": "Payment initiated",
    "payment_url": "https://api.secure.payment.loov-solutions.com/payinit/oa7DZzEd8gwJ5PYQ",
    "reference": "LOC8SXoZuDVEvu1ODxs"
}
  • status: The HTTP status code indicating success (200).
  • message: A message indicating successful payment initiation.
  • payment_url: URL for users to complete the payment process.
  • reference: Unique reference code for the initiated payment.

Error Responses

In case of errors, the API may respond with appropriate error status codes and messages.

Example error response:

{
    "status": 400,
    "message": "Invalid request. Missing 'amount' field."
}

Example Usage

cURL

curl -X POST "https://api.secure.payment.loov-solutions.com/v1/payment/init" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "app-key: YOUR_APP_KEY" \
    -H "merchant-key: YOUR_MERCHANT_KEY" \
    -d '{
        "amount": 200,
        "currency": "XOF",
        "payment_mode": "CARD",
        "return_url": "https://google.com?state=return_url",
        "cancel_url": "https://google.com?state=cancel",
        "callback_url": "https://webhook.site/9c647add-6b43-4832-bd5d-db529c7c9b79",
        "description": "test payment de service en ligne",
        "customer": {
            "name": "John Doe",
            "email": "john@gmail.com",
            "phoneNumber": "23769*******"
        }
    }'

Conclusion

The "Initiate Payment" API allows merchants to start the payment process seamlessly. Ensure to handle both success and error responses appropriately in your application to create a smooth payment experience for your users.

Remember to replace placeholders (YOUR_APP_KEY, YOUR_MERCHANT_KEY) with your actual credentials when making API requests.