Remit::Pay::Response Invalid Amount
Closed this issue · 2 comments
I'm trying to write a rails example app so people can get an idea of how to use remit with rails and define some best practices(https://github.com/masonforest/remit_rails_example). I have gotten though the cobranded UI but I am getting an error with my pay request.
Here is a dump of the response
"#<Remit::Pay::Response:0x2505ad0 @response_metadata=#<Remit::ResponseMetadata:0x24e5780 @parser=#<Relax::Parsers::Hpricot:0x24e571c @parameters={:request_id=>{}, :signature_version=>{}, :signature_method=>{}}, @parent=#<Remit::ResponseMetadata:0x24e5780 ...>, @xml=#<Hpricot::Doc>>, @raw=nil>, @errors=[#<Remit::Error:0x24e0a50 @code=\"InvalidParams\", @message=\"Invalid Amount\", @parser=#<Relax::Parsers::Hpricot:0x24e0a28 @parameters={:code=>{:element=>\"Code\"}, :message=>{:element=>\"Message\"}}, @parent=#<Remit::Error:0x24e0a50 ...>, @xml=#<Hpricot::Doc {elem <Error> {elem <Code> \"InvalidParams\" </Code>} {elem <Message> \"Invalid Amount\" </Message>} </Error>}>>, @raw=<Error> ... </>>], @parser=#<Relax::Parsers::REXML:0x25058f0 @parameters={:pay_result=>{:type=>Remit::TransactionResponse, :element=>\"PayResult\"}, :response_metadata=>{:type=>Remit::ResponseMetadata, :required=>true, :element=>\"ResponseMetadata\"}}, @parent=#<Remit::Pay::Response:0x2505ad0 ...>, @xml=<UNDEFINED> ... </>>, @pay_result=#<Remit::TransactionResponse:0x24e78f0 @parser=#<Relax::Parsers::Hpricot:0x24e774c @parameters={:transaction_id=>{:element=>\"TransactionId\"}, :transaction_status=>{:element=>\"TransactionStatus\"}}, @parent=#<Remit::TransactionResponse:0x24e78f0 ...>, @xml=#<Hpricot::Doc>>, @raw=nil>, @raw=\"<?xml version=\\\"1.0\\\"?>\\n<Response><Errors><Error><Code>InvalidParams</Code><Message>Invalid Amount</Message></Error></Errors><RequestID>9145d09e-3854-4e5d-9615-33626b198b0c</RequestID></Response>\">"
Sad to see this issue has been open for 25+ days and none of the authors or people who have worked on the project took the time to help masonforest. I began working with the Remit gem last night and ran into the same issue that mason was having. After a bunch of head scratching, I found that the reason is that you need to use value instead of amount. In your fps_pay method you had: :transaction_amount => Remit::RequestTypes::Amount.new(:currency_code => 'USD', :amount => amount),
It should be: :transaction_amount => Remit::RequestTypes::Amount.new(:currency_code => 'USD', :value => amount), and then it works like charm.
p.s. I really appreciate what your doing here. The remit gem has terrible documentation and not much else to try to help me understand how to use it. If you can continue with your remit_rails_example project it would be a great help to people like me who are trying to make it work with Amazon FPS.
Thanks,
Jason
The remit gem has no authors or maintainers who actively use it. I do my best to pull in patches, and help out where my experience applies, but I have only used a fraction of the FPS API. If you would like to contribute to the documentation please message Tyler Hunt.
Since this is a usage / documentation issue I am closing this bug.