API/Autodoc/Classes/RuStore.PayClient.RuStorePayClient.en.md


RuStore::PayClient::RuStorePayClient

The class implements an API for integrating payments into a mobile application.

Public Functions

Name
void GetUserAuthorizationStatus(Action< RuStoreError > onFailure, Action< UserAuthorizationStatus > onSuccess)
Check the user authorization status.
void GetPurchaseAvailability(Action< RuStoreError > onFailure, Action< PurchaseAvailabilityResult > onSuccess)
Check payment availability. If all conditions are met, returns RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == true. Otherwise, returns RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == false.
bool IsRuStoreInstalled()
Check if RuStore is installed on the user’s device.
void GetProducts(ProductId[] productsId, Action< RuStoreError > onFailure, Action< List< Product > > onSuccess)
Get the list of products added to your application via the RuStore console.
void GetPurchases(Action< RuStoreError > onFailure, Action< List< IPurchase > > onSuccess)
Get the list of user purchases.
void GetPurchases(ProductType? productType, Enum? purchaseStatus, Action< RuStoreError > onFailure, Action< List< IPurchase > > onSuccess)
Get the list of user purchases.
void GetPurchase(PurchaseId purchaseId, Action< RuStoreError > onFailure, Action< IPurchase > onSuccess)
Get information about a purchase.
void Purchase(ProductPurchaseParams parameters, PreferredPurchaseType preferredPurchaseType, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchase a product.
void Purchase(ProductPurchaseParams parameters, PreferredPurchaseType preferredPurchaseType, SdkTheme sdkTheme, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchase a product.
void PurchaseTwoStep(ProductPurchaseParams parameters, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchase a product with two-step payment.
void PurchaseTwoStep(ProductPurchaseParams parameters, SdkTheme sdkTheme, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchase a product with two-step payment.
void ConfirmTwoStepPurchase(PurchaseId purchaseId, DeveloperPayload? developerPayload, Action< RuStoreError > onFailure, Action onSuccess)
Consume (confirm) a purchase. After calling confirmation, the purchase will transition to the CONFIRMED status. The consume (confirm) request must be accompanied by the delivery of the goods.
void CancelTwoStepPurchase(PurchaseId purchaseId, Action< RuStoreError > onFailure, Action onSuccess)
Cancel a purchase. The consume (confirm) request must be accompanied by the delivery of the goods.

Public Properties

Name
RuStorePayClient Instance — Returns the only instance of RuStorePayClient (Singleton pattern implementation). If the instance has not been created yet, creates it.

Public Attributes

Name
string PluginVersion — Plugin version.

function GetUserAuthorizationStatus

void GetUserAuthorizationStatus(
    Action< RuStoreError > onFailure,
    Action< UserAuthorizationStatus > onSuccess
)

Check the user authorization status.

Parameters:

  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.

RuStorePayClient.Instance.GetUserAuthorizationStatus(
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (result) => {
        // Process result
    }
);

Filename: public_void_GetUserAuthorizationStatus.cs

function GetPurchaseAvailability

void GetPurchaseAvailability(
    Action< RuStoreError > onFailure,
    Action< PurchaseAvailabilityResult > onSuccess
)

Check payment availability. If all conditions are met, returns RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == true. Otherwise, returns RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == false.

Parameters:

  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a RuStore.PayClient.PurchaseAvailabilityResult object with information about payment availability.

RuStorePayClient.Instance.GetPurchaseAvailability(
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (result) => {
        // Process result
    }
);

Filename: public_void_GetPurchaseAvailability.cs

function IsRuStoreInstalled

bool IsRuStoreInstalled()

RuStorePayClient.Instance.IsRuStoreInstalled();

Filename: public_bool_IsRuStoreInstalled.cs

function GetProducts

void GetProducts(
    ProductId[] productsId,
    Action< RuStoreError > onFailure,
    Action< List< Product > > onSuccess
)

Parameters:

  • productsId List of product identifiers (set when creating the product in the developer console). The list has a restriction of 1000 elements.
  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a list of RuStore.PayClient.Product objects with information about the products.

RuStorePayClient.Instance.GetProducts(
    productsId: new ProductId[] { new ProductId("product_id_1"), new ProductId("product_id_2") },
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (products) => {
        // Process result
    }
);

Filename: public_void_GetProducts.cs

function GetPurchases

void GetPurchases(
    Action< RuStoreError > onFailure,
    Action< List< IPurchase > > onSuccess
)

Get the list of user purchases.

Parameters:

  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a list of RuStore.PayClient.Purchase objects with information about the purchases.

RuStorePayClient.Instance.GetPurchases(
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (purchases) => {
        // Process result
    }
);

Filename: public_void_GetPurchases.cs

function GetPurchases

void GetPurchases(
    ProductType? productType,
    Enum? purchaseStatus,
    Action< RuStoreError > onFailure,
    Action< List< IPurchase > > onSuccess
)

Get the list of user purchases.

Parameters:

  • productType Product type (optional parameter).
  • purchaseStatus Purchase status (optional parameter).
  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a list of RuStore.PayClient.Purchase objects with information about the purchases.

RuStorePayClient.Instance.GetPurchases(
    productType: ProductType.CONSUMABLE_PRODUCT,
    purchaseStatus: ProductPurchaseStatus.CONFIRMED,
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (purchases) => {
        // Process result
    }
);

Filename: public_void_GetPurchases_with_params.cs

function GetPurchase

void GetPurchase(
    PurchaseId purchaseId,
    Action< RuStoreError > onFailure,
    Action< IPurchase > onSuccess
)

Get information about a purchase.

Parameters:

  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a RuStore.PayClient.Purchase object with information about the purchase.

RuStorePayClient.Instance.GetPurchase(
    purchaseId: new PurchaseId(value: "purchase_123"),
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (result) => {
        // Process result
    }
);

Filename: public_void_GetPurchase.cs

function Purchase

void Purchase(
    ProductPurchaseParams parameters,
    PreferredPurchaseType preferredPurchaseType,
    Action< RuStoreError > onFailure,
    Action< ProductPurchaseResult > onSuccess,
    PurchaseEventListener? purchaseEventListener =null
)

Purchase a product.

Parameters:

  • parameters Product purchase parameters.
  • preferredPurchaseType Preferred purchase type – one-step (ONE_STEP) or two-step (TWO_STEP).
  • onFailure Action executed in case of error. Returns an RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a ProductPurchaseResult object with information about the purchase result.
  • purchaseEventListener A set of callback functions that allow receiving invoiceId and purchaseId data at different stages of the purchase – optional.

RuStorePayClient.Instance.Purchase(
    parameters: new ProductPurchaseParams {
        productId = new ProductId("product_id_123"),
        appUserEmail = new AppUserEmail("user@example.com"),
        appUserId = new AppUserId("user_id_456"),
        orderId = new OrderId("order_789"),
        quantity = new Quantity(2),
        developerPayload = new DeveloperPayload("payload_data")
    },
    preferredPurchaseType: PreferredPurchaseType.ONE_STEP,
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (result) => {
        // Process result
    },
    purchaseEventListener: new PurchaseEventListener(
        onPaymentCompleted: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentFailed: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentStarted: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCancelled: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCreated: (purchaseId, invoiceId) => { /* Process */ }
    )
);

Filename: public_void_Purchase.cs

function Purchase

void Purchase(
    ProductPurchaseParams parameters,
    PreferredPurchaseType preferredPurchaseType,
    SdkTheme sdkTheme,
    Action< RuStoreError > onFailure,
    Action< ProductPurchaseResult > onSuccess,
    PurchaseEventListener? purchaseEventListener =null
)

Purchase a product.

Parameters:

  • parameters Product purchase parameters.
  • preferredPurchaseType Preferred purchase type – one-step (ONE_STEP) or two-step (TWO_STEP).
  • sdkTheme Color theme of the payment sheet.
  • onFailure Action executed in case of error. Returns an RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a ProductPurchaseResult object with information about the purchase result.
  • purchaseEventListener A set of callback functions that allow receiving invoiceId and purchaseId data at different stages of the purchase – optional.

RuStorePayClient.Instance.Purchase(
    parameters: new ProductPurchaseParams {
        productId = new ProductId("product_id_123"),
        appUserEmail = new AppUserEmail("user@example.com"),
        appUserId = new AppUserId("user_456"),
        orderId = new OrderId("order_789"),
        quantity = new Quantity(2),
        developerPayload = new DeveloperPayload("payload_data")
    },
    preferredPurchaseType: PreferredPurchaseType.ONE_STEP,
    sdkTheme: SdkTheme.DARK,
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (result) => {
        // Process result
    },
    purchaseEventListener: new PurchaseEventListener(
        onPaymentCompleted: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentFailed: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentStarted: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCancelled: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCreated: (purchaseId, invoiceId) => { /* Process */ }
    )
);

Filename: public_void_Purchase_with_theme.cs

function PurchaseTwoStep

void PurchaseTwoStep(
    ProductPurchaseParams parameters,
    Action< RuStoreError > onFailure,
    Action< ProductPurchaseResult > onSuccess,
    PurchaseEventListener? purchaseEventListener =null
)

Purchase a product with two-step payment.

Parameters:

  • parameters Product purchase parameters.
  • onFailure Action executed in case of error. Returns an RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a ProductPurchaseResult object with information about the purchase result.
  • purchaseEventListener A set of callback functions that allow receiving invoiceId and purchaseId data at different stages of the purchase – optional.

RuStorePayClient.Instance.PurchaseTwoStep(
    parameters: new ProductPurchaseParams(
        productId: new ProductId(value: "product_id_value"),
        appUserEmail: new AppUserEmail(value: "user@example.com"),
        appUserId: new AppUserId(value: "user_id_value"),
        orderId: new OrderId(value: "order_id_value"),
        quantity: new Quantity(value: 1),
        developerPayload: new DeveloperPayload(value: "payload_data")
    ),
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (result) => {
        // Process result
    },
    purchaseEventListener: new PurchaseEventListener(
        onPaymentCompleted: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentFailed: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentStarted: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCancelled: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCreated: (purchaseId, invoiceId) => { /* Process */ }
    )
);

Filename: public_void_PurchaseTwoStep.cs

function PurchaseTwoStep

void PurchaseTwoStep(
    ProductPurchaseParams parameters,
    SdkTheme sdkTheme,
    Action< RuStoreError > onFailure,
    Action< ProductPurchaseResult > onSuccess,
    PurchaseEventListener? purchaseEventListener =null
)

Purchase a product with two-step payment.

Parameters:

  • parameters Product purchase parameters.
  • sdkTheme Color theme of the payment sheet.
  • onFailure Action executed in case of error. Returns an RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns a ProductPurchaseResult object with information about the purchase result.
  • purchaseEventListener A set of callback functions that allow receiving invoiceId and purchaseId data at different stages of the purchase – optional.

RuStorePayClient.Instance.PurchaseTwoStep(
    parameters: new ProductPurchaseParams {
        productId = new ProductId("product_id_123"),
        appUserEmail = new AppUserEmail("user@example.com"),
        appUserId = new AppUserId("user_456"),
        orderId = new OrderId("order_789"),
        quantity = new Quantity(2),
        developerPayload = new DeveloperPayload("payload_data")
    },
    sdkTheme: SdkTheme.DARK,
    onFailure: (error) => {
        // Process error
    },
    onSuccess: (result) => {
        // Process result
    },
    purchaseEventListener: new PurchaseEventListener(
        onPaymentCompleted: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentFailed: (purchaseId, invoiceId) => { /* Process */ },
        onPaymentStarted: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCancelled: (purchaseId, invoiceId) => { /* Process */ },
        onPurchaseCreated: (purchaseId, invoiceId) => { /* Process */ }
    )
);

Filename: public_void_PurchaseTwoStep_with_theme.cs

function ConfirmTwoStepPurchase

void ConfirmTwoStepPurchase(
    PurchaseId purchaseId,
    DeveloperPayload? developerPayload,
    Action< RuStoreError > onFailure,
    Action onSuccess
)

Consume (confirm) a purchase. After calling confirmation, the purchase will transition to the CONFIRMED status. The consume (confirm) request must be accompanied by the delivery of the goods.

Parameters:

  • purchaseId Purchase identifier.
  • developerPayload A string containing additional order information (optional parameter).
  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation. Returns an object inheriting from RuStore.PayClient.IProductPurchaseResult with information about the purchase result.

RuStorePayClient.Instance.ConfirmTwoStepPurchase(
    purchaseId: new PurchaseId(value: "purchase123"),
    developerPayload: new DeveloperPayload(value: "payload456"),
    onFailure: (error) => {
        // Process error
    },
    onSuccess: () => {
        // Process success
    }
);

Filename: public_void_ConfirmTwoStepPurchase.cs

function CancelTwoStepPurchase

void CancelTwoStepPurchase(
    PurchaseId purchaseId,
    Action< RuStoreError > onFailure,
    Action onSuccess
)

Cancel a purchase. The consume (confirm) request must be accompanied by the delivery of the goods.

Parameters:

  • purchaseId Purchase identifier.
  • onFailure Action executed in case of error. Returns an RuStore.RuStoreError object with error information.
  • onSuccess Action executed on successful completion of the operation.

RuStorePayClient.Instance.CancelTwoStepPurchase(
    purchaseId: new PurchaseId(value: "purchase_123"),
    onFailure: (error) => {
        // Process error
    },
    onSuccess: () => {
        // Process success
    }
);

Filename: public_void_CancelTwoStepPurchase.cs

property Instance

static RuStorePayClient Instance;

Returns the only instance of RuStorePayClient (Singleton pattern implementation). If the instance has not been created yet, creates it.


RuStorePayClient.Instance;

Filename: public_static_RuStorePayClient_Instance.cs

variable PluginVersion

static string PluginVersion = "10.3.1";

Plugin version.


Назад