Laravel Cashier Webhook:获取金额和发票详细信息

时间:2016-11-26 07:17:32

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

我使用Laravel 5.3和Cashier for Stripe。我已根据文档设置了一个自定义控制器,用于扩展CashierController以处理Webhooks。在此Webhook中,如何从$payload获取收费金额和发票明细?

public function handleInvoicePaymentFailed($payload)
     {
         // Handle The Event
         $customer = $this->getBillable($payload['data']['object']['customer']);

         // NEXT - HOW TO GET THE AMOUNT THAT WAS CHARGED AND INVOICE NUMBER??


         return new Response('Webhook Handled', 200);
     }

我希望从中得到以下信息:

  1. 金额
  2. 发票编号

1 个答案:

答案 0 :(得分:1)

您应该可以使用$payload['data']['object']['amount_due']获取到期金额,$payload['data']['object']['id']来获取条带发票ID。

转到https://dashboard.stripe.com/test/events,点击该活动并查看其中的活动数据。