Skip to main content
Version: v3.2.0

Get Checkout Link

Returns the checkout link for a plan. This endpoint will only work for paid Plans.

Code Sample

Required parameters

import { Salable } from '@salable/node-sdk';

const salable = new Salable('{{API_KEY}}');

const checkoutLink = await salable.plans.getCheckoutLink('{{PLAN_UUID}}', {
cancelUrl: 'https://example.com/cancel',
successUrl: 'https://example.com/success',
granteeId: 'userId-1',
member: 'orgId_1',
});

Customer details

import { Salable } from '@salable/node-sdk';

const salable = new Salable('{{API_KEY}}');

const checkoutLink = await salable.plans.getCheckoutLink('{{PLAN_UUID}}', {
cancelUrl: 'https://example.com/cancel',
successUrl: 'https://example.com/success',
granteeId: 'userId-1',
member: 'orgId_1',
customer: {
email: 'person@company.com',
},
});

VAT (Paddle only)

import { Salable } from '@salable/node-sdk';

const salable = new Salable('{{API_KEY}}');

const checkoutLink = await salable.plans.getCheckoutLink('{{PLAN_UUID}}', {
cancelUrl: 'https://example.com/cancel',
successUrl: 'https://example.com/success',
granteeId: 'userId-1',
member: 'orgId_1',
vat: {
number: 'GB123456789',
companyName: 'Company',
street: '1 Street Name',
city: 'City',
state: 'State',
country: 'GB',
postcode: 'NR1 1RN',
},
});

Parameters

planId (required)

Type: string

The uuid of the Plan to get the checkout link from

queryParams (required)

Type: IPlanCheckoutInputParams

Query parameters to be passed in to the checkout config

ParameterDescriptionRequired
successUrlThe URL to send users if they have successfully completed a purchase
cancelUrlThe URL to send users to if the transaction fails.
memberThe purchaser of the license
granteeIdValue to use as granteeId on Plan
marketingConsentOpt user in to marketing
couponCodeCoupon code to be used in checkout
promoCodeIf your service offers promotional codes, use the promoCode parameter to automatically fill in these codes during checkout. Make sure these codes are already configured in your payment provider.
Stripe
Provide the Stripe Promotion Code ID to the promoCode parameter, you can find this in your Stripe dashboard. For guidance on creating a promotion code in Stripe, consult their documentation. Make sure to use the ID and not the promo code itself.
Note: If a promo code is applied this way, customers will not have the ability to modify it in the checkout. If you would prefer to give customers the option to enter a promo code themselves, you can use the allowPromoCode parameter instead.
Paddle
Pass the coupon code that you have created in the Paddle dashboard directly into the promoCode parameter. Users can modify this manually in the checkout later.
allowPromoCodeThe allowPromoCode parameter controls the visibility and functionality of the Promotion Code field in your checkout process.
Stripe
In Stripe, you can use either allowPromoCode or promoCode, but not both simultaneously. Setting allowPromoCode to true displays the promo code field, allowing customers to enter a code.
Note: If you would prefer to use a pre-filled specific promo code, use the promoCode parameter with the Promotion Code ID from your Stripe dashboard. Remember, using promoCode in Stripe means customers cannot modify the code during checkout.
Paddle
By default, this is set to true. Setting allowPromoCode to false will hide the promo code field in the checkout. If you're using the promoCode parameter to pre-fill a code, the user can still modify it during checkout.
customer.emailPre fills email for checkout customer

See code example with customer details

Paddle specific parameters
ParameterDescriptionRequired
vat.numberPrefill the checkout form with the customer's VAT number
vat.companyNamePrefill the checkout form with the customer's Company Name for VAT
vat.streetPrefill the checkout form with the customer's Street for VAT
vat.cityPrefill the checkout form with the customer's city for VAT
vat.statePrefill the checkout form with the customer's state for VAT
vat.countryPrefill the checkout form with the customer's country for VAT
vat.postcodePrefill the checkout form with the customer's postcode for VAT
customMessageAdd a message to show in Paddle checkout
customer.countryPre fills country for checkout customer
customer.postcodePre fills postcode for checkout customer

See code example with VAT parameters

Return Type

For more information about this request see our API documentation on Plan checkout link