【问题标题】:One time, followed by a reoccuring charge in Stripe一次,然后在 Stripe 中重复收费
【发布时间】:2014-04-05 07:20:28
【问题描述】:

我正在开发 Stripe 支付网关。

这是我的代码:

$token = $_POST['stripeToken'];

// Create the charge on Stripe's servers - this will charge the user's card
  try {
    $charge = Stripe_Charge::create(array(
    "amount" => 700, // amount in cents, again
    "currency" => "SEK",
    "card" => $token,
    "description" => "payinguser@example.com")
    );
     echo "<center><font color='green'>Payment Successfull!</font></center>";
} catch(Stripe_CardError $e) {
    // The card has been declined
        }

我正确获得了 stripeToken,并且还可以收取 1 美元,其中 7 瑞典克朗 = 1 美元 但实际上,我想立即向用户收取 7 SEK,然后在 5 天后每月收取 399。

我做了一些研究,发现 webhook 可以帮助我,但我对条带非常陌生,对 web hooks 不太了解。 如果有人能帮我解决我的上述情况,那就太好了!

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    在这种情况下,您要做的是在 Stripe 中创建一个 Customer 对象:

    您将令牌与客户相关联,以便向我们注册卡。创建客户后,您可以处理一次性费用和/或为客户订阅计划以创建定期计费。

    在您的具体情况下,您要做的是创建客户,订阅 3.99 美元/月的计划,试用 5 天,然后一次性收取 7 瑞典克朗/1 美元的费用或创建该金额的发票项目并立即创建发票。

    对于订阅,您需要使用 webhook 来收到有关定期付款成功或失败的通知。

    希望对您有所帮助! 拉里

    PS 我在 Stripe 从事支持工作。

    【讨论】:

      猜你喜欢
      • 2018-10-20
      • 2018-11-23
      • 2018-05-18
      • 2015-11-08
      • 2020-04-07
      • 1970-01-01
      • 2018-11-25
      • 2015-11-10
      • 2016-10-15
      相关资源
      最近更新 更多