please help me I have problem with In-App Purchases only on IOS
I created a game using Unity3D game engine for both system IOS & ANDROID. I already published this game on android and (In-App Purchases) work successfully. But it is not working on IOS it show me this error:
-
Onitialize failed.
-
UnityIAP: No App Receipt 3
-
UnityIAP: Requesting 4 products
-
UnityIAP: Received 0 products
-
UnityIAP: No App Receipt found
I alardy added 3 IAP items to my game then why it show me this error!!
This is 7 time Apple rejected my game because of this problem, they send me this:
When validating receipts on your server, your server needs to be able to handle a productionsigned app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code “Sandbox receipt used in production,” you should validate against the test environment instead.
I can not even use sandbox ![]()
using System;
using UnityEngine;
using UnityEngine.Purchasing;
using System.Collections.Generic;
public class iap_manager : MonoBehaviour, IStoreListener {
// Statics variables
public static iap_manager instance;
private static IStoreController store_controller; // The Unity Purchasing system
private static IExtensionProvider store_extension_provider; // The store-specific Purchasing subsystems
[Header("Product ID: consumable")]
public static string star_1 = "star_1";
public static string star_2 = "star_2";
public static string star_3 = "star_3";
// Awake
// Awake is called when the script instance is being loaded
void Awake() {
// Setting up the references.
instance = this;
}
// Start
// Start is called on the frame when a script is enabled
void Start() {
// Store controller: if we haven't set up the unity purchasing reference
if (store_controller == null) {
// Begin to configure our connection to purchasing
InitializePurchasing();
}
}
// Initialize purchasing
// Configure our connection to purchasing
public void InitializePurchasing() {
// is initialized: if we have already connected to Purchasing...
if (IsInitialized()) {
// We are done here.
return;
}
// Create a builder, first passing in a suite of Unity provided stores.
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
// Add a consumable product to sell
builder.AddProduct(star_1, ProductType.Consumable);
builder.AddProduct(star_2, ProductType.Consumable);
builder.AddProduct(star_3, ProductType.Consumable);
// Kick off the remainder of the set-up with an asynchrounous call, passing the configuration
// and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed.
UnityPurchasing.Initialize(this, builder);
}
// Is initialized
public bool IsInitialized() {
// Only say we are initialized if both the Purchasing references are set.
return store_controller != null && store_extension_provider != null;
}
// Buy Star 1
public void buy_star_1() {
// Start initialized
BuyProductID(star_1);
}
// Buy Star 2
public void buy_star_2() {
// Start initialized
BuyProductID(star_2);
}
// Buy Star 3
public void buy_star_3() {
// Start initialized
BuyProductID(star_3);
}
// Buy product id
void BuyProductID(
string product_id
) {
// is initialized: if purchasing has been initialized...
if (IsInitialized()) {
// Look up the product reference with the general product identifier and the Purchasing
// system's products collection.
Product product = store_controller.products.WithID(product_id);
// Product: if the look up found a product for this device's store and that product is ready to be sold.
if(product != null && product.availableToPurchase) {
Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
// Buy the product.
// Expect a response either through ProcessPurchase or OnPurchaseFailed asynchronously.
store_controller.InitiatePurchase(product);
} else {
Debug.Log("buy product id: not purchasing product, either is not found or is not available for purchase.");
}
} else {
Debug.Log("buy product id: not initialized.");
}
}
// Restore purchases
// Restore purchases previously made by this customer. Some platforms automatically restore purchases, like Google.
// Apple currently requires explicit purchase restoration for IAP, conditionally displaying a password prompt.
public void RestorePurchases() {
// Is initialized: if purchasing has not yet been set up...
if(
!IsInitialized()
) {
// Report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
Debug.Log("RestorePurchases FAIL. Not initialized.");
return;
}
// If we are running on an Apple device ...
if(
Application.platform == RuntimePlatform.IPhonePlayer
||
Application.platform == RuntimePlatform.OSXPlayer
) {
// ... begin restoring purchases
Debug.Log("RestorePurchases started ...");
// Fetch the Apple store-specific subsystem.
var apple = store_extension_provider.GetExtension<IAppleExtensions>();
// Begin the asynchronous process of restoring purchases. Expect a confirmation response in
// the Action<bool> below, and ProcessPurchase if there are previously purchased products to restore.
apple.RestoreTransactions((result) => {
// The first phase of restoration. If no more responses are received on ProcessPurchase then
// no purchases are available to be restored.
Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
});
} else {
// Set debug
Debug.Log("Restore purchases: not supported on this platform");
}
}
//
// --- IStoreListener
//
// On initialized
public void OnInitialized(
IStoreController controller,
IExtensionProvider extensions
) {
// On onitialized: purchasing has succeeded initializing
// Collect our Purchasing references
Debug.Log("On initialized: PASS");
// Overall purchasing system, configured with products for this application
store_controller = controller;
// Store specific subsystem, for accessing device-specific store features
store_extension_provider = extensions;
}
// On initialize failed
public void OnInitializeFailed(
InitializationFailureReason error
) {
// Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
Debug.Log("On onitialize failed initialization failure reason:" + error);
// Set debug
Debug.Log("Onitialize failed.");
}
// Process purchase
public PurchaseProcessingResult ProcessPurchase(
PurchaseEventArgs args
) {
// Process purchase: if star 1
if (
String.Equals(args.purchasedProduct.definition.id, star_1, StringComparison.Ordinal)
) {
Debug.Log("You've just bought (10,000) star");
// Others...
data_player.instance.star += 10000;
} else if(
String.Equals(args.purchasedProduct.definition.id, star_2, StringComparison.Ordinal)
) {
Debug.Log("You've just bought (50,000) star");
// Others...
data_player.instance.star += 50000;
} else if (
String.Equals(args.purchasedProduct.definition.id, star_3, StringComparison.Ordinal)
) {
// Set debug
Debug.Log("You've just bought (500,000) star");
// Others...
data_player.instance.star += 5000000;
} else {
Debug.Log("Process purchase: Unrecognized product");
}
// Return a flag indicating whether this product has completely been received, or if the application needs
// to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
// saving purchased products to the cloud, and when that save is delayed.
return PurchaseProcessingResult.Complete;
}
// On purchase failed
public void OnPurchaseFailed(
Product product,
PurchaseFailureReason failureReason
) {
// A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing
// this reason with the user to guide their troubleshooting actions.
Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
}
}
If the problem is (Agreements, Tax, and Banking ) i completed all agreements tax except the Bank Account because i do not know what should i write in (Account Number) input field i’m writing my Mastercard number and it will not work.

