谷歌支付(非TEZ):
Package: `Xamarin.GooglePlayServices.Wallet`
确保通过
metadata
在清单中,或通过您的应用程序
MetaDataAttribute
以下内容:
[Application]
[MetaData(name: "com.google.android.gms.wallet.api.enabled", Value = "true")]
从那里开始,问题是
using Android.Gms.Wallet;
设置和使用
PaymentsClient
,即
PaymentsClient paymentsClient = WalletClass.GetPaymentsClient(
this,
new WalletClass.WalletOptions.Builder()
.SetEnvironment(WalletConstants.EnvironmentTest)
.Build()
);
谷歌为印度付费(基于UPI意向):
要将交易信息传递给“TEZ”,您需要定义一个包含所有商户信息、交易金额等的URI…此URI基于统一支付接口
UPI
方案(这不受谷歌控制,因此您需要传递哪些数据,请参阅UPI规范)。
重新:
https://www.npci.org.in/sites/all/themes/npcl/images/PDF/UPI_Linking_Specs_ver_1.5.1.pdf
using (var uri = new Android.Net.Uri.Builder()
.Scheme("upi")
.Authority("pay")
.AppendQueryParameter("pa", "your-merchant-vpa@xxx")
.AppendQueryParameter("pn", "your-merchant-name")
.AppendQueryParameter("mc", "your-merchant-code")
.AppendQueryParameter("tr", "your-transaction-ref-id")
.AppendQueryParameter("tn", "your-transaction-note")
.AppendQueryParameter("am", "your-order-amount")
.AppendQueryParameter("cu", "INR")
.AppendQueryParameter("url", "your-transaction-url")
.Build())
{
intent = new Intent(Intent.ActionView);
intent.SetData(uri);
intent.SetPackage("com.google.android.apps.nbu.paisa.user");
StartActivityForResult(intent, 9999);
}
当然,您将实现
OnActivityResult
并处理结果:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if (requestCode == 9999)
{
Log.Debug("tez result", data.GetStringExtra("Status"));
}
}