question

stephenwqd avatar image
stephenwqd asked

RVS problem

Hi, amazon develop team: Now I have set up the sandbox environment for RVS. When I enter " http://localhost:8080/RVSSandbox/version/2.0/verify/developer/(hide for safe)/user/DefaultTestUser/purchaseToken/0eXBlIjoiQ09OU1VNQUJMRSIsInNrdSI6ImNvbS5nb2cuZ2Vtc3BhY2s4NTAifQ" into the browser, I get: {"endDate":null,"itemType":"CONSUMABLE","sku":"com.ggg.gemspack850","startDate":null,"purchaseToken":"0eXBlIjoiQ09OU1VNQUJMRSIsInNrdSI6ImNvbS5nb2cuZ2Vtc3BhY2s4NTAifQ"} But when I request this link by java code, i get "404" My post java code: final URL url = new URL(amazonUrlStrSandvox); //final HttpURLConnection conn = (HttpsURLConnection) url.openConnection(); final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoOutput(true); //conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Content-Type", "application/x-amz-json-1.0"); //conn.setRequestProperty("Accept", "application/json"); conn.setRequestProperty("Accept", "application/x-amz-json-1.0"); //conn.setRequestProperty("Accept-Charset", "UTF-8"); // Get the response final BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line = ""; while ((line = rd.readLine()) != null) { //System.out.println(line); allline = allline + line; } //wr.close(); rd.close(); I think my java code is not right, maybe some properties not set, or maybe purchaseToken not based on 64 bit. I have no idea, I refer this link: https://developer.amazon.com/public/zh/apis/earn/in-app-purchasing/docs/rvs Can you tell me how to get the right response ???
iap
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Thank you for reaching out. Since you are passing all the required parameters as a GET request though the url, you need to set the request method as "POST". You therefore need to remove below line from your HTTP client code
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.