Handling failed one of charges with cashier/spark
I have subscriptions using Spark which works great.
However there a also one off payments which need to happen occasionally for certain user actions.
For this I am using the Cashier invoiceFor method as per the docs below to generate the charge and invoice.
$user->invoiceFor('One Time Fee', 500, [
'description' => 'your invoice description here',
]);
However this notice from the docs has stumped me:
"The invoiceFor method will create a Stripe invoice which will retry failed billing attempts. If you do not want invoices to retry failed charges, you will need to close them using the Stripe API after the first failed charge."
If the charge fails an exception is thrown with the "Your card was declined" message which is fine. However how can I then find the Invoice ID for me then to retrieve and close as per the docs?
Please or to participate in this conversation.