payments

object

%Stripe

/phlo/resources/payments/Stripe.phlo
version 1.0
creator q-ai.nl
summary Thin Stripe wrappers: Checkout, Billing Portal, prices, customers, subscriptions and webhook verification. Call Stripe::boot($secret) first. Requires the Stripe PHP SDK (composer: stripe/stripe-php).
package payments
frontend false
backend true
tags stripe payments checkout subscription billing webhook
static

Stripe :: boot ($secret, $version = '2025-09-30.clover')

line 9
$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
$prices = \Stripe\Price::all(['lookup_keys' => [$lookupKey], 'limit' => 1, 'active' => true])
return $prices->data[0] ?? null
static

Stripe :: customer ($id)

line 21
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\Customer::create($data)
static

Stripe :: checkout (array $params)

line 33
\Stripe\Checkout\Session::create($params)
static

Stripe :: portal ($customerId, $returnUrl)

line 35
\Stripe\BillingPortal\Session::create(['customer' => (string)$customerId, 'return_url' => (string)$returnUrl])
static

Stripe :: verifyWebhook ($payload, $sigHeader, $secret)

line 37
$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\Subscription::all(['customer' => (string)$customerId, 'status' => $status, 'limit' => $limit])
static

Stripe :: subscription ($id)

line 45
\Stripe\Subscription::retrieve((string)$id)
static

Stripe :: product ($id)

line 47
\Stripe\Product::retrieve((string)$id)

We gebruiken essentiële cookies om deze site te laten werken. Met uw toestemming gebruiken we ook analytics om de site te verbeteren.