Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created July 29, 2019 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shohan4556/a1319513ccf24a5a3e69223ca527f184 to your computer and use it in GitHub Desktop.
Save shohan4556/a1319513ccf24a5a3e69223ca527f184 to your computer and use it in GitHub Desktop.
using System;
using System.Collections;
using System.Collections.Generic;
using HuaweiMobileService;
using UnityEngine;
using UnityEngine.UI;
public class RemoveAdsIAP : MonoBehaviour {
public static RemoveAdsIAP removeAdsIAP_instance;
string merchantName = "Zeptomobile Sdn Bhd";
string productNo = "com.b2mgames.BoomSwipe.huawei.noads";
//public string requestID;
[TextArea(5,10)]
private string rsaPrivateKey;
// Use this for initialization
void Start () {
rsaPrivateKey = "key will goes here";
CheckUpdate();
}
private void CheckUpdate () {
Purchasing.CheckUpdate(new CheckUpdateCallbackImpl());
}
// mechant name
// product no
// date time
// request id
// rsa private key
// button event
public void RemoveAds(){
if(PlayerPrefs.GetInt("noAds") == 0){
Debug.Log("Likhon------------**********----------- : not bought ");
ProductPay();
} else if (PlayerPrefs.GetInt("noAds") == 1) {
Debug.Log("Likhon------------**********----------- : Already bought ");
}
}
public void ProductPay()
{
ProductPayRequest request = new ProductPayRequestBuild()
.Info(merchantName, productNo, DateTime.Now.ToString("yyyyMMddhhmmssfff"))
.OptServiceCatalog("X6") // game
.RsaSign(rsaPrivateKey)// or OptSign(“signedString”)
.Build();
Purchasing.ProductPay(request, new ProductPayImpl());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment