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

Extra info from StripeSubscription #1102

Closed
impeto opened this issue Mar 16, 2021 · 2 comments
Closed

Extra info from StripeSubscription #1102

impeto opened this issue Mar 16, 2021 · 2 comments

Comments

@impeto
Copy link

impeto commented Mar 16, 2021

I'm working on an app where I have to save the current_period_start and current_period_end after I create a StripeSubscription. Right now I do it by calling Subscription::asStripeSubscription() after SubscriptionBuilder::create() and pulling the info I need from there. However that is another call to the Stripe API and I'm thinking it could be avoided by allowing the extraction of extra info after the first API call. Perhaps a Closure that would take in the new StripeSubscription object and would return an array, which then can be merged with the other info before the Subscription is persisted to the database...?

I'm not sure what the best solution would be or even if this is needed all that often, being that this is my first project that requires it.

@driesvints
Copy link
Member

Hi there. At the moment we aren't considering adding these database columns to Cashier. I'm afraid retrieving them from Stripe is the only way. You could overwrite the Cashier models if you want (see the docs) or consider implementing caching.

@impeto
Copy link
Author

impeto commented Mar 16, 2021

I understand, but that is not what I was asking. I already created all the extra columns I need. I was talking about a mechanism that would allow me to tap into the newly created Stripe Subscription, inside the SubscriptionBuilder::create() method, to avoid making an extra Stripe API call. No worries though. Thanks.

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

No branches or pull requests

2 participants