Skip to main content
For advanced use cases or custom flows, you can create checkout sessions programmatically via the Solifyn API. This allows you to generate dynamic checkout URLs or obtain session IDs to mount our Embedded Checkout inline on your site.

Creating a Product Checkout Session

To create a checkout session for a single product, send a POST request to /checkout/create.

Request Body Fields

FieldTypeRequiredDescription
productIdstringYesThe product identifier.
quantitynumberNoThe quantity of items to buy (defaults to 1).
discountCodestringNoA discount code to apply to the checkout session.
customPricenumberNoThe custom price paid by the customer (for Pay What You Want products).
customerEmailstringNoThe email address of the customer to prefill.
checkoutDataobjectNoCustom JSON metadata or details associated with this session.
customFieldsobjectNoCustom form field questions required for the purchase.
affstringNoAffiliate partner tracking code.

API Request Example

const response = await fetch('https://api.solifyn.com/checkout/create', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    productId: 'prod_z2o92kEl6cYYX',
    quantity: 1,
    customerEmail: 'customer@example.com'
  })
});

const data = await response.json();
console.log('Checkout URL:', data.checkout_url);
console.log('Session ID:', data.session_id);

API Response

The endpoint returns exactly 3 fields:
{
  "id": "checkout_database_id",
  "session_id": "third_party_gateway_session_id",
  "checkout_url": "custom_frontend_checkout_url"
}
  • id: The internal database identifier for the checkout/payment configuration.
  • session_id: The gateway session ID used to render the embedded component.
  • checkout_url: The public redirect URL pointing to the custom hosted checkout page.

Creating a Collection Checkout Session

To create a checkout session for a product bundle/collection, send a POST request to /checkout/collection/create.

Request Body Fields

FieldTypeRequiredDescription
collectionIdstringYesThe database ID of the collection to bundle.
quantitynumberNoQuantity of collections to buy (defaults to 1).
discountCodestringNoDiscount code to apply.
affstringNoAffiliate tracking code.

API Request Example

cURL
curl -X POST https://api.solifyn.com/checkout/collection/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "collectionId": "col_123",
    "discountCode": "BUNDLE20"
  }'
The response follows the same 3-field format as the standard checkout creation.