LemonSqueezy checkout session
The ParityDeals Checkout API extends the capabilities of LemonSqueezy's Checkout API by incorporating dynamic pricing adjustments based on user location, holidays, and other criteria defined within ParityDeals.
On this page
Endpoint
POST https://www.paritydeals.com/api/v1/lemon-squeezy-checkout/
This endpoint creates a checkout session with and applies geographic pricing and discounts as configured in ParityDeals.
Parameters
pd_identifier
(required): This parameter is used to specify a unique identifier associated with a particular deal.ip_address
(optional): Pass the IP address. This is necessary only if you are implementing this in server-side.checkout_data
(conditional):You will need to pass the checkout_data as a object checkout_data is similar as th data specified in LemonSqueezy documentation. https://docs.lemonsqueezy.com/api/checkouts/create-checkout..This Parameter is required if variants is not provided.variants
(conditional): Represents different variations of a product, each with unique pricing options, files, and license key settings. Pass the variants as a comma-separated list.This Parameter is required if checkout_data is not provided.store_id
(required):The unique identifier for the product on lemonSqueezy.success_url
(optional): The URL to which a user will be redirected after a successful purchase.
const fetchCheckoutUrl = async () => {
const data = {
pd_identifier: 'your_pd_identifier', // Replace with actual pd identifier
ip_address: '', // Replace with actual ip_address.
variants:'', // Replace with the actual product variants.
store_id: 'your_store_id', // Replace with actual store ID
checkout_data: {}, // Replace with the actual Lemonsqueezy checkout data
success_url: 'https://your-success-url.com' // Set the URL for post-checkout redirection.
};
try {
const response = await fetch('https://www.paritydeals.com/api/v1/lemon-squeezy-checkout/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
const result = await response.json();
console.log('Successfully created Checkout session:', result);
} catch (error) {
console.error('Error while Checkout session:', error);
}
};
// Call the function
fetchCheckoutUrl();
Behavior
when the user make the POST request using this API it will return a checkout url based on the data that is passed in the API and returns a id and URL.
example result:
{
"id": "994d1506-2baf-41b3-80a9-7c0ac9c9e368",
"url": "https://asishs.lemonsqueezy.com/checkout/custom/994d1506-2baf-41b3-80a9-7c0ac9c9e368?signature=f43c0fd78c65f2649bbccf28b544b141353b528e05d30743def15c917ea5ecf0"
}