Stripe Subscription payment using Alipay

662 views Asked by At

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!

3

There are 3 answers

0
Alan Hamlett On

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.

You have to request approval for Alipay subscriptions, or else Stripe only allows one-time Alipay payments. I was approved for recurring Alipay payments. You request approval for a specific yearly recurring max amount from Stripe Support, then they request approval from Alipay and let you know the decision.

Question 2: Is there anyway to use the plan Id to charge using Alipay?

You should be able to use a plan id with Alipay by creating a Subscription. However, after Stripe Support activated recurring payments I haven't been able to get Alipay subscriptions working in production. It works fine in test mode, following the official docs:

https://stripe.com/docs/billing/subscriptions/alipay

However, in production the customers click confirm on Alipay's website but when I create a Subscription it returns a PaymentIntent that still needs user confirmation. It's an infinite loop.

Has anyone else gotten recurring payments working with Alipay and Stripe?

4
ceejayoz On

https://stripe.com/docs/payments/checkout

Payment methods: Credit cards, debit cards, Apple Pay, Google Pay, FPX and iDEAL

If you want to use Alipay, you need to use something other than Checkout.

https://stripe.com/docs/payments/alipay

Recurring payments: No

Alipay is a single-use payment method. You cannot use it for subscriptions.

0
ahmaxed On

Yes, but here it says invite only. Not sure if we need to contact stripe to get an invite or alipay.