Create Payment Charge
POST /charges
Description
Create a new payment charge with a specified charge formula.
Body Parameters
| Name | Type | Description |
|---|---|---|
tenantId | string | Unique identifier for the tenant (Required) |
productType | string | Type of product associated with the charge (Required) |
paymentMethod | string | Payment method associated with the charge (Required) |
chargeFormula | string | Charge formula for calculating charges (Required) |
Charge Formula
The chargeFormula is a string that represents the formula for calculating charges. It can include variables (A for amount, P for percentage), constants (C), operators (* for multiplication, + for addition, - for subtraction), comparators (< for less than, > for greater than), and delimiters (|).
Examples of possible charge formula terms:
- 5C (constant 5)
- 4P*A (4 percent of amount)
- 5.6P*A (5.6 percent of amount)
- 4P*10C (4 percent multiplied by constant 10)
- 39C*A (39 times constant multiplied by amount)
- 20C+A (20 times constant plus amount)
- 39C-A (39 times constant minus amount)
Example
{
"tenantId": "tenant_id_123",
"productType": "subscription",
"paymentMethod": "credit_card",
"chargeFormula": "2.5.6P*10C"
}
Response Code: 200 - OK
Description
Successful.
Response Field
| Field | Type | Description |
|---|---|---|
| status | boolean | Indicates the overall success of the operation. |
| statusCode | integer | Represents the specific status code for the response. |
| message | string | Provides additional information about the response. |
| data | object | Contains the main data payload of the response. |
| errors | array | An array containing error details if issues occurred. |
| - message | string | Describes the error. |
| - descriptiveMessage | string | Provides a more detailed and descriptive message about the error. |
Example
<response>
<status>true</status>
<statusCode>0</statusCode>
<message>string</message>
<data></data>
<errors>
<error>
<message>string</message>
<descriptiveMessage>string</descriptiveMessage>
</error>
</errors>
</response>
Method: POST
>http://20.87.230.105/platform/wallets/charges
Headers
| Content-Type | Value |
|---|---|
| apiKey | {{apiKey}} |
🔑 Authentication bearer
| Param | value | Type |
|---|---|---|
| token | {{accessCode}} | string |
LANGUAGE
CURL REQUEST
curl --request POST \
--url /charges \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!