Cross-platform In App Billing Plugin for .NET
翻译准备中
开发工具GitHub @jamesmontemagno自行安装运营者未确认
试用过了吗? 点一下就好,无需登录。
尚未收集仓库信息。
尚未检测到更新。GitHub 发布版本后会显示在这里。
制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗Project status: Android and Windows are actively maintained and track the current Google Play Billing Library and Microsoft Store APIs. iOS and Mac Catalyst use StoreKit 2, while native macOS still uses the original StoreKit APIs. Contributions are welcome, and you can always fork the library or pull the source into your project.
A simple In-App Purchase plugin for .NET MAUI and Windows to query item information, purchase items, restore items, and more.
Subscriptions are supported on iOS, Android, Mac, and Windows.
Windows.Services.Store and supports WinUI 3 and Windows App SDK apps, subscriptions, and consumables. This changes some Windows behavior, see the migration notesGet started by reading through the In-App Billing Plugin documentation.
| Platform | Version |
|---|---|
| iOS for .NET | 10+ |
| macCatlyst for .NET | All |
| Android for .NET | 23+ |
| Windows App SDK (WinUI 3) | 10+ |
| .NET MAUI | All |
Android Billing v9 needs newer AndroidX libraries than .NET MAUI 10 brings in, so restoring can fail with NU1107 on Xamarin.AndroidX.Lifecycle.*. If it does, reference these from your app:
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.13.0.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.6.0.1" />
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.9.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.11.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx" Version="2.11.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.11.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.11.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx.Android" Version="2.11.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.11.0.1" />
<PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="1.5.0.1" />
</ItemGroup>
AcknowledgePurchaseAsync is now FinalizePurchaseAsyncIf you receive an error in Google Play you may need to add this to your AndroidManifest.xml inside the application node:
<meta-data
android:name="com.google.android.play.billingclient.version"
android:value="X.X.X" />
Update X.X.X with the version of the Billing Library that is a dependency on the NuGet package.
To respond to pending transactions you can subscribe to a listener in your Android project startup:
// Connect to the service here
await CrossInAppBilling.Current.ConnectAsync();
// Check if there are pending orders, if so then subscribe
var purchases = await CrossInAppBilling.Current.GetPurchasesAsync(ItemType.InAppPurchase);
if (purchases?.Any(p => p.State == PurchaseState.PaymentPending) ?? false)
{
Plugin.InAppBilling.InAppBillingImplementation.OnAndroidPurchasesUpdated = (billingResult, purchases) =>
{
// decide what you are going to do here with purchases
// probably acknowledge
// probably disconnect
};
}
else
{
await CrossInAppBilling.Current.DisconnectAsync();
}
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗