idrisyagci
idrisyagci

Reputation: 218

Flutter (IOS) in app purchase receipt data

I use the [in app purchase][1] library to make in-app purchases in the application I developed with Flutter. When a purchase is made, in order to verify in-app purchases for Android on the server side, I am sending the datas as follows, which I need to send by the server.

  _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');
  }

However, although I try to obtain the data required to verify the in-app purchases for iOS as follows, no data is sent to the server side.

How can I get the data needed to validate in-app purchases for iOS and send it to the server side?

Upvotes: 5

Views: 1695

Answers (0)

Related Questions