Documentation
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.
- Please enter your Company Name and website URL.
- 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.
- Press the Settings button. Please select "Digital Goods" (or other API) under "Your API".
- Set the Pingback URL to: http://[your-domain].com/paymentwall_pingback .
- In Custom Pingback parameters, add currencyCode as parameter, OWN as value. Add amount as parameter, OWN as value.
- Set the Signature Version to 3.
- Click Save Changes .
- Press the Widgets button, then the "Add New Widget", scroll down and select the Paymentwall Multi widget.
Import Paymentwall plugins
- In the attachments, you will find our plugin in paymentwall-for-unity.zip. Extract and import all files from this folder. Or you can use our demo from paymentwall-demo-for-unity.zip with database included.
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"); // your Project Public key - available in your Paymentwall merchant area
PWBase.SetSecretKey("3918c61450ab7aaa62760036f03eb947"); // your Project Private key - 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.
Integrate Brick (built-in UI)
- Grab your public key and private key inside your merchant account.
- 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
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.
Note
This module is provided as is. You can download the module in the attachment or from our Paymentwall github