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
Parameter | Description | Required |
---|---|---|
successUrl | The URL to send users if they have successfully completed a purchase | ✅ |
cancelUrl | The URL to send users to if the transaction fails. | ✅ |
member | The purchaser of the license | ✅ |
granteeId | Value to use as granteeId on Plan | ✅ |
marketingConsent | Opt user in to marketing | ❌ |
couponCode | Coupon code to be used in checkout | ❌ |
promoCode | If 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. | ❌ |
allowPromoCode | The 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.email | Pre fills email for checkout customer | ❌ |
See code example with customer details
Paddle specific parameters
Parameter | Description | Required |
---|---|---|
vat.number | Prefill the checkout form with the customer's VAT number | ❌ |
vat.companyName | Prefill the checkout form with the customer's Company Name for VAT | ❌ |
vat.street | Prefill the checkout form with the customer's Street for VAT | ❌ |
vat.city | Prefill the checkout form with the customer's city for VAT | ❌ |
vat.state | Prefill the checkout form with the customer's state for VAT | ❌ |
vat.country | Prefill the checkout form with the customer's country for VAT | ❌ |
vat.postcode | Prefill the checkout form with the customer's postcode for VAT | ❌ |
customMessage | Add a message to show in Paddle checkout | ❌ |
customer.country | Pre fills country for checkout customer | ❌ |
customer.postcode | Pre 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