drn1008 2016-11-22 12:46
浏览 24

Laravel收银员 - 将发票项目添加到订阅中

I'm using Laravel's Stripe integration to bill customers on a monthly basis.

Is it possible to add an invoice item to my subscription, so that my customer is billed monthly for a number of items he/she used within that period?

This question suggests that it is possible

And Laravel's documentation covers creating an invoice but not adding an invoice item.

Does anyone know if there is a Laravel method for add invoice item? If not, how is an invoice item added?

  • 写回答

1条回答 默认 最新

  • doujiao2443 2017-01-03 10:38
    关注

    I think will be easier with Laravel 5.4, but since it's not out as of this writing, you have to set it up manually.

    with Laravel 5.4 (assuming this function makes it in)

    $user->invoiceForUpcoming('One-time charge', 1000);
    

    Manual way (make sure you have Cashier installed, etc):

    use Stripe\InvoiceItem as StripeInvoiceItem;
    

    The in your controller or wherever makes sense:

    $options = [
      'customer' => $user->stripe_id,
      'amount' => 1000,
      'currency' => 'usd',
      'description' => 'One-time fee',
    ];
    $response = StripeInvoiceItem::create(
      $options, ['api_key' => config('services.stripe.secret')]
    );
    
    评论

报告相同问题?

悬赏问题

  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?