我一直在爲此奮鬥了幾天。我正在製作一款需要支持應用內訂閱購買的應用。Xamarin表單(Android) - 升級和降級訂閱
我曾嘗試以下軟件包:
-Xamarin.InAppBilling(組件)
-Plugin.InAppBilling(的NuGet - β)
-Android發佈服務(的NuGet)
但他們都不支持升級/降級訂閱。
是否有任何軟件包完全支持訂閱?
我一直在爲此奮鬥了幾天。我正在製作一款需要支持應用內訂閱購買的應用。Xamarin表單(Android) - 升級和降級訂閱
我曾嘗試以下軟件包:
-Xamarin.InAppBilling(組件)
-Plugin.InAppBilling(的NuGet - β)
-Android發佈服務(的NuGet)
但他們都不支持升級/降級訂閱。
是否有任何軟件包完全支持訂閱?
我們有類似的問題。這些軟件包僅支持getBuyIntent。 getBuyIntent不支持升級和降級訂閱。 getBuyIntentExtraParams方法確實支持這一點。使用此方法,您可以使用skusToReplace參數指定用戶正在升級或降級哪些以前的訂閱。
查看谷歌文檔的詳細信息: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文件,並追加getBuyIntentExtraParams方法的AIDL文件。將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);