首页 > 解决方案 > 使用支付宝的 Stripe 订阅支付

问题描述

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

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 Dashboard 中,它没有显示在订阅页面中。

问题2: 有没有办法使用plan ID使用支付宝进行收费?

谢谢!

标签: stripe-paymentsalipay

解决方案


是的,但这里只说邀请。不确定我们是否需要联系 Stripe 来获得邀请或支付宝。


推荐阅读