#mkoenke - Retrieve Charge
1 messages · Page 1 of 1 (latest)
ruby/rails
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',
)
we have to pass the api_key bc we have a more than one stripe account
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
ahhhh so you can't pass it in the way you can for Stripe::PaymentMethod.retrieve
thanks for the reference! That works, but it doesnt work if I use expand: ['transfer.destination_payment']
Can you share the entire snippet of how you are making the request?
You have to change the syntax a little bit when using Expand w/ Ruby, as shown here: https://stripe.com/docs/api/expanding_objects?lang=ruby
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
So this is a Connect Charge? On another Stripe Account?
standard connect
Okay so, after the first set of braces, try adding the api_key and stripe_account parameters in their own set of curly braces