title: Why should the nonce for Android in-app billing generated on the server?
body: <p><a href="http://developer.android.com/google/play/billing/billing_best_practices.html" rel="nofollow">http://developer.android.com/google/play/billing/billing_best_practices.html</a></p>
  
  <p>As the best practices documentation suggests, I want my server to perform signature verification tasks for in-app billing. which brings me to this clause about nonces:</p>
  
  <blockquote>
    <p>Also, if you are performing nonce verification on a server, make sure that you generate the nonces on the server.</p>
  </blockquote>
  
  <p>I know that the nonce i pass in with the purchase request will come back as part of the purchase data under <code>developerPayload</code> for extra verification. Is it not enough for the client to generate a unique nonce using SecureRandom? - since I will pass the purchase data back to the server for verification anyway, it will store the client-generated nonces as well to filter out replay attacks.</p>
  
  <p>Why do I have to "make sure" that nonces are generated on the server? It just seems to complicate process because now the app needs to request a nonce from the server before any in-app purchase.</p>
  
  <p>The only extremely unlikely situation I can think of that it may be useful is to prevent instances when SecureRandom on the client generates a nonce that has already been used on the server. Even then isn't such situation easily identified by cross checking with <code>orderId</code>, which should be unique itself anyway?</p>