storekit-rs
Safe Rust bindings for Apple's StoreKit framework on macOS.
Status: v0.2.1 closes the remaining audited StoreKit 2 gaps with windowed purchases, formatting/localization helpers, subscription-status streams, purchase intents, external-purchase flows, advanced-commerce APIs, and typed framework errors.
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_errors
Run them all with:
for; do ; done
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.