Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0] Fixing defaultCard() exception when not Stripe customer #660

Merged
merged 3 commits into from
May 3, 2019
Merged

[9.0] Fixing defaultCard() exception when not Stripe customer #660

merged 3 commits into from
May 3, 2019

Conversation

judahnator
Copy link
Contributor

Hello Laravel Team!

Summary:

This pull request addresses an issue where the defaultCard() method on the billable trait would throw an exception if the model was not created as a stripe customer.

Expected:

Calling the defaultCard() method will return null if the user has no card on file, even when the billable model is not set up as a Stripe customer.

Actual:

An exception is thrown:
Stripe\Error\InvalidRequest: Could not determine which URL to request: Stripe\Customer instance has invalid ID: .

Fix:

Checking to make sure that the billable model has a stripe ID before attempting to retrieve the model as a stripe customer, so we are not sending the Stripe PHP library invalid data.

@driesvints driesvints changed the title Fixing defaultCard() exception when not Stripe customer [9.0] Fixing defaultCard() exception when not Stripe customer May 2, 2019
@taylorotwell taylorotwell merged commit 822b653 into laravel:9.0 May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants