RegisterIOSInAppPurchase() public static method

public static RegisterIOSInAppPurchase ( string productId, string transactionId, byte transactionReceipt, IAPState transactionState ) : void
productId string
transactionId string
transactionReceipt byte
transactionState IAPState
return void
Exemplo n.º 1
0
 void purchaseCancelled(PurchasableItem item)
 {
     if (item != null)
     {
         byte[] receipt = { 0 };
         FuseSDK.RegisterIOSInAppPurchase(item.Id, "", receipt, FuseMisc.IAPState.FAILED);
     }
 }
 void purchaseCancelled(string error)
 {
     //FuseLog( "purchase cancelled with error: " + error );
     if (currentTransaction != null)
     {
         byte[] reciept = Convert.FromBase64String(currentTransaction.base64EncodedTransactionReceipt);
         FuseSDK.RegisterIOSInAppPurchase(currentTransaction.productIdentifier, currentTransaction.transactionIdentifier, reciept, FuseMisc.IAPState.FAILED);
         currentTransaction = null;
     }
 }
Exemplo n.º 3
0
 void purchaseCancelled(string error)
 {
     //FuseLog( "purchase cancelled with error: " + error );
     if (currentTransaction != null)
     {
         byte[] receipt = readReceiptData();
         FuseSDK.RegisterIOSInAppPurchase(currentTransaction.productIdentifier, currentTransaction.transactionIdentifier, receipt, FuseMisc.IAPState.FAILED);
         currentTransaction = null;
     }
 }
Exemplo n.º 4
0
    /// <summary>Records an in-app purchase in the Fuse system made using the Unity IAP plugin.</summary>
    /// <remarks>
    /// This function is meant to be called from Unity's IStoreListener.ProcessPurchase function passing in the
    /// purchasedProduct property of the PurchaseEventArgs parameter.
    /// </remarks>
    /// <param name="product">The product that was purchased.</param>
    public static void RegisterUnityInAppPurchase(Product product)
    {
        if (product == null)
        {
            return;
        }
#if UNITY_ANDROID
        FuseSDK.RegisterAndroidInAppPurchase(FuseMisc.IAPState.PURCHASED, product.receipt,
                                             product.definition.storeSpecificId, product.transactionID, System.DateTime.Now,
                                             string.Empty, (double)product.metadata.localizedPrice, product.metadata.isoCurrencyCode);
#elif UNITY_IOS
        FuseSDK.RegisterIOSInAppPurchase(product.definition.storeSpecificId, product.transactionID, System.Text.Encoding.UTF8.GetBytes(product.receipt), FuseMisc.IAPState.PURCHASED);
#endif
    }
    void productPurchaseAwaitingConfirmationEvent(StoreKitTransaction transaction)
    {
        //FuseLog( "productPurchaseAwaitingConfirmationEvent: " + transaction );

        if (transactionIDPurchasing == transaction.transactionIdentifier)
        {
            FuseLog("Duplicate transaction " + transactionIDPurchasing);
            return;
        }
        transactionIDPurchasing = transaction.transactionIdentifier;
        currentTransaction      = transaction;
        byte[] reciept = Convert.FromBase64String(transaction.base64EncodedTransactionReceipt);
        FuseSDK.RegisterIOSInAppPurchase(transaction.productIdentifier, transaction.transactionIdentifier, reciept, FuseMisc.IAPState.PURCHASING);
    }
    void purchaseSuccessful(StoreKitTransaction transaction)
    {
        if (transactionIDPurchased == transaction.transactionIdentifier)
        {
            FuseLog("Duplicate transaction " + transactionIDPurchased);
            return;
        }
        transactionIDPurchased = transaction.transactionIdentifier;

        //FuseLog( "purchased product: " + transaction );

        currentTransaction = null;
        byte[] reciept = Convert.FromBase64String(transaction.base64EncodedTransactionReceipt);
        FuseSDK.RegisterIOSInAppPurchase(transaction.productIdentifier, transaction.transactionIdentifier, reciept, FuseMisc.IAPState.PURCHASED);
    }
Exemplo n.º 7
0
    void purchaseSuccessful(StoreKitTransaction transaction)
    {
        if (transactionIDPurchased == transaction.transactionIdentifier)
        {
            FuseLog("Duplicate transaction " + transactionIDPurchased);
            return;
        }
        transactionIDPurchased = transaction.transactionIdentifier;

        //FuseLog( "purchased product: " + transaction );

        currentTransaction = null;
        byte[] receipt = readReceiptData();
        FuseSDK.RegisterIOSInAppPurchase(transaction.productIdentifier, transaction.transactionIdentifier, receipt, FuseMisc.IAPState.PURCHASED);
    }
Exemplo n.º 8
0
    private void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary <string, string> extra)
    {
        // pvi is the PurchasableVirtualItem that was just purchased
        // payload is a text that you can give when you initiate the purchase operation and you want to receive back upon completion
        // extra will contain platform specific information about the market purchase.
        //      Android: The "extra" dictionary will contain "orderId" and "purchaseToken".
        //      iOS: The "extra" dictionary will contain "receipt" and "token".

#if UNITY_ANDROID
        string purchaseToken, orderId;
        if (!extra.TryGetValue("purchaseToken", out purchaseToken))
        {
            purchaseToken = string.Empty;
        }
        if (!extra.TryGetValue("orderId", out orderId))
        {
            orderId = string.Empty;
        }
        var item = ((PurchaseWithMarket)pvi.PurchaseType).MarketItem;

        FuseSDK.RegisterAndroidInAppPurchase(FuseMisc.IAPState.PURCHASED, purchaseToken, item.ProductId, orderId,
                                             DateTime.Now, payload, item.Price, item.MarketCurrencyCode);
#elif UNITY_IOS
        string token, receipt;
        if (!extra.TryGetValue("token", out token))
        {
            token = string.Empty;
        }
        if (!extra.TryGetValue("receipt", out receipt))
        {
            receipt = string.Empty;
        }
        var item = ((PurchaseWithMarket)pvi.PurchaseType).MarketItem;

        FuseSDK.RegisterIOSInAppPurchase(item.ProductId, token, System.Text.Encoding.UTF8.GetBytes(receipt), FuseMisc.IAPState.PURCHASED);
#endif
    }