Initiates a new payment transaction.
{{base_url}}
/api/paymentApi/v3
Parameter | Type | Details |
---|---|---|
amount | decimal | Your Amount , Must be rounded at 2 precision. |
merchant_email | string | Enter your merchant email |
client_id | string | Enter your merchant client Id |
client_secret | string | Enter your merchant client secret |
mode | string | Enter your merchant api mode (sandbox|production) |
user_email | string | Enter your user email |
first_name | string | Enter user first name |
last_name | string | Enter your user last name |
mobile_code | string (min:2) | Enter user mobile code (+16) |
mobile | string (min:8|max:11) | Enter user mobile number (04751886) |
country | string | Enter country name |
city | string | Enter city Name |
zip | string | Enter zip code | return_url: | string | Enter your return URL where user will be redirected after payment made |
callback_url: | string | Enter your callback_url where you will get payment status (success,pending) webhook |
additional_id: | string | Enter your additional_id to manage your side transaction record |
payment_app_name: | string | upi (example) |
currecny_code: | string | INR (example) |
currecny code |
---|
USD, EUR,GBP, INR, BRL, PLN, JPY, KRW |
Request Example (guzzle)
<?php
require_once('vendor/autoload.php');
// Instantiate Guzzle HTTP client
$client = new GuzzleHttp\Client();
// Define API URL
$api_url = {{base_url}}'/api/paymentApi/v3';
// Define success and cancel URLs
$callback_url = 'http://your_domain.com/callback_url';
$return_url = 'http://your_domain.com/return_url';
// Prepare POST request parameters
$post_data = [
'form_params' => [
'callback_url' => $callback_url,
'return_url' => $return_url,
'amount' => 100.00,
'merchant_email' => 'merchant@gmail.com',
'client_id' => 'your client id',
'client_secret' => 'your client secret',
'mode' => 'sandbox',
'user_email' => 'user@gmail.com',
'first_name' => 'user firstName',
'last_name' => 'user lastName',
'mobile_code' => "+16",
'mobile' => '+1604751886',
'country' => 'Germany',
'city' => 'Berlin',
'zip' => '10115',
'additional_id' => '123456789',
'payment_app_name' => 'pp_usd',
'currency_code' => 'USD',
]
];
// Send POST request
$response = $client->post($api_url, $post_data);
// Handle response as needed
echo $response->getBody();
?>
**Response: SUCCESS (200 OK)**
{
"code": "200",
"payment_url": "https://www.sandbox.paypal.com/checkoutnow?token=1US595321X",
"status": "pending",
"message": "Transaction is being processed",
"merchant_email": "merchant@gmail.com",
"username": "userFirstName userLastName",
"email": "user@gmail.com",
"transactionId": "25077802-3519003448-5111",
"additional_id": "123456789",
}
**Response: ERROR (422 FAILED)**
{
"code": "422",
"status": "error",
"message": {
"fieldName:["error message"]"
},
"merchant_email": "merchant@gmail.com",
"username": "userFirstName userLastName",
"email": "user@gmail.com",
"additional_id": "123456789",
}
The Possible status are
1. SUCCESS - The transaction is successful.
2. Error - An incorrect parameter or invalid data was provided in the API call.
3. FAILED - The transaction is failed (You can request the exact reason by raising a query with Payitwise support).
4. PENDING - Whenever a transaction is created, you will receive a PENDING callback.
5. TIMEDOUT - If user abandons the transaction, you will receive this status after a certain period of time. (Time period varies based on currency).
6. BLOCKED - The user has been blocked by the bank.