Adding new payment gateway
adding your own personalized payment gateway to PHPTRAVELS
To add your own payment gateway to PHPTRAVELS follow below guide line
01. login to your admin panel as and navigate to payment gateways from general settings
click on payment gateways menu
02. from payment gateways page click on add as below
click on green button add
03. On the payment gateway adding page add all your credentials as below markup with red line. you can add your.
we will only add the payment gateways credentials later we we will fetch these credentials from client app to proceed with payment. you can add your credentials under the c1 c2 c3 c4 c5 inputs and rest of the fields are mandatory such as developer URL production URL gateway status and so on.
add your gateways credentials to story in database for API server
04. All good now we need to add the image of payment gateway which we used to show on checkout page as you can see below marked red lines on payment gateway.
image of payment gateway
05. Place your payment gateways image under the path as below
1
app/themes/default/assets/img/gateways/ your-gateway .png
Copied!
make sure the image name of your payment gateway must match to your payment gateways name as it is case sensitive and all characters should be small follow by dash if there is spaces. For example Gateway Name : Union Pay Image Name : union-pay.png Final results
1
app/themes/default/assets/img/gateways/union-pay.png
Copied!
06. All done from the backend API side and client side for gateway image now we have to move to the actual work which is coding of payment gateway.
Navigate to file
1
app/controllers/gateways/paypal.php
Copied!
Copy the file paypal.php and then paste it then rename it to your gateway name such as union-pay.php Then edit the file union-pay.php ( your payment gateway name ) 07. Now remove all the code from the file and add below code to the file
1
<?php
2
3
// gateway name
4
$router->post('payment/union-pay', function() {
5
include "app/core/pay_params.php";
6
?>
7
8
// add your javascrpt here
9
10
// below is the params to use for your gateway as for credentials we will use c1 c2 c3 c4 c5 c6 find detailed params below
11
12
/*
13
14
gateway URL <?=$url?>
15
16
credential keys <?=$c1?> <?=$c2?> <?=$c3?> <?=$c4?> <?=$c5?>
17
18
success URL <?=$success_url?>
19
20
return on invoice URL <?=$invoice_url?>
21
22
order details <?=$price?> <?=$currency?> <?=$desc?>
23
24
buyer details <?=$client_email?>
25
26
*/
27
28
<?php
29
$body = "<a href="payment_link" onclick="" class="pay" style="background:#445a7d"/>'.T::paynow.'</a>";
30
include "app/core/pay_view.php";
31
?>
32
<?php });
Copied!
you will need to add your code above customize your payment gateway and then pass anchor link to $body = "<a href="payment_link" or if you are integrating SPA gateway with popup or any JS based onpage payment you need to setup onclick function to call using body = onclick="your_func"
Once all job is done and you should need to test your gateway please make sure to destroy browsers session using http://www.yourdomain.com/sd sd means session destroy it will return back to your website with newly fetch data from main server API
t is super easy to integrate any level of payment gateway to PHPTRAVELS still if you found any hassle or hurdles please feel free to contact us directly on our livechat or shoot us email to our mailbox at [email protected]
Last modified 5mo ago
Copy link