使用支付宝进行条带化订阅付款

时间:2020-04-06 15:27:02

标签: stripe-payments alipay

我有条纹订阅付款按钮,以下是该代码:

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"
    });
});

我添加了支付宝选项,以下是我使用的代码:

    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;
        }
    });

问题1: 我不确定我做得正确。支付宝的代码看起来像是一次性费用,看起来不像是订阅。因为在我的Stripe仪表板中,它没有显示在“订阅”页面中。

问题2: 无论如何,可以使用计划ID通过支付宝付款吗?

谢谢!

2 个答案:

答案 0 :(得分:0)

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

付款方式:信用卡,借记卡,Apple Pay,Google Pay,FPX和iDEAL

如果要使用支付宝,则需要使用Checkout以外的其他方式。

答案 1 :(得分:0)

是的,但是 here 只显示邀请。不确定我们是否需要联系 Stripe 才能获得邀请或支付宝。