spreedly / spreedly-gem

A convenient Ruby wrapper for the Spreedly API.
MIT License
108 stars 86 forks source link

store_on_gateway - This API call cannot be made with a publishable API key #106

Closed scottbarrow closed 3 years ago

scottbarrow commented 3 years ago

I have a Spreedly token that I want to store on the gateway (Stripe). When I call store_on_gateway(my_spreedly_provided_stripe_gateway_token, my_spreedly_provided_payment_method_token) I receive

#<Spreedly::Store:0x00007f82c26e6148
...
@message="This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys."

According to the documentation the POST api call expects to receive "The token of the gateway to execute against" and "transaction | Root element ❯ payment_method_token required | The token of the payment method to copy to the gateway" https://docs.spreedly.com/reference/api/v1/#store

looking on spreedly logs, I see the error returned from the Stripe API is {\n \"error\": {\n \"code\": \"secret_key_required\",\n

However the endpoint doesn't seem to accept a secret key?

Are you able to give me any insights if I am using incorrect tokens or if the gem has a bug? Thanks

scottbarrow commented 3 years ago

my bad using the publishable stripe api key instead of the secret