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

"Required object 'amount' is not provided." - Got this error by hitting the refund() #168

Closed
viveknegi111 opened this issue Aug 25, 2023 · 1 comment

Comments

@viveknegi111
Copy link

Describe the bug
Got this error - response = { "status"=>422, "errorCode"=>"100", "message"=>"Required object 'amount' is not provided.",
"errorType"=>"validation" }
by hitting the AdyenClient.new.payments.refund(input1, input2)

How to reproduce
Steps to reproduce the behavior.
a) initializing first:
adyen_client = Adyen::Client.new.tap do |_adyen|
_adyen.api_key = "some value"
_adyen.env = :live
_adyen.live_url_prefix = "some value"
_adyen.checkout.version = 68
end
b) By hitting this adyen_client.payments.refund(input1, input2) where

input1 = {
  'amount': {
    'value': 456,
    'currency': "USD"
  },
  'reference': "some value1",
  'merchantAccount': "some value2"
}

input2 =   {"paymentPspReference": "some value3"}

I got the above mentioned error. Please check . Is something missing here from my end in passing parameters?

Expected behavior
No idea about the response as hitting the API gives error.

Screenshots

Screenshot 2023-08-25 at 8 16 26 PM

Desktop (please complete the following information):

  • ruby Version: [x.y.z] - 2.7.4
  • Library Version: [x.y.z] - gem 'adyen-ruby-api-library', '~> 6.2'

Additional context
None

@MuhammadIbtisam
Copy link

Hello @viveknegi111 please use "modificationAmount" in your input1 params instead of "amount".
Proper Request Format:
{
"merchantAccount": "TestMerchant",
"originalReference": "8123456789012345",
"modificationAmount": {
"value": 2000,
"currency": "EUR"
}
}

as format specified in the spec/mocks/requests/Payment/refund.json

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

3 participants