Use sendInvoice() when collection method is 'send_invoice' #935
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In some edge cases (like mine) we have clients that can't use a credit card, but we still want to have all the data in Stripe. So we create a subscription with collection_method = 'send_invoice' and the manually sent the invoices to be paid, once we received payment we just change the status manually in Stripe.
When you use this collection method you can't apply
$stripeInvoice->pay()
function, you need to use the$stripeInvoice->sendInvoice();
When using the
$stripeInvoice->pay()
on when a colletion_method is 'send_invoice' it throws PaymentFailure, 'send_invoice' it doesn't require a payment method.The only two options in 'collection_methods' are charge_automatically (default) or 'send_invoice' therefore using a simple if-else statement.
https://stripe.com/docs/api/invoices/create#create_invoice-collection_method