Google Wallet Subscriptions Error 500

三世轮回 提交于 2019-12-11 04:31:21

问题


i have implemented the Subscriptions flow using the java library jsontoken, but am getting an error 500. happen in the sandox and production. any idea why it is?

this is the error :

POST https://checkout.google.com/inapp/api/v1/purchase_options 500 (Internal Server Error)

this is the code:

Calendar cal = Calendar.getInstance();
HmacSHA256Signer signer = new HmacSHA256Signer(ISSUER, null, SIGNING_KEY.getBytes());

JsonToken token = new JsonToken(signer);
token.setAudience("Google");
token.setParam("typ", "google/payments/inapp/subscription/v1");
token.setIssuedAt(new Instant(cal.getTimeInMillis()));
token.setExpiration(new Instant(cal.getTimeInMillis() + 60000L));

long prorated =cal.getTimeInMillis() + 2592000000L;

JsonObject request = new JsonObject();
      request.addProperty("name", "Piece of Cake");
      request.addProperty("description", "Virtual chocolate cake to fill your virtual tummy");
      request.addProperty("sellerData", "user_id:1224245,offer_code:3098576987,affiliate:aksdfbovu9j");
      request.addProperty("initialPayment", "{\"price\" : \"1.49\",\"currencyCode\" : \"USD\",\"paymentType\" : \"prorated\",}");
      request.addProperty("recurrence", "{\"price\" : \"4.99\",\"currencyCode\" : \"USD\",\"startTime\" : \""+prorated+"\",\"frequency\" : \"monthly\",\"numRecurrences\" : \"12\",}");

 JsonObject payload = token.getPayloadAsJsonObject();
      payload.add("request", request);
 token.serializeAndSign();

来源:https://stackoverflow.com/questions/17177649/google-wallet-subscriptions-error-500

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!