1. Install the Creem Plugin

1.1 Open the plugins tab

Inside the SaleSnip dashboard, navigate to your project and click on the “Plugins” tab. Find the Creem plugin and press the button to install it.

1.2. Add your API Keys

Navigate to Creem’s Developer Settings to find your API keys. Copy and paste the API key from both the Test and Live environments to SaleSnip.

2. Start a negotiation

2.1 Create a session

Create a SaleSnip negotiation session through the SaleSnip API route.

https://api.example.com/negotiate
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.

2.2 Redirect the User

Call your negotiation API route from the previous step and redirect the user to the returned SaleSnip negotiation URL.