Skip to main content

Initialize Payment

To initialize a payment in the NoWallet system, use the following endpoint:

POST{baseUrl}/init/payment

Request Body Parameters

When initializing a payment, the request body must include the following parameters in JSON format:

NameInTypeRequiredDescription
bodybodyInitPaymentModelDTOtruenone

Example Request Body

{
"transaction_id": "ca3a65bb-9008-443d-8d4b-61c3b0006438",
"additional_infos": {
"customer_email": "[email protected]",
"customer_lastname": "Doe",
"customer_firstname": "John",
"customer_phone": "691234567"
},
"amount": 200,
"callback_url": "https://example.com/callback",
"return_url": "https://example.com/return",
"country_code": "CM",
"operators_code": ["OM"],
"method": "MERCHANT",
"tunnel": "CHECKOUTPAGE",
"operator_otp": "123456"
}

Code Samples in Multiple Languages

To help you integrate the NoWallet API seamlessly, we provide code samples in various programming languages. These examples demonstrate how to make a request to the API endpoint and handle the response.

  • Shell (cURL): For quick testing and command-line usage.
  • HTTP: Raw HTTP request format for understanding the structure.
  • JavaScript: Using fetch for browser or Node.js environments.
  • Ruby: Using the rest-client library for Ruby applications.
  • Python: Using the requests library for Python projects.
  • PHP: Using GuzzleHttp for PHP integrations.
  • Java: Using HttpURLConnection for Java applications.
  • Go: Using the net/http package for Go projects.

Example Request

Below is an example of how to initialize a payment link using different languages. Select the tab corresponding to your preferred language to view the implementation.

note

Ensure you replace {access-token} with your actual API token and provide the required request body parameters.

# Example of initializing a payment link using cURL
curl -X POST {baseUrl}/init/payment \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

Response Parameters

When you make a request to the NoWallet API to initialize a payment, the server will respond with a status code and a JSON object containing the relevant information.

The response from the server will include the following parameters in JSON format:

StatusMeaningDescriptionSchema
200OKPAYMENT_INITIATE - SUCCESS response sent to merchantInitPaymentResponseModelDto
400Bad RequestPAYMENT_INITIATE - BAD REQUEST possible errorsNone

Response Types

The response from the server will include the url of the payment initialization and any relevant information. The response will be in JSON format.

Success Response (200 OK)

PAYMENT_INITIATE - SUCCESS response sent to merchant

{
"country": "CM",
"currency": "XAF",
"signature": "EXAMPLE-XXXXX-XXXXX",
"available_operator": ["MTN", "OM"],
"authorized_operator": ["MTN", "OM"],
"payment_url": "https://example.com/payment",
"payment_otp": "ACHAT123456",
}

⚠️ Specific field: payment_url

The payment_url field represents a payment completion URL returned by the API in specific cases.

📌 Usage context

When this field is present, it means that the payment requires an additional user action to be completed.
It is generally used in the context of payments via WAVE.

📲 Checkout-side usage

When payment_url is included in the response:

  • The URL must be converted into a QR Code
  • The QR Code must be displayed on the checkout page
  • The user scans the QR Code with their phone or clicks a button to open the link if they are on mobile
  • They are automatically redirected to their Wave application
  • The payment is then completed directly within the Wave application

🔄 User journey

Payment page → Wave QR Code → Scan → Wave application → Payment confirmed

⚠️ Specific field: payment_otp

The payment_otp property is optional and is returned only in a specific case:

  • ✅ Only when finalizing payments (deposits) via MyNita NIGER (NE)
  • ❌ It does not apply to other operators or countries

Use of payment_otp

When the payment_otp field is present in the response:

  • The merchant must display or provide this code to the end user
  • This code allows the user to:
    • Complete the payment directly in the MyNita application
    • Or go to an authorized Nita service counter to make the payment manually
warning

The merchant must not modify this code.
It must be communicated as is to the end user.

MyNita NIGER (NE) scenario example

  1. The merchant initializes a payment
  2. The API returns a response containing the payment_otp field
  3. The merchant displays or sends the code to the user (confirmation screen, SMS, email, etc.)
  4. The user:
    • Enters the code in the MyNita application
    • Or goes to an authorized Nita service counter with the code to complete the payment

Error Response (400 Bad Request)

PAYMENT_INITIATE - BAD REQUEST possible errors

{
"statusCode": 400,
"error": "ERROR_COUNTRY_CODE_NOT_FOUND",
"message": "It seems that this country code does not exist"
}
{
"statusCode": 400,
"error": "NOT_ALLOWED_TUNNEL_WITHOUT_PHONENUMBER",
"message": "API tunnel is allowed only if there is a customer_phone"
}
{
"statusCode": 400,
"error": "NOT_ALLOWED_TUNNEL_OPERATORS_CODE",
"message": "API tunnel is allowed only for single operators_code e.g. ['OM']"
}
{
"statusCode": 400,
"error": "ERROR_PHONE_NUMBER_LENGTH_IS_TOO_SHORT",
"message": "phone number invalid, the length of this phone number is too short"
}
{
"statusCode": 400,
"error": "ERROR_PHONE_NUMBER_OPERATOR_COUNTRY",
"message": "It seems that this number is not a valid phone number, the phone number is not valid for this operator or country"
}
{
"statusCode": 400,
"error": "ERROR_FEE_NOT_FOUND",
"message": "You cannot generate a signature, please contact administrator to get help."
}
{
"statusCode": 400,
"error": "ERROR_GENERATE_SIGNATURE",
"message": "Something went wrong during signature generation, please contact support to get help or try again."
}
{
"statusCode": 400,
"error": "ERROR_BALANCE_DEFICIT",
"message": "An error has occurred, the transaction signature could not be generated. Your balance is deficit. Please contact administrator to get help."
}

Was this page helpful?