Skip to main content

SolvaPayClient

SolvaPay SDK v1.0.0


SolvaPay SDK / server/src / SolvaPayClient

Interface: SolvaPayClient

Defined in: packages/server/src/types/client.ts:63

SolvaPay API Client Interface

This interface defines the contract for communicating with the SolvaPay backend. Uses auto-generated types from the OpenAPI specification. You can provide your own implementation or use the default createSolvaPayClient().

Methods

cancelPurchase()?

optional cancelPurchase(params): Promise<{ amount: number; cancellationReason?: string; cancelledAt?: string; currency: string; endDate?: string; planName: string; productReference?: string; reference: string; startDate: string; status: string; }>

Defined in: packages/server/src/types/client.ts:159

Parameters

params
purchaseRef

string

reason?

string

Returns

Promise<{ amount: number; cancellationReason?: string; cancelledAt?: string; currency: string; endDate?: string; planName: string; productReference?: string; reference: string; startDate: string; status: string; }>


checkLimits()

checkLimits(params): Promise<LimitResponseWithPlan>

Defined in: packages/server/src/types/client.ts:65

Parameters

params
customerRef

string

Customer reference identifier

Example

cus_3C4D5E6F
productRef

string

Product reference identifier

Example

prd_1A2B3C4D

Returns

Promise<LimitResponseWithPlan>


createCheckoutSession()

createCheckoutSession(params): Promise<{ amount: number; checkoutUrl: string; currency: string; id: string; sessionId: string; status: string; }>

Defined in: packages/server/src/types/client.ts:173

Parameters

params
customerReference

string

Customer reference

Example

cus_3c4d5e6f7g8h
planRef?

string

Plan reference (optional)

Example

pln_2b3c4d5e6f7g
productRef

string

Product reference (required)

Example

prd_1a2b3c4d5e6f

Returns

Promise<{ amount: number; checkoutUrl: string; currency: string; id: string; sessionId: string; status: string; }>


createCustomer()?

optional createCustomer(params): Promise<{ customerRef: string; }>

Defined in: packages/server/src/types/client.ts:80

Parameters

params
email

string

Customer email address (required)

Example

customer@example.com
externalRef?

string

External reference ID from your auth system to map this customer to an auth user (optional)

Example

auth_user_12345
name?

string

Customer full name (optional)

Example

John Doe

Returns

Promise<{ customerRef: string; }>


createCustomerSession()

createCustomerSession(params): Promise<{ customerUrl: string; sessionId: string; }>

Defined in: packages/server/src/types/client.ts:178

Parameters

params
customerRef

string

Customer reference identifier

Example

cus_3c4d5e6f7g8h

Returns

Promise<{ customerUrl: string; sessionId: string; }>


createPaymentIntent()?

optional createPaymentIntent(params): Promise<{ accountId?: string; clientSecret: string; id: string; publishableKey: string; }>

Defined in: packages/server/src/types/client.ts:146

Parameters

params
customerRef

string

idempotencyKey?

string

planRef

string

productRef

string

Returns

Promise<{ accountId?: string; clientSecret: string; id: string; publishableKey: string; }>


createPlan()?

optional createPlan(params): Promise<{ name: string; reference: string; }>

Defined in: packages/server/src/types/client.ts:135

Parameters

params

object & object

Returns

Promise<{ name: string; reference: string; }>


createProduct()?

optional createProduct(params): Promise<{ name: string; reference: string; }>

Defined in: packages/server/src/types/client.ts:104

Parameters

params
config?

Record<string, never>

Description

Product-specific configuration

description?

string

Product description

Example

AI-powered writing tool
imageUrl?

string

Description

URL to the product image

isMcpPay

boolean

Whether this product uses MCP Pay proxy

Default

false
metadata?

Record<string, never>

Description

Arbitrary key-value metadata

name

string

Product name

Example

AI Writing Assistant
productType?

string

Free-form product type defined by the provider

Example

Coding Assistant

Returns

Promise<{ name: string; reference: string; }>


deletePlan()?

optional deletePlan(productRef, planRef): Promise<void>

Defined in: packages/server/src/types/client.ts:143

Parameters

productRef

string

planRef

string

Returns

Promise<void>


deleteProduct()?

optional deleteProduct(productRef): Promise<void>

Defined in: packages/server/src/types/client.ts:116

Parameters

productRef

string

Returns

Promise<void>


getCustomer()

getCustomer(params): Promise<CustomerResponseMapped>

Defined in: packages/server/src/types/client.ts:85

Parameters

params
customerRef?

string

email?

string

externalRef?

string

Returns

Promise<CustomerResponseMapped>


listPlans()?

optional listPlans(productRef): Promise<object[]>

Defined in: packages/server/src/types/client.ts:119

Parameters

productRef

string

Returns

Promise<object[]>


listProducts()?

optional listProducts(): Promise<object[]>

Defined in: packages/server/src/types/client.ts:94

Returns

Promise<object[]>


processPaymentIntent()?

optional processPaymentIntent(params): Promise<ProcessPaymentResult>

Defined in: packages/server/src/types/client.ts:165

Parameters

params
customerRef

string

paymentIntentId

string

planRef?

string

productRef

string

Returns

Promise<ProcessPaymentResult>


trackUsage()

trackUsage(params): Promise<void>

Defined in: packages/server/src/types/client.ts:68

Parameters

params
action?

string

actionDuration?

number

customerRef

string

outcome

string

planRef

string

productRef

string

requestId?

string

timestamp?

string

Returns

Promise<void>


updateProduct()?

optional updateProduct(productRef, params): Promise<{ balance: number; config?: Record<string, never>; createdAt: string; description?: string; id: string; imageUrl?: string; isMcpPay: boolean; metadata?: Record<string, never>; name: string; plans?: string[]; productType?: string; reference: string; status: string; totalTransactions: number; updatedAt: string; }>

Defined in: packages/server/src/types/client.ts:110

Parameters

productRef

string

params
config?

Record<string, never>

Description

Product-specific configuration

description?

string

Description

Product description

imageUrl?

string

Description

URL to the product image

metadata?

Record<string, never>

Description

Arbitrary key-value metadata

name?

string

Description

Product name

productType?

string

Description

Free-form product type defined by the provider

status?

"active" | "inactive" | "suspended"

Product status

Returns

Promise<{ balance: number; config?: Record<string, never>; createdAt: string; description?: string; id: string; imageUrl?: string; isMcpPay: boolean; metadata?: Record<string, never>; name: string; plans?: string[]; productType?: string; reference: string; status: string; totalTransactions: number; updatedAt: string; }>