storekit-rs
Safe Rust bindings for Apple's StoreKit framework on macOS.
Status: v0.3.0 adds an
async_apimodule gated on--features async, wrapping StoreKit 2's Swift async APIs as RustFutures viadoom_fish_utils::completion.
Quick start
use *;
Highlights
Product::products_for(...),Product::purchase(...),Product::purchase_in_window(...),Product::latest_transaction(), andProduct::current_entitlements()- Product formatting/localization helpers expose
StoreKitformat styles,SubscriptionPeriodconvenience constructors, and enum/unitlocalized_description()helpers PurchaseOptioncovers quantity, app-account tokens, custom payloads, promotional offers, win-back offers, and storefront-change policiesTransactionexposesall,current_entitlements,updates,unfinished, filtered product streams,latest_for,current_entitlement_for, verification, finishing, refund helpers, and advanced-commerce infoSubscriptionInfo::status_for(...),status_for_transaction(...),SubscriptionStatus::updates(), andSubscriptionStatus::all()surface renewal state plus status streamsPurchaseIntent::intents()andExternalPurchase{,Link,CustomLink}cover the newerStoreKitpurchase-intent and regulatory-link familiesAppStorenow includes merchandising presentation, age-rating lookups, and advanced-commerce product purchase supportStoreKitError::typed()recovers typedStoreKit, purchase, refund-request, and invalid-request framework errorsStorefront::current()andStorefront::updates()wrap theStoreKitstorefront APIsAppTransaction::shared()andAppTransaction::refresh()expose app-level verification resultsReceiptValidatorreads the local app receipt and decodes JWS payloads without publishing or mutating store stateStoreContext::current()summarizes bundle, receipt, payment, and device-verification context for headless tooling
Examples
The crate ships with numbered examples for each logical area:
01_product_lookup02_transaction_stream03_app_store_context04_storefront_current05_subscription_types06_subscription_info_status07_refund_request08_receipt_validator09_message_support10_app_transaction11_store_context12_renewal_info13_renewal_state14_purchase_option15_verification_result16_purchase_intent17_external_purchase18_advanced_commerce19_typed_errors20_async_products(requires--features async)21_async_app_transaction(requires--features async)22_async_storefront(requires--features async)
Run them all with:
for; do ; done
Async API
Enable the async feature to access StoreKit 2's async Swift APIs as standard Rust Futures:
[]
= { = "0.3", = ["async"] }
= "0.3" # or any async runtime
use AsyncProducts;
The following async types are available: [AsyncProducts], [AsyncPurchase], [AsyncAppStore], [AsyncAppTransaction], [AsyncStorefront].
Notes
StoreKit.Messageis unavailable on macOS, so the message module reportsNotSupportedthere.- Refund, review, and offer-code presentation helpers still require an
NSViewController-backed window; headless callers getNotSupportedinstead of hanging. - Window-based purchase and merchandising APIs accept caller-owned
NSWindowHandlevalues when the host app has anAppKitwindow to lend toStoreKit. - The crate does not publish or call
cargo publish; release tagging is separate from drip-publisher rollout.
License
Licensed under either of Apache-2.0 or MIT at your option.