Reputation: 7170
I would like to sell a software using Stripe as payment gateway.
After a succesfully payment i want to redirect to a php page that get user email, and generate a serial number given that email.
I don't know how to:
I have this listener from standard documentation:
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
});
Is the one I've to use ?
Thanks
Upvotes: 0
Views: 621
Reputation: 386
You can redirect by
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
window.location.replace("http://stackoverflow.com");
});
You can retrieve the email entered in the stripeEmail
field when you POST the result of Checkout to your server, like this
$token = $_POST['stripeToken'];
$email = $_POST['stripeEmail'];
$customer = \Stripe\Customer::create(array(
'email' => $email,
'source' => $token
));
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
Here is the PHP + Checkout page in the Stripe docs, which goes over this: https://stripe.com/docs/checkout/php
Upvotes: 1