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中文網其他相關文章!