#rmoura-api-key
1 messages ยท Page 1 of 1 (latest)
hello, what language are you using? Also why would you want to only do that on a particular endpoint? Shouldn't you just be setting it once, as the Platform's API key
I'm using Ruby. The platform that I'm developing adopted a method of requesting the users for their secret key and then would change the API key depending on the action. We are now trying to implement the Stripe connect method but still keeping that old method (for convenience to the users that already set up Stripe before). In order to keep from changing the Stripe.api_key property, this pre-request API key would really come in handy.
gotcha, the link you sent, that shows an example right
require 'stripe'
charge = Stripe::Charge.retrieve(
'ch_3JcehN2eZvKYlo2C1IleuGd9',
{
api_key: 'sk_test_4eC3rjtT1zdp7dc',
}
)
how you pass api_key in the options hash
Stripe::Account.retrieve({ api_key: stripe.prop('account_secret_key') })
It gives me an error about the argument. It seems that retrieve doenst support the argument options (hash).
I think you want an empty hash ({}, { api_key: ...})
then the options hash
๐ฎ
or rather, the first param being the Account ID you're fetching so something like the above snippet which has the Charge ID as the first param
๐ Just hopping in for @tall drift since they had to go - have you got it figured out, or is it still not working?
Can I do the same with Stripe::WebhookEndpoint.list({limit: 3})???
like specify the api_key
Yup! You should be able to
unarchived in case you need it @runic plover
Im doing this Stripe::WebhookEndpoint.list(limit: 100, metadata: { api_key: payment_method.prop('account_secret_key') })
But a exception is caught No API key provided. Set your API key using "Stripe.api_key = <API-KEY>". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions.
why are you setting it as metadata?
what should I set? The documentation is really good but this part of listing a webhook only mentions these options
You want to do this:
Stripe::WebhookEndpoint.list({limit: 100}, { api_key:payment_method.prop('account_secret_key')})