【问题标题】:Laravel Cashier and creating customer and card in StripeLaravel Cashier 并在 Stripe 中创建客户和卡片
【发布时间】:2015-12-19 08:25:50
【问题描述】:

如何使用 Laravel Cashier 库创建客户和卡,以便稍后收费?不,我不是在寻找订阅。

【问题讨论】:

    标签: laravel stripe-payments laravel-5.1 laravel-cashier


    【解决方案1】:

    假设您正在运行 Laravel 5,以下将起作用。对于条带网关,有一个 createStripeCustomer 函数。您可以手动调用该函数为新客户请求一个 stripe_token 并存储它。

    //pass the user object to the gateway; it must implement BillableContract
    $gateway = new \Laravel\Cashier\StripeGateway($user);
    
    //manually create a new Customer instance with Stripe
    $customer = $gateway->createStripeCustomer($request->get('stripe_token'));
    
    //update the model's info
    $gateway->updateLocalStripeData($customer);
    

    然后您可以将此客户令牌用于未来的订阅等。

    【讨论】:

    • 但我现在更想使用 Stripe 的 SDK 而不是 Cashier
    猜你喜欢
    • 2021-12-27
    • 2018-07-26
    • 2016-08-04
    • 2021-01-31
    • 2015-07-31
    • 2014-03-08
    • 1970-01-01
    • 2019-08-01
    • 2017-03-06
    相关资源
    最近更新 更多