I tried using the documentation for adding coupons and that method didnt work please help.
I tried using the documentation for adding coupons and that method didnt work please help.
Did you refer to https://docs.microsoft.com/en-us/gaming/playfab/features/commerce/economy/coupons-and-promotions? If yes, can you please provide your code?
The example is as follows:
c# script code:
string couponCode; public GameObject RedeemPanel; //Get inputfield public void InputCouponCode(string CodeIn) { couponCode = CodeIn; } //Open or Close Panel public void OpenCloseRedeemPanel() { RedeemPanel.SetActive(!RedeemPanel.activeInHierarchy); } //Click submitbutton to redeem public void RedeemCoupon() { var primaryCatalogName = "Main"; // In your game, this should just be a constant matching your primary catalog var request = new RedeemCouponRequest { CatalogVersion = primaryCatalogName, CouponCode = couponCode // This comes from player input, in this case, one of the coupon codes generated above }; PlayFabClientAPI.RedeemCoupon(request, OnRedeemSuccess=>{ Debug.Log("Redeem Coupon successfully!"); }, DisplayPlayFabError); }
Unity component view:
2 People are following this question.