#accua

1 messages · Page 1 of 1 (latest)

rose palmBOT
ocean canyon
#

Hello! What version of the Stripe Ruby library are you using? What version of Ruby are you using?

mystic hemlock
#

stripe gem: 8.5.0
ruby: 3.2.0

ocean canyon
#

Hm. Does Stripe::Balance.retrieve() work?

mystic hemlock
#

passing in the same id

#

?

ocean canyon
#

No, this method doesn't take an argument.

mystic hemlock
#

it looks like it returned a json object, but it also gave an error: Read: #<NoMethodError: undefined method `bytesize' for [:object, "balance"]:Array>

#

and the ui is reporting this

ocean canyon
#

It's reporting that for the balance retrieve or for your original code? Or both?

mystic hemlock
#

balance retrieve

ocean canyon
#

Okay, looks like you're trying to use an account ID for your API key.

#

When initializing the Ruby library you need to specify your API key (starts with sk_ for "secret key"), not your account ID (starts with acct_).

mystic hemlock
#

that.. doesn't make sense. 🤔 I've set the Stripe.api_key = "sk_test_XXXXXXXXXXXXXX..."

ocean canyon
#

Can you share all of your Stripe code, but with the API key redacted?

mystic hemlock
#

require 'sinatra'
require 'stripe'
require 'pry'

This is your test secret API key.

Stripe.api_key = 'sk_test_XXXX'

set :port, 5000
enable :sessions
set :static, true
set :public_folder, File.join(File.dirname(FILE), "/public")

get '/get_account' do
p Stripe::Balance.retrieve
end

rose palmBOT
ocean canyon
#

Hm. Maybe there's some obscure Ruby-specific thing happening here. I'm not the best with Ruby; @open widget do you have thoughts on the above?

open widget
#

I'm not overly familiar with Ruby nuances either, but it does seem like something is interfering with your API key there. That error message doesn't really make sense with an account ID as an invalid key

mystic hemlock
#

agreed

open widget
#

Can you try running the basic balance retrieve without the sinatra setup involved?

require 'stripe'
Stripe.api_key = 'sk_test_123'

Stripe::Balance.retrieve()
mystic hemlock
#

this works, it's gotta be a sinatra issue. Thank you.

open widget
#

NP - hopefully you're able to find out where thats coming from! Let us know if it turns out to be something you think we can improve in the SDK here