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

Expose connect account id in Stripe::StripeObject #1101

Open
ryanseys opened this issue Jul 25, 2022 · 4 comments
Open

Expose connect account id in Stripe::StripeObject #1101

ryanseys opened this issue Jul 25, 2022 · 4 comments

Comments

@ryanseys
Copy link

Is your feature request related to a problem? Please describe.

I'd like to get access to the Stripe connect account id e.g. acct_123 associated with a Stripe::StripeObject.

Currently the only way to do this through publicly accessible methods is via Stripe::StripeObject#marshal_dump like so:

stripe_object = Stripe::Treasury::ReceivedCredit.retrieve(...)

stripe_object.marshal_dump[1][:stripe_account] #=> acct_123

This is pretty clunky.

Describe the solution you'd like

Exposing a method like so would be nice:

stripe_object = Stripe::Treasury::ReceivedCredit.retrieve(...)

stripe_object.stripe_account #=> acct_123

Or even an object that wraps all those client values that we can more easily dig into:

stripe_object = Stripe::Treasury::ReceivedCredit.retrieve(...)

stripe_object.client_options.stripe_account

Could also expose api_version via a similar mechanism.

Describe alternatives you've considered

Seems like this is the only way to do this right now:

stripe_object.marshal_dump[1][:stripe_account] #=> acct_123

Additional context

No response

@ryanseys ryanseys changed the title Expose stripe_account in Stripe::StripeObject Expose connect account id in Stripe::StripeObject Jul 25, 2022
@remi-stripe
Copy link
Contributor

@ryanseys I'm not sure I follow the feature request here. To retrieve an object in the API you already have to know which account you're making the request on, either based on the API key you use or by setting the right account id acct_123 in the Stripe-Account header. Since you already have to know what account you're looking at, you shouldn't need anything else to tell you which account is associated with that object.

@remi-stripe remi-stripe self-assigned this Jul 25, 2022
@ryanseys
Copy link
Author

I agree with the sentiment, however when we're passing around these Stripe::StripeObjects in our system, we always have to pass around a reference to this connect account id separately in order to keep track of them both, otherwise we would have to do this clunky marshal dump to get access to the connect account id.

If it was easier for us to access the stripe connect account id in this object, we wouldn't need to pass around a reference to it whenever we want to pass this Stripe::StripeObject around.

I'm not saying we don't already know it, I'm just saying if it was more cleanly exposed via this SDK, it could greatly simplify some of our code and give us more confidence that we're always using the correct connect account id.

@remi-stripe
Copy link
Contributor

That's fair but the SDK is mostly exposing what is in the API and we don't expose an account property on the majority of resources today so it would be quite a substantial change. Giving a helper to access the stripe_account value could work in some cases but it would confusingly be null/empty for calls on your own account which seems subpar.

I'll keep it as a feature request to see if other developers would like to see a similar change though

@ryanseys
Copy link
Author

Sounds good! I understand if it's not feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants