amzn / amazon-pay-sdk-java

Amazon Pay Java SDK
https://pay.amazon.com/documentation
Apache License 2.0
58 stars 51 forks source link

InvalidOrderReferenceId #39

Closed yuki-naki closed 3 years ago

yuki-naki commented 3 years ago

call the API get this error from amazon

Encountered marshalling error while marshalling data ErrorResponse xmlns:http://mws.amazonservices.com/schema/OffAmazonPayments/2013-01-01 type: Sender code:InvalidOrderReferenceId message:The OrderReferenceId S03-2715707-3xxxxx is invalid RequestId: d64cde91-53b3-4252-a6eb-f90984xxxxxxxx

what i did

①At order floor use the javascript from sandbox (https://static-fe.payments-amazon.com/OffAmazonPayments/jp/sandbox/lpa/js/Widgets.js)

②use the OrderReferenceId to request onOrderReferenceCreate: function(orderReference) { orderReference.getAmazonOrderReferenceId(); //use this to request }

③building Client Config config = new PayConfig() .withSellerId("xxxxxxxxxxxx") .withAccessKey("XXXXXXXXXXXXXXXXXXXX") .withSecretKey("XXXXXXXXXXXXXXXXXXXX") .withCurrencyCode(CurrencyCode.JPY) .withRegion(Region.JP) .withSandboxMode(true)//because its test so sandboxMode use true

Client client = new PayClient(config);

④call api GetOrderReferenceDetailsRequest req = new GetOrderReferenceDetailsRequest(amazonPayOrderReferenceId); //optional parameters req.setSellerId(config.getSellerId()); req.setAddressConsentToken(amazonPayToken); //call api GetOrderReferenceDetailsResponseData response = client.getOrderReferenceDetails(req);