payments
object
%Stripe
/phlo/resources/payments/Stripe.phlo
static
Stripe :: boot ($secret, $version = '2025-09-30.clover')
line 9
使用提供的秘密密钥初始化Stripe API,并可选择设置API版本。
$secret = trim((string)$secret)
if (!$secret) error('Stripe secret key not configured', 500)
\Stripe\Stripe::setApiKey($secret)
$version && \Stripe\Stripe::setApiVersion($version)static
Stripe :: price ($lookupKey)
line 16
根据提供的查找键从Stripe获取价格对象,返回找到的第一个活动价格或如果不存在则返回null。
$prices = \Stripe\Price::all(['lookup_keys' => [$lookupKey], 'limit' => 1, 'active' => true])
return $prices->data[0] ?? nullstatic
Stripe :: customer ($id)
line 21
通过客户ID检索Stripe客户,如果客户已删除或在API调用期间发生错误,则返回null。
try {
$c = \Stripe\Customer::retrieve((string)$id)
return ($c->deleted ?? false) ? null : $c
}
catch (\Stripe\Exception\ApiErrorException $e){
return null
}static
Stripe :: createCustomer (array $data)
line 31
使用提供的数据在Stripe中创建新客户。
\Stripe\Customer::create($data)static
Stripe :: checkout (array $params)
line 33
在Stripe中创建一个新的结账会话,允许处理支付并管理客户在结账过程中的互动。
\Stripe\Checkout\Session::create($params)static
Stripe :: portal ($customerId, $returnUrl)
line 35
为Stripe Billing Portal创建一个新会话,允许客户管理他们的账单详情和订阅。
\Stripe\BillingPortal\Session::create(['customer' => (string)$customerId, 'return_url' => (string)$returnUrl])static
Stripe :: verifyWebhook ($payload, $sigHeader, $secret)
line 37
通过使用提供的有效负载、签名头和密钥构造事件来验证Stripe webhook。如果未配置密钥,则会抛出错误。
$secret = trim((string)$secret)
if (!$secret) error('Stripe webhook secret not configured', 500)
return \Stripe\Webhook::constructEvent((string)$payload, (string)$sigHeader, $secret)static
Stripe :: subscriptions ($customerId, $status = 'all', $limit = 10)
line 43
从Stripe检索指定客户的订阅列表,按状态过滤并限制结果数量。
\Stripe\Subscription::all(['customer' => (string)$customerId, 'status' => $status, 'limit' => $limit])static
Stripe :: subscription ($id)
line 45
使用指定的订阅 ID 从 Stripe 检索订阅对象。
\Stripe\Subscription::retrieve((string)$id)static
Stripe :: product ($id)
line 47
通过其ID检索Stripe产品。
\Stripe\Product::retrieve((string)$id)