| 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/library/stripe/ |
Upload File : |
<?php
require_once("vendor/autoload.php");
if ($_POST['tokenId']) {
$token = $_POST['tokenId'];
$stripe = new \Stripe\StripeClient("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");
$customer = $stripe->customers->create(
[
'name' => 'prashant kumar',
'email' => 'prashant@catpl.co.in',
'address' => [
'line1' => 'House 66',
'postal_code' => '201301',
'city' => 'Noida',
'state' => 'UP',
'country' => 'IN',
],
]
);
$charge = $stripe->paymentIntents->create([
"amount" => 100,
"currency" => "inr",
'payment_method_types' => ['card'],
'payment_method_data' => [
'type' => 'card',
'card' => [
'token' => $token
]
],
'description' => 'Software development services',
'customer' => $customer->id,
"metadata" => ["order_id" => "6735"],
'capture_method' => 'automatic',
'confirmation_method' => 'automatic'
]);
// $cap = $stripe->paymentIntents->capture($charge->id);
$confirm = $stripe->paymentIntents->confirm(
$charge->id,
['payment_method' => $charge->payment_method]
);
$data = array('success' => true, 'data' => $charge, 'customer' => $customer, 'confirm' =>$confirm);
echo json_encode($data);
}