我使用 [in app purchase][1] 库在我使用 Flutter 开发的应用程序中进行应用内购买。进行购买时,为了在服务器端验证 Android 应用内购买,我发送的数据如下,我需要由服务器发送。
_verifyPurchase(PurchaseDetails purchase) async {
productID = purchase.productID;
//for android it works nice
if(Platform.isAndroid){
orderId = purchase.billingClientPurchase.orderId;
purchaseToken = purchase.billingClientPurchase.purchaseToken;
purchaseVerify(orderId, purchaseToken, productID);
//but it does not work for iOS and the data required for purchase verification does not go to the server
}else if(Platform.isIOS){
transactionId = purchase.skPaymentTransaction.originalTransaction;
verifData = purchase.verificationData.serverVerificationData;
purchaseVerify(transactionId, verifData, productID);
}
}
purchaseVerify(String orderId, String purchaseToken, String productID) async {
var data = {
'orderId' : orderId,
'purchaseToken' : purchaseToken,
'productId' : productID,
};
res = await Network().authData(data, 'purchaseVerify.php');
}
但是,尽管我尝试如下获取验证 iOS 应用内购买所需的数据,但没有数据发送到服务器端。
如何获取验证 iOS 应用内购买所需的数据并将其发送到服务器端?