All the methods required to use the SDK are contained in the file PlatformPayments.cs. This class is what developers access as shown below. Create a Controller script and add the following.

private PlatformPayments _platformPayments = null;
private GameObject _platformGameObject = null;

void Start()
    {
  		if (_platformPayments == null)
        {
            _platformPayments = FindObjectOfType<PlatformPayments>();
            if (_platformPayments == null)
            {
                _platformGameObject = GameObject.Find("PlatformPayments");
                if (_platformGameObject == null)
                {
                    _platformGameObject = new GameObject("PlatformPayments");
                    _platformPayments = _platformGameObject.AddComponent<PlatformPayments>();
       			    _platformPayments.SetStoreBaseUrl("BASE_URL");
                }
            }
      	}
    }

In the above snippet, set up the platform BASE_URL for the shop when initializing the PlatformPayments. Implement the event OnShouldClose to handle back button navigation on Android and the Done button on Apple iOS.

void Start(){

	_platformPayments.OnShouldClose += (view) =>
  {
    return true; 
  };
}

Handle the closing platform payments by destroying the object below. Destroying the instance to remove unused instances of the Webview used by Platform Payments and

private void OnDestroy()
 {
       _platformPayments.CloseWebView();
      
 }

Opening Platform Payments

Open Platform payments by passing the parameters into the OpenStore method as follows.

_platformPayments.OpenStore("productBundleId","username","countryCode");