Expand description
§storekit-rs
Safe Rust bindings for Apple’s StoreKit framework on macOS.
Status: v0.2.0 expands the StoreKit 2 bridge across product lookup, purchases, transaction streams, storefronts, app transactions, subscription status, renewal info, refund entry points, receipt helpers, and verification metadata.
§Quick start
use storekit::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let products = Product::products_for(["com.example.pro.monthly"])?;
for product in products {
println!("{} — {}", product.display_name, product.display_price);
}
println!("payments enabled: {}", AppStore::can_make_payments()?);
Ok(())
}§Highlights
Product::products_for(...),Product::purchase(...),Product::latest_transaction(), andProduct::current_entitlements()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, and refund helpersSubscriptionInfo::status_for(...)andstatus_for_transaction(...)surface renewal state, verified transactions, and verified renewal infoStorefront::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_result
Run them all with:
for ex in examples/*.rs; do cargo run --example "$(basename "$ex" .rs)"; done§Notes
StoreKit.Messageis unavailable on macOS, so the message module reportsNotSupportedthere.- Refund, review, and offer-code presentation helpers require an
NSViewController-backed window; headless callers getNotSupportedinstead of hanging. - 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.
Re-exports§
pub use app_store::AppStore;pub use app_store::AppStoreEnvironment;pub use app_store::AppStorePlatform;pub use app_transaction::AppTransaction;pub use error::StoreKitError;pub use error::StoreKitFrameworkError;pub use error::VerificationErrorCode;pub use error::VerificationFailure;pub use message::Message;pub use message::MessageReason;pub use message::MessageStream;pub use product::Product;pub use product::ProductType;pub use purchase_option::PurchaseOption;pub use purchase_option::PurchaseResult;pub use receipt_validator::AppReceipt;pub use receipt_validator::ReceiptValidator;pub use refund::Refund;pub use refund::RefundRequestStatus;pub use renewal_info::ExpirationReason;pub use renewal_info::PriceIncreaseStatus;pub use renewal_info::RenewalInfo;pub use renewal_state::RenewalState;pub use store_context::StoreContext;pub use storefront::Storefront;pub use storefront::StorefrontStream;pub use subscription::SubscriptionOffer;pub use subscription::SubscriptionOfferType;pub use subscription::SubscriptionPaymentMode;pub use subscription::SubscriptionPeriod;pub use subscription::SubscriptionPeriodUnit;pub use subscription_info::SubscriptionInfo;pub use subscription_info::SubscriptionStatus;pub use transaction::OfferPaymentMode;pub use transaction::OfferType;pub use transaction::OwnershipType;pub use transaction::RevocationReason;pub use transaction::Transaction;pub use transaction::TransactionData;pub use transaction::TransactionOffer;pub use transaction::TransactionReason;pub use transaction::TransactionStream;pub use verification_result::VerificationMetadata;pub use verification_result::VerificationResult;