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)
Checks the user authorization status.
void GetPurchaseAvailability(Action< RuStoreError > onFailure, Action< PurchaseAvailabilityResult > onSuccess)
Checks payment availability. If all conditions are met, returns RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == true. Otherwise, returns RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == false.
bool IsRuStoreInstalled()
Checks whether RuStore is installed on the user’s device.
void GetProducts(ProductId[] productsId, Action< RuStoreError > onFailure, Action< List< Product > > onSuccess)
Gets the list of products added to your application through the RuStore console.
void GetPurchases(Action< RuStoreError > onFailure, Action< List< IPurchase > > onSuccess)
Gets the list of user purchases.
void GetPurchases(ProductType? productType, Enum? purchaseStatus, AcknowledgementState? acknowledgementState, Action< RuStoreError > onFailure, Action< List< IPurchase > > onSuccess)
Gets the list of user purchases.
void GetPurchase(PurchaseId purchaseId, Action< RuStoreError > onFailure, Action< IPurchase > onSuccess)
Gets information about a purchase.
void GetBillingSubscriptions(Action< RuStoreError > onFailure, Action< List< BillingSubscription > > onSuccess)
Gets the list of subscriptions created in the Billing Client SDK.
void Purchase(ProductPurchaseParams parameters, PreferredPurchaseType preferredPurchaseType, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchases a product.
void Purchase(ProductPurchaseParams parameters, PreferredPurchaseType preferredPurchaseType, SdkTheme sdkTheme, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchases a product.
void PurchaseTwoStep(ProductPurchaseParams parameters, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchases a product with two-step payment.
void PurchaseTwoStep(ProductPurchaseParams parameters, SdkTheme sdkTheme, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchases a product with two-step payment.
void ConfirmTwoStepPurchase(PurchaseId purchaseId, DeveloperPayload? developerPayload, Action< RuStoreError > onFailure, Action onSuccess)
Consumes (confirms) a purchase. After the confirmation call, the purchase transitions to the CONFIRMED status. The consume (confirm) request must be accompanied by the issuance of the product.
void CancelTwoStepPurchase(PurchaseId purchaseId, Action< RuStoreError > onFailure, Action onSuccess)
Cancels a purchase. The consume (confirm) request must be accompanied by the issuance of the product.
void UpdateAcknowledgementState(PurchaseId purchaseId, AcknowledgementState acknowledgementState, DeveloperPayload? developerPayload, Action< RuStoreError > onFailure, Action< AcknowledgementState > onSuccess)
Updates the purchase confirmation status.

Public Properties

Name
RuStorePayClient Instance — Returns the single 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
)

Checks the user authorization status.

Parameters:

  • onFailure Action performed in case of an error. Returns a 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
)

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

Parameters:

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

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 a product in the developer console). The product list is limited to 1000 items.
  • onFailure Action performed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action performed upon successful completion of the operation. Returns a list of RuStore.PayClient.Product objects with product information.

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
)

Gets the list of user purchases.

Parameters:

  • onFailure Action performed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action performed upon successful completion of the operation. Returns a list of RuStore.PayClient.Purchase objects with purchase information.

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

Filename: public_void_GetPurchases.cs

function GetPurchases

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

Gets the list of user purchases.

Parameters:

  • productType Product type (optional parameter).
  • purchaseStatus Purchase status (optional parameter).
  • acknowledgementState Purchase acknowledgement state (optional parameter).
  • onFailure Action performed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action performed upon successful completion of the operation. Returns a list of RuStore.PayClient.Purchase objects with purchase information.

RuStorePayClient.Instance.GetPurchases(
    productType: ProductType.CONSUMABLE_PRODUCT,
    purchaseStatus: ProductPurchaseStatus.CONFIRMED,
    acknowledgementState: AcknowledgementState.ACKNOWLEDGED,
    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
)

Gets information about a purchase.

Parameters:

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

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

Filename: public_void_GetPurchase.cs

function GetBillingSubscriptions

void GetBillingSubscriptions(
    Action< RuStoreError > onFailure,
    Action< List< BillingSubscription > > onSuccess
)

Gets the list of subscriptions created in the Billing Client SDK.

Parameters:

  • onFailure Action performed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action performed upon successful completion of the operation. Returns a list of RuStore.PayClient.BillingSubscription objects with subscription information.

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

Filename: public_void_GetBillingSubscriptions.cs

function Purchase

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

Purchases a product.

Parameters:

  • parameters Product purchase parameters.
  • preferredPurchaseType Preferred purchase type — one-step (ONE_STEP) or two-step (TWO_STEP).
  • onFailure Action performed in case of an error. Returns a RuStoreError object with error information.
  • onSuccess Action performed upon successful completion of the operation. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions that allows 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
)

Purchases 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 performed in case of an error. Returns a RuStoreError object with error information.
  • onSuccess Action performed upon successful completion of the operation. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions that allows 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
)

Purchases a product with two-step payment.

Parameters:

  • parameters Product purchase parameters.
  • onFailure Action performed in case of an error. Returns a RuStoreError object with error information.
  • onSuccess Action performed upon successful completion of the operation. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions that allows 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
)

Product purchases with two-stage payment.

Parameters:

  • parameters Product purchase parameters.
  • sdkTheme Color theme of the payment sheet.
  • onFailure Action performed in case of an error. Returns a RuStoreError object with error information.
  • onSuccess Action performed when the operation succeeds. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions that provide data about invoiceId and purchaseId 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
)

Consumption (acknowledgement) of the purchase. After calling the acknowledgement, the purchase will transition to the CONFIRMED status. The consumption (acknowledgement) request must be accompanied by the delivery of the item.

Parameters:

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

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
)

Cancellation of the purchase. The consumption (acknowledgement) request must be accompanied by the delivery of the item.

Parameters:

  • purchaseId Purchase identifier.
  • onFailure Action performed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action performed when the operation succeeds.

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

Filename: public_void_CancelTwoStepPurchase.cs

function UpdateAcknowledgementState

void UpdateAcknowledgementState(
    PurchaseId purchaseId,
    AcknowledgementState acknowledgementState,
    DeveloperPayload? developerPayload,
    Action< RuStoreError > onFailure,
    Action< AcknowledgementState > onSuccess
)

Updating the purchase acknowledgement status.

Parameters:

  • purchaseId Purchase identifier.
  • acknowledgementState New purchase acknowledgement status.
  • developerPayload A string containing additional order information (optional parameter).
  • onFailure Action performed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action performed when the operation succeeds.

RuStorePayClient.Instance.UpdateAcknowledgementState(
        purchaseId: new PurchaseId("test_id"),
        acknowledgementState: AcknowledgementState.ACKNOWLEDGED,
        developerPayload: new DeveloperPayload("test_payload"),
        onFailure: (error) => {
            // Process error
        },
        onSuccess: (state) => {
            // Process success
        }
    );

Filename: public_void_UpdateAcknowledgementState.cs

property Instance

static RuStorePayClient Instance;

Returns the single instance of RuStorePayClient. Creates it if the instance has not been created yet.


RuStorePayClient.Instance;

Filename: public_static_RuStorePayClient_Instance.cs

variable PluginVersion

static string PluginVersion = "11.1.0";

Plugin version.


Назад