I have stripe subscription payment button and the following is the code for that:
var stripe = Stripe("<?php echo $stripe["public_key"]; ?>");
$(".btnStripeSubscribe").click(function () {
stripe.redirectToCheckout({
items: [{
plan: "<?php echo $planId; ?>",
quantity: 1
}],
customerEmail: "<?php echo $user["email"]; ?>",
successUrl: "http://example.com/success.php",
cancelUrl: "http://example.com/dashboard.php"
});
});
And i added Alipay option and the following is the code I use:
stripe.createSource({
type: 'alipay',
amount: '500',
currency: 'cny',
redirect: {
return_url: 'http://example.com/success.php'
},
}).then(function (response) {
if (response.error) {
alert(response.error.message);
} else {
window.location.href = source.redirect.url;
}
});
Question 1: I am not sure i am doing it correctly. The code for Alipay looks like a one-time charge and it does not look like subscription. Because in my Stripe Dashboard, it does not show up in Subscription page.
Question 2: Is there anyway to use the plan Id to charge using Alipay?
Thank you!