0

Ich habe damit seit ein paar Tagen gekämpft. Ich erstelle eine App, die In-App-Abo-Käufe unterstützt.Xamarin Forms (Android) - Upgrade und Downgrade-Abonnements

Ich habe die folgenden Pakete versucht:

-Xamarin.InAppBilling (Component)

-Plugin.InAppBilling (Nuget - beta)

-Android Verlag Service (Nuget)

Aber keiner von ihnen unterstützt Upgrades/Downgrades von Abonnements.

Gibt es Pakete, die Abonnements vollständig unterstützen?

Antwort

0

Wir hatten ein ähnliches Problem. Diese Pakete unterstützen nur getBuyIntent. getBuyIntent unterstützt kein Upgrade und Downgrade von Abonnements. Die Methode getBuyIntentExtraParams unterstützt dies. Mit dieser Methode können Sie angeben, welche früheren Abonnements der Benutzer mit dem Parameter skusToReplace aktualisiert oder heruntergestuft hat.

anzeigen Google Text & Tabellen für Details: https://developer.android.com/google/play/billing/billing_reference.html

Die getBuyIntentExtraParams Methode in diesen Paketen nicht verfügbar ist, aber man kann die Methode in der AIDL Datei des Plug-in hinzuzufügen.

Die AIDL Datei des Xamarin.InAppBilling Paket: https://github.com/hauptmedia/xamarin-inappbilling/blob/master/Droid/aidl/IInAppBillingService.aidl

Sie können die AIDL Datei herunterladen und die getBuyIntentExtraParams Methode zum AIDL Datei anhängen. Fügen Sie Ihrem Android-Projekt die aidl-Datei hinzu und verwenden Sie sie anstelle des Plugins.

Verfahren Definition:

/** 
    * 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);