FloPay (Node)
Server-side FloPay SDK for checkout session management, customer operations, and webhook handling.
FloPay
Server-side FloPay SDK. Supports checkout session creation via the billing API, direct Stripe operations for customers, and webhook event construction.
Constructor
| Parameter | Type | Required | Description |
|---|---|---|---|
secretKey | string | Yes | Your Stripe secret key (e.g. sk_test_...). |
options | FloPayNodeOptions | No | Additional configuration. |
FloPayNodeOptions:
| Name | Type | Description |
|---|---|---|
apiVersion | string | API version override. |
stripeSecretKey | string | Stripe secret key (when using Stripe-specific operations). |
Throws: FloPayError with type 'authentication_error' if secretKey is empty.
checkout.sessions
create
Create a checkout session via the billing API. Posts to {billingApiUrl}/v1/checkouts/sessions.
| Parameter | Type | Required | Description |
|---|---|---|---|
params | CreateSessionParams | Yes | See CreateSessionParams. |
Returns: Promise<CheckoutSessionResult>
{ status: 201, redirectUrl: string }-- session created, redirect URL available.{ status: 204 }-- payment method already on file.{ status: number }-- other status.
retrieve
Retrieve a checkout session from Stripe by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Stripe checkout session ID. |
Returns: Promise<CheckoutSession> -- normalized session object.
expire
Expire an open checkout session on Stripe.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Stripe checkout session ID. |
Returns: Promise<CheckoutSession> -- the expired session.
listLineItems
List line items for a Stripe checkout session.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Stripe checkout session ID. |
Returns: Promise<LineItem[]> -- array of line items with price and quantity.
customers
create
Create a customer on Stripe.
| Parameter | Type | Required | Description |
|---|---|---|---|
params.email | string | Yes | Customer email. |
params.name | string | No | Customer full name. |
params.metadata | Record<string, string> | No | Arbitrary metadata. |
Returns: Promise<Customer>
retrieve
Retrieve a customer from Stripe by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Stripe customer ID. |
Returns: Promise<Customer>
Throws: FloPayError with type 'api_error' and code 'resource_missing' if the customer has been deleted.
update
Update a customer on Stripe.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Stripe customer ID. |
params.email | string | No | Updated email. |
params.name | string | No | Updated name. |
params.metadata | Record<string, string> | No | Updated metadata. |
Returns: Promise<Customer>
webhooks
constructEvent
Construct and verify a webhook event from a raw payload and signature.
| Parameter | Type | Required | Description |
|---|---|---|---|
payload | string | Buffer | Yes | Raw request body. |
signature | string | Yes | Value of the stripe-signature header. |
secret | string | Yes | Webhook endpoint secret (e.g. whsec_...). |
Returns: WebhookEvent -- verified event with id, type, data, and created.
Throws: If the signature verification fails.