PurchaseMethods

Struct PurchaseMethods 

Source
pub struct PurchaseMethods<'a, C>
where C: 'a,
{ /* private fields */ }
Expand description

A builder providing access to all methods supported on purchase resources. It is not used directly, but through the AndroidPublisher hub.

§Example

Instantiate a resource builder

extern crate hyper;
extern crate hyper_rustls;
extern crate google_androidpublisher3 as androidpublisher3;

use androidpublisher3::{AndroidPublisher, FieldMask, hyper_rustls, hyper_util, yup_oauth2};

let secret: yup_oauth2::ApplicationSecret = Default::default();
let connector = hyper_rustls::HttpsConnectorBuilder::new()
    .with_native_roots()
    .unwrap()
    .https_only()
    .enable_http2()
    .build();

let executor = hyper_util::rt::TokioExecutor::new();
let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
    secret,
    yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
    yup_oauth2::client::CustomHyperClientBuilder::from(
        hyper_util::client::legacy::Client::builder(executor).build(connector),
    ),
).build().await.unwrap();

let client = hyper_util::client::legacy::Client::builder(
    hyper_util::rt::TokioExecutor::new()
)
.build(
    hyper_rustls::HttpsConnectorBuilder::new()
        .with_native_roots()
        .unwrap()
        .https_or_http()
        .enable_http2()
        .build()
);
let mut hub = AndroidPublisher::new(client, auth);
// Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
// like `products_acknowledge(...)`, `products_consume(...)`, `products_get(...)`, `productsv2_getproductpurchasev2(...)`, `subscriptions_acknowledge(...)`, `subscriptions_cancel(...)`, `subscriptions_defer(...)`, `subscriptions_get(...)`, `subscriptions_refund(...)`, `subscriptions_revoke(...)`, `subscriptionsv2_cancel(...)`, `subscriptionsv2_get(...)`, `subscriptionsv2_revoke(...)` and `voidedpurchases_list(...)`
// to build up your call.
let rb = hub.purchases();

Implementations§

Source§

impl<'a, C> PurchaseMethods<'a, C>

Source

pub fn products_acknowledge( &self, request: ProductPurchasesAcknowledgeRequest, package_name: &str, product_id: &str, token: &str, ) -> PurchaseProductAcknowledgeCall<'a, C>

Create a builder to help you perform the following task:

Acknowledges a purchase of an inapp item.

§Arguments
  • request - No description provided.
  • packageName - The package name of the application the inapp product was sold in (for example, ‘com.some.thing’).
  • productId - The inapp product SKU (for example, ‘com.some.thing.inapp1’).
  • token - The token provided to the user’s device when the inapp product was purchased.
Source

pub fn products_consume( &self, package_name: &str, product_id: &str, token: &str, ) -> PurchaseProductConsumeCall<'a, C>

Create a builder to help you perform the following task:

Consumes a purchase for an inapp item.

§Arguments
  • packageName - The package name of the application the inapp product was sold in (for example, ‘com.some.thing’).
  • productId - The inapp product SKU (for example, ‘com.some.thing.inapp1’).
  • token - The token provided to the user’s device when the inapp product was purchased.
Source

pub fn products_get( &self, package_name: &str, product_id: &str, token: &str, ) -> PurchaseProductGetCall<'a, C>

Create a builder to help you perform the following task:

Checks the purchase and consumption status of an inapp item.

§Arguments
  • packageName - The package name of the application the inapp product was sold in (for example, ‘com.some.thing’).
  • productId - The inapp product SKU (for example, ‘com.some.thing.inapp1’).
  • token - The token provided to the user’s device when the inapp product was purchased.
Source

pub fn productsv2_getproductpurchasev2( &self, package_name: &str, token: &str, ) -> PurchaseProductsv2Getproductpurchasev2Call<'a, C>

Create a builder to help you perform the following task:

Checks the purchase and consumption status of an inapp item.

§Arguments
  • packageName - The package name of the application the inapp product was sold in (for example, ‘com.some.thing’).
  • token - The token provided to the user’s device when the inapp product was purchased.
Source

pub fn subscriptions_acknowledge( &self, request: SubscriptionPurchasesAcknowledgeRequest, package_name: &str, subscription_id: &str, token: &str, ) -> PurchaseSubscriptionAcknowledgeCall<'a, C>

Create a builder to help you perform the following task:

Acknowledges a subscription purchase.

§Arguments
  • request - No description provided.
  • packageName - The package name of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • subscriptionId - Note: Since May 21, 2025, subscription_id is not required, and not recommended for subscription with add-ons. The purchased subscription ID (for example, ‘monthly001’).
  • token - The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptions_cancel( &self, package_name: &str, subscription_id: &str, token: &str, ) -> PurchaseSubscriptionCancelCall<'a, C>

Create a builder to help you perform the following task:

Cancels a user’s subscription purchase. The subscription remains valid until its expiration time. Newer version is available at purchases.subscriptionsv2.cancel for better client library support.

§Arguments
  • packageName - The package name of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • subscriptionId - Note: Since May 21, 2025, subscription_id is not required, and not recommended for subscription with add-ons. The purchased subscription ID (for example, ‘monthly001’).
  • token - The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptions_defer( &self, request: SubscriptionPurchasesDeferRequest, package_name: &str, subscription_id: &str, token: &str, ) -> PurchaseSubscriptionDeferCall<'a, C>

Create a builder to help you perform the following task:

Defers a user’s subscription purchase until a specified future expiration time.

§Arguments
  • request - No description provided.
  • packageName - The package name of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • subscriptionId - The purchased subscription ID (for example, ‘monthly001’).
  • token - The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptions_get( &self, package_name: &str, subscription_id: &str, token: &str, ) -> PurchaseSubscriptionGetCall<'a, C>

Create a builder to help you perform the following task:

Deprecated: Use purchases.subscriptionsv2.get instead. Checks whether a user’s subscription purchase is valid and returns its expiry time.

§Arguments
  • packageName - The package name of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • subscriptionId - The purchased subscription ID (for example, ‘monthly001’).
  • token - The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptions_refund( &self, package_name: &str, subscription_id: &str, token: &str, ) -> PurchaseSubscriptionRefundCall<'a, C>

Create a builder to help you perform the following task:

Deprecated: Use orders.refund instead. Refunds a user’s subscription purchase, but the subscription remains valid until its expiration time and it will continue to recur.

§Arguments
  • packageName - The package name of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • subscriptionId - “The purchased subscription ID (for example, ‘monthly001’).
  • token - The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptions_revoke( &self, package_name: &str, subscription_id: &str, token: &str, ) -> PurchaseSubscriptionRevokeCall<'a, C>

Create a builder to help you perform the following task:

Deprecated: Use purchases.subscriptionsv2.revoke instead. Refunds and immediately revokes a user’s subscription purchase. Access to the subscription will be terminated immediately and it will stop recurring.

§Arguments
  • packageName - The package name of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • subscriptionId - The purchased subscription ID (for example, ‘monthly001’).
  • token - The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptionsv2_cancel( &self, request: CancelSubscriptionPurchaseRequest, package_name: &str, token: &str, ) -> PurchaseSubscriptionsv2CancelCall<'a, C>

Create a builder to help you perform the following task:

Cancel a subscription purchase for the user.

§Arguments
  • request - No description provided.
  • packageName - Required. The package of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • token - Required. The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptionsv2_get( &self, package_name: &str, token: &str, ) -> PurchaseSubscriptionsv2GetCall<'a, C>

Create a builder to help you perform the following task:

Get metadata about a subscription

§Arguments
  • packageName - The package of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • token - Required. The token provided to the user’s device when the subscription was purchased.
Source

pub fn subscriptionsv2_revoke( &self, request: RevokeSubscriptionPurchaseRequest, package_name: &str, token: &str, ) -> PurchaseSubscriptionsv2RevokeCall<'a, C>

Create a builder to help you perform the following task:

Revoke a subscription purchase for the user.

§Arguments
  • request - No description provided.
  • packageName - Required. The package of the application for which this subscription was purchased (for example, ‘com.some.thing’).
  • token - Required. The token provided to the user’s device when the subscription was purchased.
Source

pub fn voidedpurchases_list( &self, package_name: &str, ) -> PurchaseVoidedpurchaseListCall<'a, C>

Create a builder to help you perform the following task:

Lists the purchases that were canceled, refunded or charged-back.

§Arguments
  • packageName - The package name of the application for which voided purchases need to be returned (for example, ‘com.some.thing’).

Trait Implementations§

Auto Trait Implementations§

§

impl<'a, C> Freeze for PurchaseMethods<'a, C>

§

impl<'a, C> !RefUnwindSafe for PurchaseMethods<'a, C>

§

impl<'a, C> Send for PurchaseMethods<'a, C>
where C: Sync,

§

impl<'a, C> Sync for PurchaseMethods<'a, C>
where C: Sync,

§

impl<'a, C> Unpin for PurchaseMethods<'a, C>

§

impl<'a, C> !UnwindSafe for PurchaseMethods<'a, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more