Get Pricing Table for a Product
Returns all necessary data on a Product to be able to display a pricing table. Every active plan on the product will be added to the table in the sort order of free plans, paid plans price and then coming soon plans.
Code Sample
Required parameters
import { Salable } from '@salable/node-sdk';
const salable = new Salable('{{API_KEY}}');
const pricingTable = await salable.product.getPricingTable('{{PRODUCT_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.product.getPricingTable('{{PRODUCT_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.product.getPricingTable('{{PRODUCT_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.product.getPricingTable('{{PRODUCT_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
productUuid (required)
Type: string
The uuid
of the Product to build the pricing table for
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
.
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. | ❌ |
currency | Shortname 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.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. ISO country codes format. | ❌ |
vat.postcode | Prefill the checkout form with the customer's postcode for VAT | ❌ |
customer.country | Pre fills country for checkout customer | ❌ |
customer.postcode | Pre fills postcode for checkout customer | ❌ |
customMessage | Add 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
.
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. | ❌ |
granteeId | Value 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 Product Pricing Table