Initiates a new payment transaction.
{{base_url}}
/payment/create
Parameter | Type | Details |
---|---|---|
amount | decimal | Your Amount , Must be rounded at 2 precision. |
currency | string | Currency Code, Must be in Upper Case (Alpha-3 code) |
return_url: | string | Enter your return or success URL |
cancel_url: | string (optional) | Enter your cancel or failed URL |
Request Example (guzzle)
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'base_url/payment/create', [
“amount”: "100.00",
“currency”: "USD",
“return_url”: "www.example.com/success",
“cancel_url”: "www.example.com/cancel",
],
'headers' => [
'Authorization' => 'Bearer {{access_token}}',
'accept' => 'application/json',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
**Response: SUCCESS (200 OK)**
{
"message": {
"code": 200,
"success": [
"CREATED"
]
},
"data": {
"token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
"payment_url": "www.example.com/pay/sandbox/v1/user/authentication/form/2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
},
"type": "success"
}
**Response: ERROR (403 FAILED)**
{
"message": {
"code": 403,
"error": [
"Requested with invalid token!"
]
},
"data": [],
"type": "error"
}