0

私はこれを数日間苦労してきました。私はアプリ内購読購入をサポートする必要があるアプリを作っています。 ( - ベータNuget)Xamarinフォーム(Android) - アップグレードとダウングレードサブスクリプション

-Androidパブリッシャー・サービス(Nuget)

-Xamarin.InAppBilling(コンポーネント)

-Plugin.InAppBilling:

私は以下のパッケージを試してみましたしかし、いずれもサブスクリプションのアップグレード/ダウングレードをサポートしていません。

サブスクリプションを完全にサポートするパッケージはありますか?

答えて

0

同様の問題がありました。これらのパッケージはgetBuyIntentのみをサポートします。 getBuyIntentはサブスクリプションのアップグレードとダウングレードをサポートしていません。メソッドgetBuyIntentExtraParamsはこれをサポートしています。このメソッドを使用すると、skusToReplaceパラメーターを使用して、ユーザーがアップグレードまたはダウングレードしている以前のサブスクリプションを指定できます。

詳細については、Googleドキュメントを参照してください:https://developer.android.com/google/play/billing/billing_reference.html

getBuyIntentExtraParams方法は、これらのパッケージでは利用できませんが、プラグインのAIDLファイルにメソッドを追加することができます。

Xamarin.InAppBillingパッケージのAIDLファイル:https://github.com/hauptmedia/xamarin-inappbilling/blob/master/Droid/aidl/IInAppBillingService.aidl

あなたはAIDLファイルをダウンロードし、AIDLファイルにgetBuyIntentExtraParamsメソッドを追加することができます。 aidlファイルをAndroidプロジェクトに追加し、プラグインの代わりに使用します。

メソッド定義:

/** 
    * Returns a pending intent to launch the purchase flow for an in-app item. This method is 
    * a variant of the {@link #getBuyIntent} method and takes an additional {@code extraParams} 
    * parameter. This parameter is a Bundle of optional keys and values that affect the 
    * operation of the method. 
    * @param apiVersion billing API version that the app is using, must be 6 or later 
    * @param packageName package name of the calling app 
    * @param sku the SKU of the in-app item as published in the developer console 
    * @param type of the in-app item being purchased ("inapp" for one-time purchases 
    *  and "subs" for subscriptions) 
    * @param developerPayload optional argument to be sent back with the purchase information 
    * @extraParams a Bundle with the following optional keys: 
    *  "skusToReplace" - List<String> - an optional list of SKUs that the user is 
    *       upgrading or downgrading from. 
    *       Pass this field if the purchase is upgrading or downgrading 
    *       existing subscriptions. 
    *       The specified SKUs are replaced with the SKUs that the user is 
    *       purchasing. Google Play replaces the specified SKUs at the start of 
    *       the next billing cycle. 
    * "replaceSkusProration" - Boolean - whether the user should be credited for any unused 
    *       subscription time on the SKUs they are upgrading or downgrading. 
    *       If you set this field to true, Google Play swaps out the old SKUs 
    *       and credits the user with the unused value of their subscription 
    *       time on a pro-rated basis. 
    *       Google Play applies this credit to the new subscription, and does 
    *       not begin billing the user for the new subscription until after 
    *       the credit is used up. 
    *       If you set this field to false, the user does not receive credit for 
    *       any unused subscription time and the recurrence date does not 
    *       change. 
    *       Default value is true. Ignored if you do not pass skusToReplace. 
    *   "accountId" - String - an optional obfuscated string that is uniquely 
    *       associated with the user's account in your app. 
    *       If you pass this value, Google Play can use it to detect irregular 
    *       activity, such as many devices making purchases on the same 
    *       account in a short period of time. 
    *       Do not use the developer ID or the user's Google ID for this field. 
    *       In addition, this field should not contain the user's ID in 
    *       cleartext. 
    *       We recommend that you use a one-way hash to generate a string from 
    *       the user's ID, and store the hashed string in this field. 
    *     "vr" - Boolean - an optional flag indicating whether the returned intent 
    *       should start a VR purchase flow. The apiVersion must also be 7 or 
    *       later to use this flag. 
    */ 
    Bundle getBuyIntentExtraParams(int apiVersion, String packageName, String sku, 
     String type, String developerPayload, in Bundle extraParams); 
関連する問題