payments
object
%Stripe
/phlo/resources/payments/Stripe.phlo
static
Stripe :: boot ($secret, $version = '2025-09-30.clover'):void
line 10
使用提供的秘密密钥初始化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 17
根据提供的查找键从Stripe获取价格对象,返回找到的第一个活动价格或如果不存在则返回null。
$prices = \Stripe\Price::all(['lookup_keys' => [$lookupKey], 'limit' => 1, 'active' => true])
return $prices->data[0] ?? nullstatic
Stripe :: customer ($id)
line 22
通过客户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 32
使用提供的数据在Stripe中创建新客户。
\Stripe\Customer::create($data)static
Stripe :: checkout (array $params)
line 34
在Stripe中创建一个新的结账会话,允许处理支付并管理客户在结账过程中的互动。
\Stripe\Checkout\Session::create($params)static
Stripe :: portal ($customerId, $returnUrl)
line 36
为Stripe Billing Portal创建一个新会话,允许客户管理他们的账单详情和订阅。
\Stripe\BillingPortal\Session::create(['customer' => (string)$customerId, 'return_url' => (string)$returnUrl])static
Stripe :: verifyWebhook ($payload, $sigHeader, $secret)
line 38
通过使用提供的有效负载、签名头和密钥构造事件来验证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 44
从Stripe检索指定客户的订阅列表,按状态过滤并限制结果数量。
\Stripe\Subscription::all(['customer' => (string)$customerId, 'status' => $status, 'limit' => $limit])static
Stripe :: subscription ($id)
line 46
使用指定的订阅 ID 从 Stripe 检索订阅对象。
\Stripe\Subscription::retrieve((string)$id)static
Stripe :: product ($id)
line 48
通过其ID检索Stripe产品。
\Stripe\Product::retrieve((string)$id)object
%SumUp
/phlo/resources/payments/SumUp.phlo
const
SumUp :: section
line 12
'SumUp'const
SumUp :: api
line 13
'https://api.sumup.com'method
%SumUp -> headers:array
line 15
[static::bearer($this->config['api_key'] ?? void)]static
SumUp :: fields:array
line 17
arr(
section: 'SumUp',
config: arr(
merchant_code: 'Merchant code (profile > merchant profile)',
reader_id: 'Default paired reader id (optional; every call accepts an explicit one)',
),
secret: arr(api_key: 'API key (developer.sumup.com > API keys)'),
)method
%SumUp -> merchant:string
line 26
'v0.1/merchants/'.($this->config['merchant_code'] ?? void)method
%SumUp -> readers:obj
line 31
The merchant's paired readers.
if ($m = $this->missing('merchant_code', 'api_key')) return $m
return $this->get($this->merchant.'/readers')method
%SumUp -> reader (?string $readerId = null):string
line 36
(string)($readerId ?? $this->config['reader_id'] ?? void)method
%SumUp -> createReaderCheckout (int $amountMinor, string $currency = 'EUR', ?string $readerId = null, ?string $description = null, ?string $returnUrl = null):obj
line 41
Start a card-present checkout on a reader. The amount is in minor units (cents).
if ($m = $this->missing('merchant_code', 'api_key')) return $m
$reader = $this->reader($readerId)
if ($reader === void) return static::fail('SumUp reader id not configured')
$body = ['total_amount' => ['value' => $amountMinor, 'currency' => $currency, 'minor_unit' => 2]]
if ($description !== null) $body['description'] = $description
if ($returnUrl !== null) $body['return_url'] = $returnUrl
return $this->post($this->merchant.'/readers/'.$reader.'/checkout', $body)method
%SumUp -> terminateReaderCheckout (?string $readerId = null):obj
line 54
Stops the active checkout on a reader.
if ($m = $this->missing('merchant_code', 'api_key')) return $m
$reader = $this->reader($readerId)
if ($reader === void) return static::fail('SumUp reader id not configured')
return $this->post($this->merchant.'/readers/'.$reader.'/terminate')method
%SumUp -> transaction (string $clientTransactionId):obj
line 64
Looks up a transaction by the client transaction id a checkout returned.
if ($m = $this->missing('merchant_code', 'api_key')) return $m
return $this->get('v0.1/me/transactions', ['client_transaction_id' => $clientTransactionId])method
%SumUp -> transactions (array $query = []):obj
line 69
if ($m = $this->missing('merchant_code', 'api_key')) return $m
return $this->get('v0.1/me/transactions/history', $query)最近更新于 2026年8月7日