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"
}

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?