Create Payment Charge (Gateway)
POST /charges/gateway
Description
Create a new payment charge via gateway.
Path Parameters
| Name | Type | Description |
|---|---|---|
| None | No parameters |
Request Headers
| Name | Type | Description |
|---|---|---|
countryCode | string | The country code (header) |
Request Body
- Content Type:
application/json
{
"tenantId": "string",
"productType": "CORAL_PAY",
"paymentMethod": "USSD",
"chargeFormula": "string",
"tenantChargeFormula": "string",
"type": "CREDIT"
}
Charge Formula Documentation
- Variables:
Ameans amount,Pmeans percentage - Constant:
Cmeans constant - Operators:
*means multiplication,+means plus,-means minus - Comparators:
<means less than,>means greater than - Delimiter:
|means vertical pipe
Examples of possible Terms:
5C4P*A5.6P*A4P*10C39C*A20C+A39C-A
Examples of charge formula and interpretation:
4P*Ameans 4 percent of amount (A) or 4 percent multiplied by amount =0.04*A5.6P*10Cmeans 5.6 percent multiplied by constant (10) =0.056*10 = 0.56
Response Code: 200 - OK
Description
Payment charge created successfully.
Response Fields
| Field | Type | Description |
|---|---|---|
status | boolean | Indicates if the operation was successful |
statusCode | integer | Status code |
message | string | Response message |
data | object | Data related to the payment charge |
errors | array | List of error messages, if any |
Example
{
"status": true,
"statusCode": 0,
"message": "Payment charge created successfully",
"data": {},
"errors": [
{
"message": "Some error occurred",
"descriptiveMessage": "Detailed error message"
}
]
}
Method: POST
>http://your-api-url/charges/gateway
Headers
| Content-Type | Value |
|---|---|
| apiKey | {{apiKey}} |
| countryCode | string |
Body
{
"tenantId": "tenant123",
"productType": "CORAL_PAY",
"paymentMethod": "USSD",
"chargeFormula": "4P*A",
"tenantChargeFormula": "5.6P*10C",
"type": "CREDIT"
}
🔑 Authentication bearer
| Param | Value | Type |
|---|---|---|
| token | {{accessCode}} | string |
LANGUAGE
CURL REQUEST
curl --request POST \
--url /charges/gateway \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!