Paymentwall website uses cookies to store your browsing preferences on your device. However, cookies do not collect personal information.

For more information about how we use cookies, check our cookie policy

Close

Documentation

Getting Started API Libraries APIs Checklists Flows Integrations Mobile SDKs Reference Smart TV SDK SpiderPipe Testing Payments
Contacts
If you still have questions regarding integration, please email us at devsupport@paymentwall.com

Unity

If you do not have a merchant account registered at Paymentwall, please sign up by completing the steps below:

  • If you don't have a Paymentwall Merchant Account yet, please Sign up.
  • Fill out the Sign Up Form.

Sign up form

  • Please enter your Company Name and website URL.

Sign up company

  • Press the Continue button. Your Paymentwall Merchant Account has been created.

If you already have a Merchant account registered at Paymentwall, following the steps below:

  • After you login, please go to My Projects tab. You will see your first project already created. Please take note of the Project Key and Secret Key. You will need them later to finish the project setup.

My Projects tab

My Projects tab

  • Press the Widgets button, then the "Add New Widget", scroll down and select the Paymentwall Multi widget.

Import Paymentwall plugins

  • Go to Assets Store and install the Paymentwall plugin.
  • Import all files from the Paymentwall plugin.

Import plugin

  • Folder structure of Paymentwall Plugin :
    • Examples : contains example scenes and example scripts. (Please check these scenes for details).
    • Resources : contains sprites and prefab of Paymentwall's SDK.
    • Scripts : contains base scripts of Paymentwall's SDK.
    • Third Parties : contains third-party code (JSON parse, webview renderer).

Folder structure

Integrate payment widget

  • Create a new Unity MonoBehaviour class, add the following code to it. Modify API type and other custom parameters as you like.
using Paymentwall;
public class TestPlugin : MonoBehaviour {

    // Use this for initialization
    void Start () {
        PWBase.SetApiType(Paymentwall_Base.API_VC);
        PWBase.SetAppKey("9fa5245253f742e50e705f65b9b02d66"); // available in your Paymentwall merchant area
        PWBase.SetSecretKey("3918c61450ab7aaa62760036f03eb947"); // available in your Paymentwall merchant area

        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", "user@hostname.com"}} // additional parameters
        );

        PWUnityWidget unity = new PWUnityWidget (widget);
        StartCoroutine (unity.callWidgetWebView (gameObject,canvas)); // call this function to display widget
    }
}
  • You can modify the size and behaviour of payment's widget in PWUnityWidget.cs
  • Run Unity Editor (support only on OSX ) or build it to mobile and see your result.

Widget result

Integrate Brick (built-in UI)

  • Grab your public key and private key inside your merchant account.

Brick key

  • Create a new Unity MonoBehaviour class, and add the following namespace.
    using Paymentwall;
  • Remember to switch SDK to Live Mode.
    PWBase.SetApiMode(API_MODE);
  • Add the following code and modify parameters based on your demand.
PWBrick brick = new PWBrick (3.0f, "USD", "Your Awesome Game", "Small pack");
PWBase.SetAppKey ("YOUR PUBLIC KEY");
PWBase.SetSecretKey ("YOUR PRIVATE KEY");
brick.ShowPaymentForm ();
  • Result

Brick result

Integrate Brick (code only)

  • Or you can use your custom UI, request token and charge credit card with this code.
PWBase.SetAppKey ("YOUR PUBLIC KEY");
PWBase.SetSecretKey ("YOUR PRIVATE KEY");

PWOneTimeToken tokenModel = new PWOneTimeToken ();
tokenModel.Create (PWBase.GetAppKey (), 
                "4000000000000002", // card number
                "12", // expire month
                "16", // expire year
                "123"); // CVV number
PWCharge charge = gameObject.AddComponent<PWCharge> ();
yield return StartCoroutine(charge.create (tokenModel, 
                    "test@email.com", // Paymentwall will send receipt to this address.
                    "USD",  // Currency code
                    "9.99", // Amount of charge
                    "fingerprint", // Fingerprint
                    "this is description")); // Description of payment

Submit the project for approval

Once all the settings have been properly configured, go back to your Paymentwall Merchant Area -> My Projects and submit the project for approval by pressing the Submit For Review button.

Your project will be approved shortly once we have reviewed the integration and made sure that everything is running smoothly for your users.

If you have any questions, please feel free to contact us at devsupport@paymentwall.com

This page needs JavaScript
Your browser is
not supported anymore.
Please update to the more recent one.
This page needs JavaScript
This page needs JavaScript.
Please enable it in your browser settings and try again.