#mkoenke - Retrieve Charge

1 messages · Page 1 of 1 (latest)

pseudo flax
#

What library/language are you using?

floral viper
#

ruby/rails

pseudo flax
#

It appears to be Ruby so in that case you would move the assignment of the API key outside your request like this:

require 'stripe'
Stripe.api_key = 'sk_test_XXXXX'

Stripe::Charge.retrieve(
  'ch_XXXXXXX',
)
floral viper
#

we have to pass the api_key bc we have a more than one stripe account

pseudo flax
#

You don't because you can't. You can re-assign the API key as part of a function but it needs to be assigned as shown prior to making the call.

#

OOooopps. Spoke too soon

floral viper
#

ahhhh so you can't pass it in the way you can for Stripe::PaymentMethod.retrieve

pseudo flax
#

You just need to separate it out

floral viper
#

thanks for the reference! That works, but it doesnt work if I use expand: ['transfer.destination_payment']

pseudo flax
#

Can you share the entire snippet of how you are making the request?

floral viper
#

this is how we used to do it:
def self.execute(stripe_charge_id) response = Stripe::Charge.retrieve( { id: stripe_charge_id, expand: ['transfer.destination_payment'], }, )

#

but now I need to add in the api_key and stripe_account

pseudo flax
#

So this is a Connect Charge? On another Stripe Account?

floral viper
#

standard connect

pseudo flax
#

Okay so, after the first set of braces, try adding the api_key and stripe_account parameters in their own set of curly braces

floral viper
#

woohooo

#

that worked! thanks so much!!