Skip to main content
POST
/
v1
/
checkout
/
create
TypeScript SDK
import { Solifyn } from 'solifyn';

const solifyn = new Solifyn({ apiKey: 'your_private_api_key_here' });

// Create the checkout session
const session = await solifyn.checkout.createSession({
  productId: 'prod_7oQUIde...',       // The product ID
  quantity: 1,                       // Number of product units
  customerEmail: 'customer@example.com',
  customFields: {
    userId: 'user_9983'             // Custom metadata to map to successful webhooks
  }
});

// Redirect your customer to the interactive checkout URL
console.log('Checkout Redirect URL:', session.checkoutUrl || session.checkout_url);
{
  "id": "019e56ba-9832-72ae-XXXXXXXXXXX",
  "session_id": "ch_XXXXXXXXXXXXXX",
  "checkout_url": "http://localhost:3000/checkout/test/prod_XXXXXXXXXXX?checkout_id=019e56ba-9832-72ae-XXXXXXXXXX"
}
Create a secure checkout session for a customer to complete a transaction. The response contains the checkout session redirect URL. We recommend using our official client SDKs (available on the right panel) to easily integrate and manage the checkout flow programmatically.

Body

application/json
productId
string
required

The public product identifier (product ID)

Example:

"prod_XXXXXXXXXXX"

currency
string

Three-letter ISO currency code (lowercase)

Example:

"usd"

quantity
number
default:1

The quantity of items to buy

Example:

1

discountCode
string

Discount code to apply

Example:

"PROMO10"

customPrice
number

Custom price paid by customer (for Pay What You Want products)

Example:

15

customerEmail
string

Email address of the customer

Example:

"customer@example.com"

checkoutData
object

JSON metadata or checkout custom information

customFields
object

Custom text fields required for the purchase

aff
string

Affiliate partner tracking code

Example:

"partner_abc"

checkoutId
string

The existing checkout database ID to validate / update

Example:

"019e56ba-9832-72ae-XXXXXXXXXXX"

Response

201 - application/json

Checkout session configuration created successfully.

id
string
required

The unique identifier for the checkout session in database

Example:

"019e56ba-9832-72ae-XXXXXXXXXXX"

session_id
string
required

The unique session ID format for external clients

Example:

"ch_XXXXXXXXXXXXXX"

checkout_url
string
required

The public redirect URL to the custom payment steps page

Example:

"http://localhost:3000/checkout/test/prod_XXXXXXXXXXX?checkout_id=019e56ba-9832-72ae-XXXXXXXXXX"