Neel
Neel

Reputation: 9880

Laravel Cashier Webhook: Get Amount and Invoice Details

I am using Laravel 5.3 with Cashier for Stripe. I have set-up a custom controller extending the CashierController for handling Webhooks as per the Docs. In this Webhook, how can I get the amount that was charged and invoice details from $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);
     }

I want to get the following info from that:

  1. Amount
  2. Invoice Number

Upvotes: 1

Views: 891

Answers (1)

CUGreen
CUGreen

Reputation: 3186

You should be able to use $payload['data']['object']['amount_due'] to get the amount due and $payload['data']['object']['id'] to get the stripe invoice id.

Go to https://dashboard.stripe.com/test/events, click on the event and look at the Event Data there.

Upvotes: 2

Related Questions