-
-
Save Sarfroz/f5d94230dec442819e98de86e8b677e8 to your computer and use it in GitHub Desktop.
Stripe Code For Indin Users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Process.php | |
$txn='121221|544545'; // any value that you want to get in webhook | |
$sku='sku_G8srn2mAbnQI8k'; // get product id | |
$data=['sku'=>$sku,'email'=>$email,'txn'=>$txn]; // pass this values to php file | |
//redirect.php | |
<html> | |
<head> | |
<title> - Redirecting Please Wait...</title> | |
<!-- Load Stripe.js on your website. --> | |
<script src="https://js.stripe.com/v3"></script> | |
</head> | |
<body> | |
<script> | |
(function() { | |
var stripe = Stripe('');//live key | |
stripe.redirectToCheckout({ | |
items: [{sku: '{{ $data['sku'] }}', quantity: 1}], | |
clientReferenceId:'{{$data['txn']}}', // to get some values in webhook | |
customerEmail: '{{$data['email']}}', // pass email value | |
billingAddressCollection: 'required', // must for indian users | |
successUrl: 'https://www.xyz.com/payments/orders/success', | |
cancelUrl: 'https://www.xyz.com/payments/cancel/true', | |
}) | |
.then(function (result) { | |
if (result.error) { | |
var displayError = document.getElementById('error-message'); | |
displayError.textContent = result.error.message; | |
} | |
}); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment