Skip to main content
Version: Node SDK

Get One Pricing Table

Returns all necessary data on a display a pricing table.

Code Sample

Required parameters

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

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

const pricingTable = await salable.pricingTables.getOne('{{PRICING_TABLE_UUID}}', {
globalPlanOptions: {
granteeId: 'userId_1',
member: 'orgId_1',
cancelUrl: 'https://example.com/cancel',
successUrl: 'https://example.com/success',
},
});

Individual plans

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

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

const pricingTable = await salable.pricingTables.getOne('{{PRICING_TABLE_UUID}}', {
globalPlanOptions: {
granteeId: 'userId_1',
member: 'orgId_1',
cancelUrl: 'https://example.com/cancel',
successUrl: 'https://example.com/success',
},
individualPlanOptions: {
'{{PLAN_UUID}}': {
granteeId: 'userId_2',
cancelUrl: 'https://example.com/cancel2',
successUrl: 'https://example.com/success2',
},
},
});

Customer details

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

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

const pricingTable = await salable.pricingTables.getOne('{{PRICING_TABLE_UUID}}', {
globalPlanOptions: {
granteeId: 'userId_1',
member: 'orgId_1',
cancelUrl: 'https://example.com/cancel',
successUrl: 'https://example.com/success',
customer: {
email: 'person@company.com',
},
},
});

VAT (Paddle only)

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

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

const pricingTable = await salable.pricingTables.getOne('{{PRICING_TABLE_UUID}}', {
globalPlanOptions: {
granteeId: 'userId_1',
member: 'orgId_1',
cancelUrl: 'https://example.com/cancel',
successUrl: 'https://example.com/success',
vat: {
number: 'GB123456789',
companyName: 'Company',
street: '1 Street Name',
city: 'City',
state: 'State',
country: 'GB',
postcode: 'NR1 1RN',
},
},
});

Parameters

pricingTableUuid (required)

Type: string

The uuid of the Pricing Table to build


queryParams (required)

Type: PricingTableParameters

Below is the list of properties than can be used in the queryParams argument.

globalPlanOptions
The globalPlanOptions are default parameters that apply to all plans listed in the pricing table. These settings apply to each plan unless overridden by individualPlanOptions.

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.
currencyShortname of the currency to be used in the checkout. The currency must be added to the plan's product in Salable. If not specified, it defaults to the currency selected on the product.
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. ISO country codes format.
vat.postcodePrefill the checkout form with the customer's postcode for VAT
customer.countryPre fills country for checkout customer
customer.postcodePre fills postcode for checkout customer
customMessageAdd a message to show in Paddle checkout

See code example with VAT parameters

individualPlanOptions

You can use individualPlanOptions to override globalPlanOptions for any plan. To do this, assign an override object to individualPlanOptions using the planUuid as the key. Note that the override capability is limited to specific parameters: successUrl, cancelUrl, and granteeId.

ParameterDescriptionRequired
successUrlThe URL to send users if they have successfully completed a purchase
cancelUrlThe URL to send users to if the transaction fails.
granteeIdValue to use as granteeId on Plan

See code example for individual plans

Return Type

For more information about this request see our API documentation on Pricing Table