-
Notifications
You must be signed in to change notification settings - Fork 5
Connection
I. Create payment class in start or awake method where you initialise your monobehaviour class which supposed to handle payment:
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);
Your RSA key you can find in your Bazaar panel when you created your app.
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();
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 :
- Async
- Callback
Using async :
var result = await payment.Connect();
Debug.Log($"{result.message}, {result.stackTrace}");
if (result.status == Status.Success)
{
// Success
// Do something ...
return;
}
//Failiure
// Do something ...
Using callback :
_ = _payment.Connect(OnPaymentConnect);
void OnPaymentConnect(Result result)
{
if (result.status == Status.Success)
{
// Success
// Do something ...
return;
}
//Failiure
// Do something ...
}
As you can see one could determine whether or not the initialisation were successfull by checking the status property of result.
You have to disconnect from the Poolakey when your game gets destroyed.
void OnApplicationQuit()
{
payment.Disconnect();
}
Check the sample provided with the SDK in case you want more details about how it could be intitialised and disconnected.
Third Step: Get SKU-Details