Skip to content

Connection

Mansour edited this page Aug 3, 2021 · 2 revisions



I. Create payment class in start method :

In order to work with Poolakey, You need to construct an instance of Payment class:

private Payment payment;
SecurityCheck securityCheck = SecurityCheck.Enable("PUBLIC RSA KEY OF YOUR APP");
PaymentConfiguration paymentConfiguration = new PaymentConfiguration(securityCheck);
payment = new Payment(paymentConfiguration);

You can also disable local security checks, only if you're using Bazaar's REST API by passing SecurityCheck.Disable object in PaymentConfiguration class.

SecurityCheck securityCheck = SecurityCheck.Disable();



II. Connect payment class :

You need to connect to the in-app billing service via connect function in Payment class.

Poolaky unity SDK provides two method types for all API implementations :

  1. Async
  2. Callback

Using async :

var result = await payment.Connect();
Debug.Log($"{result.message}, {result.stackTrace}");
if (result.status == Status.Success)
{
    // Do something ...
}

Using callback :

_ = payment.Connect(OnPaymentConnect);

void OnPaymentConnect(Result result)
{
    if (result.status == Status.Success)
    {
        // Do something ...
    }
}



III. Disconnect payment on application quit :

You have to disconnect from the Poolakey when your game gets destroyed.

void OnApplicationQuit()
{
    payment.Disconnect();
}





Third Step: Get SKU-Details

Clone this wiki locally