Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#<Mollie::Exception: The amount is invalid> gem version 3,1 #179

Open
mikececco opened this issue Nov 28, 2024 · 12 comments
Open

#<Mollie::Exception: The amount is invalid> gem version 3,1 #179

mikececco opened this issue Nov 28, 2024 · 12 comments

Comments

@mikececco
Copy link

I am currently upgrading to version 3.1 and changing syntax.
The following piece of code is giving me an error about amount is invalid:
begin payment = Mollie::Payment.create( amount: { value: self.amount, (this is a string) currency: currency (this is a string) }, customer_id: customer_id,

I have other identical instance creation with identical syntax which are not having any issue.
I have also hardcoded both value and currency and still get #<Mollie::Exception: The amount is invalid>
begin payment = Mollie::Payment.create( amount: { value: '38.85', currency: 'EUR' }, customer_id: customer_id,
what am I missing?

@justincase
Copy link
Collaborator

Hi @mikececco, v4.0 is the first major version that supports the v2 API. I recommend upgrading to the latest release (v4.14.0) if you are on Ruby >= 2.5.

@mikececco
Copy link
Author

mikececco commented Nov 29, 2024 via email

@justincase
Copy link
Collaborator

It expects a different value: v3.x of the rubygem (Mollie API V1) requires amount: 10.00 while v4.x (Mollie API v2) requires amount: { value: "10.00", currency: "EUR")

@mikececco
Copy link
Author

mikececco commented Dec 1, 2024 via email

@justincase
Copy link
Collaborator

Which version of the mollie gem and Ruby are you currently using?

@mikececco
Copy link
Author

ruby: 2.5.9
mollie i am going to version 3.1.0 and adapting the syntax (thats where I get the error)

@mikececco
Copy link
Author

``Here is what it gets printed for value and currency
"38.85"
String
"GBP"
#<Mollie::Exception: The amount is invalid>
payment = Mollie::Payment.create( amount: { value: self.amount, currency: currency },

@justincase
Copy link
Collaborator

Thank you. Please upgrade to the latest version of the mollie-api-ruby gem. All v3.x versions are unusable when the Mollie API V1 is turned off on December 31st 2024.

@mikececco
Copy link
Author

mikececco commented Dec 3, 2024 via email

@mikececco
Copy link
Author

Am I getting the error because of this?

Only payment methods that support the amount/currency will be returned. Example: https://api.mollie.com/v2/methods?amount[value]=100.00&amount[currency]=USD

@mikececco
Copy link
Author

Got confirmation by upgrading to gem version 4.0.0:
#<Mollie::RequestError: 422 Unprocessable Entity: The currency is not supported by this payment method>

@justincase
Copy link
Collaborator

I know, I was going through the different versions and test it. You think i can jump directly to latest version?

It's not a drop-in replacement by any means but I reckon it shouldn't be too difficult.

Please feel free to join the Mollie Developer Community on Discord if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants