import axios from 'axios';const config = { enviroment: 'test', // The Creem environment to use. Either 'test' or 'live'. projectId: '[SALESNIP_PROJECT_ID]', // The id of your SaleSnip project productId: '[CREEM_PRODUCT_ID]', // The product id of the Creem product minimumPrice: 100, // The minimum price of the product that can be negotiated callbacks: { success: "https://example.com/callback/creem", // The URL to redirect to after successfully completing the payment. },};const session = await axios.post('https://api.salesnip.com/v1/sessions/creem', config, { headers: { 'Content-Type': 'application/json', 'X-Api-Key': process.env.SALESNIP_API_KEY, },});res.status(200).json({ url: session.url });
Ensure this code is run server-side only to protect your API key.
You find the full API reference of this SaleSnip API route here.