| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/ |
Upload File : |
<?php
require_once("stripe/vendor/autoload.php");
require_once 'cronjob/init.php';
$TblAgency = new Travel_Model_TblAgency();
//$baseUrl = 'http://local.st.com/';
$baseUrl = 'https://globaltravelexchange.com/';
$crmcustomerObj = new Travel_Model_CRM_Customer();
$crmagencyleadaccountObj = new Travel_Model_CRM_AgencyLeadAccount();
$agencycustomerObj = new Travel_Model_CRM_AgencyCustomer();
$paymentMdl = new Payment_Model_Payment();
$resultArr = array();
function GUID() {
if (function_exists('com_create_guid') === true) {
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
if ($_POST) {
$order_id = GUID();
$token = isset($_POST['tokenId']) ? trim($_POST['tokenId']) : '';
$AgencySysId = (int) $_POST['AgencySysId'];
$FullName = isset($_POST['FullName']) ? trim($_POST['FullName']) : '';
$amount = isset($_POST['FullName']) ? (float) ($_POST['amount'] * 100) : '';
$invCurrency = isset($_POST['invCurrency']) ? trim($_POST['invCurrency']) : '';
$Email = isset($_POST['Email']) ? trim($_POST['Email']) : '';
$Address = isset($_POST['Address']) ? trim($_POST['Address']) : '';
$City = isset($_POST['City']) ? trim($_POST['City']) : '';
$Country = isset($_POST['Country']) ? trim($_POST['Country']) : '';
$Pincode = isset($_POST['Pincode']) ? trim($_POST['Pincode']) : '';
$checkPaymentSetting = $paymentMdl->checkPaymentgatewaySetting($AgencySysId);
if ($token != '' && !empty($checkPaymentSetting)) {
$secretKey = trim($checkPaymentSetting['PaymentSecretPwd']);
$stripe = new \Stripe\StripeClient($secretKey);
$customer = $stripe->customers->create(
[
'name' => $FullName,
'email' => $Email,
'address' => [
'line1' => $Address,
'postal_code' => $Pincode,
'city' => $City,
'state' => '',
'country' => $Country,
],
]
);
$charge = $stripe->paymentIntents->create([
"amount" => $amount,
"currency" => $invCurrency,
'payment_method_types' => ['card'],
'payment_method_data' => [
'type' => 'card',
'card' => [
'token' => $token
]
],
'description' => 'Travel Agency',
'shipping' => [
'name' => $FullName,
'address' => [
'line1' => $Address,
'postal_code' => $Pincode,
'city' => $City,
'state' => '',
'country' => $Country,
],
],
'customer' => $customer->id,
"metadata" => ["order_id" => $order_id],
'capture_method' => 'automatic',
'return_url' => $baseUrl . 'stripe-return.php?stripe=' . $AgencySysId,
'confirm' => true,
'confirmation_method' => 'automatic'
]);
$next_action = $charge->next_action->redirect_to_url->url;
$data = array('success' => true, 'data' => $charge, 'customer' => $customer, 'redirect_url' => $next_action);
echo json_encode($data);
}
}