pub struct Product {
pub id: String,
pub display_name: String,
pub description: String,
pub price: String,
pub display_price: String,
pub product_type: ProductType,
pub is_family_shareable: bool,
pub subscription: Option<SubscriptionInfo>,
pub currency_code: Option<String>,
pub price_locale_identifier: Option<String>,
pub json_representation: Vec<u8>,
}Expand description
Wraps StoreKit.Product.
Fields§
§id: StringStoreKit identifier for this value.
display_name: StringDisplay name reported by StoreKit.
description: StringDescription reported by StoreKit.
price: StringPrice reported by StoreKit.
display_price: StringLocalized display price reported by StoreKit.
product_type: ProductTypeProduct type reported by StoreKit.
Whether StoreKit reports that the product is family shareable.
subscription: Option<SubscriptionInfo>Subscription metadata reported by StoreKit.
currency_code: Option<String>Currency code reported by StoreKit.
price_locale_identifier: Option<String>Locale identifier used by StoreKit for price formatting.
json_representation: Vec<u8>Decoded JSON representation returned by StoreKit.
Implementations§
Source§impl Product
impl Product
Sourcepub fn products_for<I, S>(identifiers: I) -> Result<Vec<Self>, StoreKitError>
pub fn products_for<I, S>(identifiers: I) -> Result<Vec<Self>, StoreKitError>
Calls StoreKit.Product.products(for:).
Sourcepub fn purchase(
&self,
options: &[PurchaseOption],
) -> Result<PurchaseResult, StoreKitError>
pub fn purchase( &self, options: &[PurchaseOption], ) -> Result<PurchaseResult, StoreKitError>
Calls StoreKit.Product.purchase(options:).
Sourcepub fn latest_transaction(
&self,
) -> Result<Option<VerificationResult<Transaction>>, StoreKitError>
pub fn latest_transaction( &self, ) -> Result<Option<VerificationResult<Transaction>>, StoreKitError>
Fetches the latest StoreKit transaction for this product.
Sourcepub fn current_entitlements(&self) -> Result<TransactionStream, StoreKitError>
pub fn current_entitlements(&self) -> Result<TransactionStream, StoreKitError>
Creates a stream of current StoreKit entitlements for this product.
Source§impl Product
impl Product
Sourcepub fn purchase_in_window(
&self,
window: &NSWindowHandle,
options: &[PurchaseOption],
) -> Result<PurchaseResult, StoreKitError>
pub fn purchase_in_window( &self, window: &NSWindowHandle, options: &[PurchaseOption], ) -> Result<PurchaseResult, StoreKitError>
Calls the StoreKit purchase API while presenting UI in the supplied NSWindow.
Sourcepub fn formatting(&self) -> Result<ProductFormatting, StoreKitError>
pub fn formatting(&self) -> Result<ProductFormatting, StoreKitError>
Fetches StoreKit-provided formatting for this product.
Sourcepub fn formatted_price(&self) -> Result<String, StoreKitError>
pub fn formatted_price(&self) -> Result<String, StoreKitError>
Returns the StoreKit-formatted price for this product.
Sourcepub fn formatted_subscription_period(
&self,
) -> Result<Option<String>, StoreKitError>
pub fn formatted_subscription_period( &self, ) -> Result<Option<String>, StoreKitError>
Returns the StoreKit-formatted subscription period for this product, if available.
Sourcepub fn formatted_subscription_period_unit(
&self,
) -> Result<Option<String>, StoreKitError>
pub fn formatted_subscription_period_unit( &self, ) -> Result<Option<String>, StoreKitError>
Returns the StoreKit-formatted subscription period unit for this product, if available.