Laravel Cashier 提供了几个处理 Stripe 集成的强大特性。今天,我们将探讨三个核心特征及其公共方法:ManagesSubscriptions、ManagesCustomer 和 ManagesInvoices。了解这些特征对于在 Laravel 应用程序中实现基于订阅的计费至关重要。
newSubscription($type, $prices = [])
创建新的订阅构建器实例。类型定义订阅名称(例如“默认”),价格可以是单个 ID 或数组。
newSubscription($type, $prices = [])
onTrial($type = 'default', $price = null)
hasExpiredTrial($type = 'default', $price = null)
onGenericTrial()
scopeOnGenericTrial($query)
hasExpiredGenericTrial()
scopeHasExpiredGenericTrial($query)
trialEndsAt($type = 'default')
subscribed($type = 'default', $price = null)
subscription($type = 'default')
subscriptions()
hasIncompletePayment($type = 'default')
subscribedToProduct($products, $type = 'default')
subscribedToPrice($prices, $type = 'default')
onProduct($product)
onPrice($price)
taxRates()
newSubscription($type, $prices = [])
onTrial($type = 'default', $price = null)
hasExpiredTrial($type = 'default', $price = null)
onGenericTrial()
scopeOnGenericTrial($query)
hasExpiredGenericTrial()
scopeHasExpiredGenericTrial($query)
trialEndsAt($type = 'default')
subscribed($type = 'default', $price = null)
subscription($type = 'default')
subscriptions()
hasIncompletePayment($type = 'default')
subscribedToProduct($products, $type = 'default')
subscribedToPrice($prices, $type = 'default')
onProduct($product)
onPrice($price)
taxRates()
priceTaxRates()
newSubscription($type, $prices = [])
onTrial($type = 'default', $price = null)
hasExpiredTrial($type = 'default', $price = null)
onGenericTrial()
scopeOnGenericTrial($query)
hasExpiredGenericTrial()
scopeHasExpiredGenericTrial($query)
trialEndsAt($type = 'default')
subscribed($type = 'default', $price = null)
subscription($type = 'default')
subscriptions()
hasIncompletePayment($type = 'default')
subscribedToProduct($products, $type = 'default')
subscribedToPrice($prices, $type = 'default')
onProduct($product)
onPrice($price)
taxRates()
priceTaxRates()
stripeId()
hasStripeId()
createAsStripeCustomer(array $options = [])
newSubscription($type, $prices = [])
onTrial($type = 'default', $price = null)
hasExpiredTrial($type = 'default', $price = null)
onGenericTrial()
scopeOnGenericTrial($query)
hasExpiredGenericTrial()
scopeHasExpiredGenericTrial($query)
trialEndsAt($type = 'default')
subscribed($type = 'default', $price = null)
这些特征构成了 Laravel Cashier 功能的支柱。了解可用方法及其参数行为的全部范围对于正确实现至关重要。请务必参阅本参考资料的官方文档以获取最新信息。
以上是了解 Laravel Cashier 的核心特征:深入探讨的详细内容。更多信息请关注PHP中文网其他相关文章!