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

setOrderReferenceDetails error #1

Closed
360disrupt opened this issue May 5, 2015 · 4 comments
Closed

setOrderReferenceDetails error #1

360disrupt opened this issue May 5, 2015 · 4 comments

Comments

@360disrupt
Copy link
Contributor

Sorry if the issue might be with Amazon but the error messages are quite unspecific.

  1. Created an account at sellar central -> got all the credentials
  2. Added a Login Button, this Button forwards my user to a page step2
  3. On the page step2, I retrieve the an orderReferenceID like this "S02-1474679-9811941"
  4. I call the method and pass the required variables for setOrderReferenceDetails
  • AmazonOrderReferenceId
  • OrderReferenceAttributes.OrderTotal
exports.processPaymentAmazon = (db, orderReferenceId, amount, callback) ->
  payment.offAmazonPayments.setOrderReferenceDetails({
    AmazonOrderReferenceId: orderReferenceId
    OrderReferenceAttributes: {
      OrderTotal: amount
    }
  }, (err) ->
    if err
      return callback err, false
    else
      return callback null, true
  )
  return

I get the error msg:

{"err":{"type":"AccessDenied","name":"AccessDenied","body":{"ErrorResponse":{"$":{"xmlns":"http://mws.amazonservices.com/schema/OffAmazonPayments/2013-01-01"},"Error":{"Type":"Sender","Code":"AccessDenied","Message":"Access denied"},"RequestID":"20aca75b-4fea-42ea-be69-c70b351be9f2"}}}}

Would be awesome to get some advice. I would be also willing to hire you on codementor e.g to solve the issue because I'm going nuts with that integration.

@scottspork
Copy link
Member

According to the documentation for OrderTotal, the data type needs both amount and currency code, e.g.:

{
  AmazonOrderReferenceId: orderReferenceId
  OrderReferenceAttributes: {
    OrderTotal: {
      Amount: amount,
      CurrencyCode: 'USD'
    }
  }
}

@360disrupt
Copy link
Contributor Author

Thanks, I missed that unfortunately I still get the same response. When copying the data from my source code to https://mws.amazonservices.de/scratchpad/index.html
it seems to work with the params passed. The only thing I didn't add in the scratchpad was the clientid.

You have a running code example that you could send me on geissinger ät autofokus-marketing.de or upload in an example dir?

@360disrupt
Copy link
Contributor Author

I haven't looked to deep into the request module. But I logged out params shortly before the request:

{"AmazonOrderReferenceId":"S02-3564099-4627607","OrderReferenceAttributes.OrderTotal":100,"OrderReferenceAttributes.CurrencyCode":"EUR","AWSAccessKeyId":"AKIAJY75FDYZC4VVDRSA","Action":"SetOrderReferenceDetails","SellerId":"A3PJMS5WFYSRB4","Timestamp":"2015-05-06T11:36:42z","Version":"2013-01-01","SignatureMethod":"HmacSHA256","SignatureVersion":"2","Signature":"gO3BcZhiCMW2qwbgxJNa/IkmL/6DkWDj2vpL47au1cw="}

This is the request of the scratchpad

POST
mws.amazonservices.de
/OffAmazonPayments_Sandbox/2013-01-01
AWSAccessKeyId=AKIAJY75FDYZC4VVDRSA&Action=SetOrderReferenceDetails&AmazonOrderReferenceId=S02-3564099-4627607&OrderReferenceAttributes.OrderTotal.Amount=100&OrderReferenceAttributes.OrderTotal.CurrencyCode=EUR&SellerId=A3PJMS5WFYSRB4&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-05-06T12%3A02%3A11Z&Version=2013-01-01

I noticed a few differences but I don't know if they are relevant. The - in the Version & in the order reference id is another one than in the Scratchpad POST. This could be correlated to console.log & JSON.stringify.

The timestamp in the scratchpad is formated differently, this maybe done by request module?

Also I read somewhere in the docs that the params have to be in alphabetical order, or is this just relevant for the signing string?

@360disrupt
Copy link
Contributor Author

Created a pull request, the problem is related to differences in the US and EU url.

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