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>
impl<'a, C> PurchaseMethods<'a, C>
Sourcepub fn products_acknowledge(
&self,
request: ProductPurchasesAcknowledgeRequest,
package_name: &str,
product_id: &str,
token: &str,
) -> PurchaseProductAcknowledgeCall<'a, C>
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.
Sourcepub fn products_consume(
&self,
package_name: &str,
product_id: &str,
token: &str,
) -> PurchaseProductConsumeCall<'a, C>
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.
Sourcepub fn products_get(
&self,
package_name: &str,
product_id: &str,
token: &str,
) -> PurchaseProductGetCall<'a, C>
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.
Sourcepub fn productsv2_getproductpurchasev2(
&self,
package_name: &str,
token: &str,
) -> PurchaseProductsv2Getproductpurchasev2Call<'a, C>
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.
Sourcepub fn subscriptions_acknowledge(
&self,
request: SubscriptionPurchasesAcknowledgeRequest,
package_name: &str,
subscription_id: &str,
token: &str,
) -> PurchaseSubscriptionAcknowledgeCall<'a, C>
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.
Sourcepub fn subscriptions_cancel(
&self,
package_name: &str,
subscription_id: &str,
token: &str,
) -> PurchaseSubscriptionCancelCall<'a, C>
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.
Sourcepub fn subscriptions_defer(
&self,
request: SubscriptionPurchasesDeferRequest,
package_name: &str,
subscription_id: &str,
token: &str,
) -> PurchaseSubscriptionDeferCall<'a, C>
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.
Sourcepub fn subscriptions_get(
&self,
package_name: &str,
subscription_id: &str,
token: &str,
) -> PurchaseSubscriptionGetCall<'a, C>
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.
Sourcepub fn subscriptions_refund(
&self,
package_name: &str,
subscription_id: &str,
token: &str,
) -> PurchaseSubscriptionRefundCall<'a, C>
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.
Sourcepub fn subscriptions_revoke(
&self,
package_name: &str,
subscription_id: &str,
token: &str,
) -> PurchaseSubscriptionRevokeCall<'a, C>
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.
Sourcepub fn subscriptionsv2_cancel(
&self,
request: CancelSubscriptionPurchaseRequest,
package_name: &str,
token: &str,
) -> PurchaseSubscriptionsv2CancelCall<'a, C>
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.
Sourcepub fn subscriptionsv2_get(
&self,
package_name: &str,
token: &str,
) -> PurchaseSubscriptionsv2GetCall<'a, C>
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.
Sourcepub fn subscriptionsv2_revoke(
&self,
request: RevokeSubscriptionPurchaseRequest,
package_name: &str,
token: &str,
) -> PurchaseSubscriptionsv2RevokeCall<'a, C>
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.
Sourcepub fn voidedpurchases_list(
&self,
package_name: &str,
) -> PurchaseVoidedpurchaseListCall<'a, C>
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’).