Ejemplo n.º 1
0
    /// <summary>
    ///<param name="product_id">id of product for payment</param>
    /// setup product
    /// call webview for payment
    /// </summary>
    public void Payment(string product_id)
    {
        PWBase.SetApiType(typePayment);
        PWBase.SetAppKey("8ec04f96a62ec4c7a0f13ceccee638ac");         // available in your Paymentwall merchant area
        PWBase.SetSecretKey("adb7497cc888e5c1547dded7aa9ca0d7");      // available in your Paymentwall merchant area

        List <PWProduct> productList = new List <PWProduct>();

        if (typePayment == Paymentwall_Base.API_GOODS)
        {
            productList = this.CreateProduct(product_id);
        }

        PWWidget widget = new PWWidget(
            "1",             // id of the end-user who's making the payment
            "p1_1",          // widget code, e.g. p1; can be picked inside of your merchant account
            productList,
            new Dictionary <string, string>()
        {
            { "email", "*****@*****.**" }
        }                                                                                      // additional parameters
            );
        PWUnityWidget unity = new PWUnityWidget(widget);

        StartCoroutine(unity.callWidgetWebView(gameObject, canvas));           // call this function to display widget
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        string   json = ((TextAsset)Resources.Load("Data/widget")).text;
        JSONNode node = JSON.Parse(json);

        int    type      = int.Parse(node["apiType"]);
        string appKey    = node["appKey"];      // available in your Paymentwall merchant area
        string secretKey = node["secretKey"];   // available in your Paymentwall merchant area

        PWBase.SetApiType(type);
        PWBase.SetAppKey(appKey);
        PWBase.SetSecretKey(secretKey);

        List <PWProduct> productList = new List <PWProduct>();
        PWProduct        product     = new PWProduct(
            "product301",                // id of the product in your system
            9.99f,                       // price
            "USD",                       // currency code
            "Gold Membership",           // product name
            PWProduct.TYPE_SUBSCRIPTION, // this is a time-based product; for one-time products, use Paymentwall_Product.TYPE_FIXED and omit the following 3 parameters
            1,                           // time duration
            PWProduct.PERIOD_TYPE_YEAR,  // year
            true                         // recurring
            );

        productList.Add(product);
        PWWidget widget = new PWWidget(
            "user40012",        // id of the end-user who's making the payment
            "p1_1",             // widget code, e.g. p1; can be picked inside of your merchant account
            productList,
            new Dictionary <string, string>()
        {
            { "email", "*****@*****.**" }
        }                                                                                 // additional parameters
            );

        PWUnityWidget unity = new PWUnityWidget(widget);

        StartCoroutine(unity.callWidgetWebView(gameObject, canvas));          // call this function to show Widget
    }