我使用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);
}
我希望从中得到以下信息:
答案 0 :(得分:1)
您应该可以使用$payload['data']['object']['amount_due']
获取到期金额,$payload['data']['object']['id']
来获取条带发票ID。
转到https://dashboard.stripe.com/test/events,点击该活动并查看其中的活动数据。