Reputation: 4361
Going from version 2.9.3 -> 2.18.0 for the ruby gem. Have been using v4 for Recurly.js so that stays the same.
This has been working for years and I decided to upgrade the gem.
I am generating the front end token with:
recurly.configure({ publicKey: RECURLY_JS_PUBLIC_KEY })
It generates a token and pass it along to the backend where we do:
Recurly::Account.create!(
account_code: account_code,
billing_info: { token_id: params['recurly-token'] }
)
It keeps raising this error:
Recurly::Resource::Invalid (billing_info is invalid)
I've been messing around with this a lot. Putting in a random string as the token or waiting 20 minutes for the token to expire will throw a different error message:
Recurly::Resource::Invalid: Token (billing_info.token_id) is either invalid or expired
So I feel like it is reading my token correctly and the keys are correct. Could it be that maybe the billing info that I used to generate the token be bad? I've filled out so many different combinations of correct addresses and test credit card numbers.
I'm out of ideas and any help would be nice.
Upvotes: 0
Views: 195
Reputation: 4361
Figured out the issue.
There was a problem with the country input. Originally the ISO alpha-2 code
worked for the country. But once I updated the gem, the ISO alpha-2 code
no longer worked. The front end validation would work and it would create a token fine but the backend would not accept that token.
So using US
did not work anymore but United States
worked.
I ended up building a dropdown from this list: https://docs.recurly.com/docs/countries-provinces-and-states
Upvotes: 0
Reputation: 1804
It does sound like the actual billing information might be bad. Are you using the correct test card number (4111-1111-1111-1111) with an expiration date in the future, and all the address information required by your site settings?
Upvotes: 0