cancel
Showing results for 
Search instead for 
Did you mean: 

integrate in app purchase in Meta SDK

1r1szz
Honored Guest

I can't fetch my products in the app, it shows null, I publlished the product and it's status is "Reslease Pending" Here is the script

 

[SerializeField] private TextMeshProUGUI m_priceText;
private const string DURABLE_SKU = "box1";
 
private void Awake()
{      
    Oculus.Platform.Core.Initialize();
    
}
 
void Start()
{
    FetchProductPrices();
}
 
public void FetchProductPrices()
{
    string[] skus = { DURABLE_SKU };
    Debug.Log("Products in list" + IAP.GetProductsBySKU(skus));
 
    IAP.GetProductsBySKU(skus).OnComplete(GetProductsBySKUCallback);
}
 
void GetProductsBySKUCallback(Message<ProductList> msg)
{
    Debug.Log("message" + msg.Data);
 
    
 
    foreach (Product p in msg.Data)
    {
        Debug.LogFormat("Product: sku:{0} name:{1} price:{2}", p.Sku, p.Name, p.FormattedPrice);
        if (p.Sku == DURABLE_SKU)
        {
            m_priceText.text = p.formattedPrice;
        }
    }
}
0 REPLIES 0