2

私はこの概念を日曜日から6つの方法でグーグルで見つけました。私はそれに対してまっすぐ答えを見つけることができないように感じます。ドキュメントからアプリ内課金デベロッパーのペイロード引数?

など、official Google docsは、それがセキュリティのために意図されていないと言うが、その後、私は見つけるの答えの束は、そうでない場合は暗示するように見える:

5番目の引数は、「開発者のペイロード」という文字列が含まれています 注文に関する補足情報を送信するために使用できます( 空文字列)。文字列の値を指定すると、Google Playは購入応答と共にこの 文字列を返します。その後、 でこの購入についての問い合わせを行うと、Google Playはこの文字列を購入の詳細とともに に返します。

注意:security validation の目的で、developerPayloadフィールドを使用しないでください。アプリ内課金に関連するタスク を完了すると、このフィールドは常に利用できるとは限りません。セキュリティに関するベストプラクティスの詳細については、アプリ内課金のセキュリティとデザインのガイドをご覧ください。 私はこれが何を意味するのか全く見当がつかない

/** Verifies the developer payload of a purchase. */ 
boolean verifyDeveloperPayload(Purchase p) { 
    String payload = p.getDeveloperPayload(); 

    /* 
    * TODO: verify that the developer payload of the purchase is correct. It will be 
    * the same one that you sent when initiating the purchase. 
    * 
    * WARNING: Locally generating a random string when starting a purchase and 
    * verifying it here might seem like a good approach, but this will fail in the 
    * case where the user purchases an item on one device and then uses your app on 
    * a different device, because on the other device you will not have access to the 
    * random string you originally generated. 
    * 
    * So a good developer payload has these characteristics: 
    * 
    * 1. If two different users purchase an item, the payload is different between them, 
    * so that one user's purchase can't be replayed to another user. 
    * 
    * 2. The payload must be such that you can verify it even when the app wasn't the 
    * one who initiated the purchase flow (so that items purchased by the user on 
    * one device work on other devices owned by the user). 
    * 
    * Using your own server to store and verify developer payloads across app 
    * installations is recommended. 
    */ 

    return true; 
} 

:Googleの公式テストプロジェクトから

。自分のサーバーがない場合は、空の文字列を使用するだけですか?ユーザーと購入とデバイスを区別するにはどうすればよいですか?

これは私には明白ではなく、このコード/公式ドキュメントは実際の説明を提供しておらず、ほとんどのオンライン回答は同様に疎です。

誰でもレイアウトすることができます:開発者ペイロード引数として何を送信する必要がありますか?

+0

私は開発者の文字列を設定するかどうかにかかわらず同じジレンマにいましたが、それは良いよりも害を及ぼし、実際にアプリケーションにセキュリティを追加しないことも分かりました。だから、この時間を無駄にしないでください。 –

答えて

0

少なくとも、ランダムな文字列を生成するセキュリティ上の理由があります.2つの異なるpurchasePayloadでの同じ購入では、常に異なる購入データと署名があります。

String developerPayload = UUID.randomUUID().toString(); 

サーバー上で回答を処理しない場合は、この文字列を覚えてチェックする理由はありません(googleテストの警告を参照)。

関連する問題