#Wik

1 messages ยท Page 1 of 1 (latest)

gusty grailBOT
atomic musk
tribal flame
#
Stripe::AuthenticationError: 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.
atomic musk
#

Try then Authenticate the Client:

Stripe.api_key = user.stripe_key
Stripe::Invoice.mark_uncollectible(invoice_id)
tribal flame
#

This works, but I wanted to do it in one call or understand why it's not possible ๐Ÿ™‚

#

It's been driving me mad all morning

atomic musk
#

Let me do some tests..

tribal flame
#

๐Ÿ™

atomic musk
#

Try this:

Stripe::Invoice.mark_uncollectible(invoice_id, {},{
    api_key: user.stripe_key,
  })
tribal flame
#

testing

#

It works, thank you! However, why does it have to be in this format? It was not obvious for me looking at the method definition in GH def mark_uncollectible(params = {}, opts = {})

atomic musk
#

because that method can take params as the method definition shows. API key need to be sent in the options opts

tribal flame
#

thank you for your help!

atomic musk
#

Welcome!