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


RuStore::PayClient::RuStorePayClient

This class implements the 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, RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == true. Otherwise, RuStore.PayClient.PurchaseAvailabilityResult.isAvailable == false.
bool IsRuStoreInstalled()
Check whether the user has RuStore installed on the device.
void GetProducts(ProductId[] productsId, Action< RuStoreError > onFailure, Action< List< Product > > onSuccess)
Get a 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, AcknowledgementState? acknowledgementState, Action< RuStoreError > onFailure, Action< List< IPurchase > > onSuccess)
Get the list of user purchases.
void GetPurchase(PurchaseId purchaseId, Action< RuStoreError > onFailure, Action< IPurchase > onSuccess)
Get purchase information.
void GetBillingSubscriptions(Action< RuStoreError > onFailure, Action< List< BillingSubscription > > onSuccess)
Get the list of subscriptions managed through the SDK Billing Client.
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-stage payment.
void PurchaseTwoStep(ProductPurchaseParams parameters, SdkTheme sdkTheme, Action< RuStoreError > onFailure, Action< ProductPurchaseResult > onSuccess, PurchaseEventListener? purchaseEventListener =null)
Purchase a product with two-stage payment.
void ConfirmTwoStepPurchase(PurchaseId purchaseId, DeveloperPayload? developerPayload, Action< RuStoreError > onFailure, Action onSuccess)
Consume (confirm) a purchase. After calling confirmation, the purchase transitions to the CONFIRMED status. A consumption (confirmation) request must be accompanied by the delivery of the item.
void CancelTwoStepPurchase(PurchaseId purchaseId, Action< RuStoreError > onFailure, Action onSuccess)
Cancel a purchase. A consumption (confirmation) request must be accompanied by the delivery of the item.
void UpdateAcknowledgementState(PurchaseId purchaseId, AcknowledgementState acknowledgementState, DeveloperPayload? developerPayload, Action< RuStoreError > onFailure, Action< AcknowledgementState > onSuccess)
Update the purchase acknowledgment status.

Public Properties

Name
RuStorePayClient Instance — Returns the single instance of RuStorePayClient (Singleton pattern implementation). If the instance does not exist, it creates one.

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 to be executed 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
)

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

Parameters:

  • onFailure Action to be executed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to be 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 product list has a limit of 1000 elements.
  • onFailure Action to be executed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to be executed on 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
)

Get the list of user purchases.

Parameters:

  • onFailure Action to be executed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to be executed on 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
)

Get the list of user purchases.

Parameters:

  • productType Product type (optional parameter).
  • purchaseStatus Purchase status (optional parameter).
  • acknowledgementState Purchase acknowledgment state (optional parameter).
  • onFailure Action to be executed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to be executed on 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
)

Get purchase information.

Parameters:

  • onFailure Action to be executed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to be executed on 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
)

Get the list of subscriptions managed through the SDK Billing Client.

Parameters:

  • onFailure Action to be executed in case of an error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to be executed on 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
)

Purchase a product.

Parameters:

  • parameters Product purchase parameters.
  • preferredPurchaseType Preferred purchase type – one-step (ONE_STEP) or two-step (TWO_STEP).
  • onFailure Action to be executed in case of an error. Returns a RuStoreError object with error information.
  • onSuccess Action to be executed on successful completion of the operation. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions to receive invoiceId and purchaseId 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 to be executed in case of an error. Returns a RuStoreError object with error information.
  • onSuccess Action to be executed on successful completion of the operation. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions to receive invoiceId and purchaseId 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-stage payment.

Parameters:

  • parameters Product purchase parameters.
  • onFailure Action to be executed in case of an error. Returns a RuStoreError object with error information.
  • onSuccess Action to be executed on successful completion of the operation. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions to receive invoiceId and purchaseId 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

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

Product purchase with two-stage payment.

Parameters:

  • parameters Product purchase parameters.
  • sdkTheme Color theme of the payment sheet.
  • onFailure Action to perform in case of error. Returns a RuStoreError object with error information.
  • onSuccess Action to perform on successful completion of the operation. Returns a ProductPurchaseResult object with purchase result information.
  • purchaseEventListener A set of callback functions that allow receiving 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 (confirmation) of a purchase. After calling confirmation, the purchase will transition to the CONFIRMED status. The consumption (confirmation) 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 to perform in case of error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to perform on successful completion of the operation. Returns an object inheriting from RuStore.PayClient.IProductPurchaseResult with 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 a purchase. The consumption (confirmation) request must be accompanied by the delivery of the item.

Parameters:

  • purchaseId Purchase identifier.
  • onFailure Action to perform in case of error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to perform 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

function UpdateAcknowledgementState

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

Update the purchase confirmation status.

Parameters:

  • purchaseId Purchase identifier.
  • acknowledgementState New status for purchase confirmation.
  • developerPayload A string containing additional order information (optional parameter).
  • onFailure Action to perform in case of error. Returns a RuStore.RuStoreError object with error information.
  • onSuccess Action to perform on successful completion of the operation.

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 only instance of RuStorePayClient (implementation of the Singleton pattern). If the instance has not been created yet, creates it.


RuStorePayClient.Instance;

Filename: public_static_RuStorePayClient_Instance.cs

variable PluginVersion

static string PluginVersion = "11.0.0";

Plugin version.


Назад