Home > Payments > Products and prices
Manage products and prices
Learn how to manage products and prices.
You can create and update products and prices in the Dashboard or through the API.
Some advanced use cases, require you to use the API. If you have a large number of products and prices.
- Use the Dashboard to create and manage products and prices if you want to avoid writing code or if you only have a few products and prices.
- Use the API to create and manage products and prices. The API is a direct method that you use for production implementations.
The following API steps use a fictional SaaS collaboration tool (Togethere [Dashboard | API]) as an example, where the basic product is a project management dashboard.
Use the Dashboard
Create a product
Dashboard | API
Create a product and price
You can type “https://account.payske.com/products/create” into the address bar of any browser to jump straight to the Product Editor.
Create a product
To create a product in the Dashboard:
- Go to the Products tab.
- Click +Add product.
- Enter the Name of your product.
- (Optional) Add a Description. The description appears at checkout.
- (Optional) Add an Image of your product. Use a JPEG or PNG file that’s smaller than 2MB. The image appears at checkout.
- (Optional) Enter a Unit label. This describes how you sell your product. For example, if you charge by the seat, enter “seat” so the line item includes “per seat” for the price. Unit labels appear at checkout, and in invoices and receipts.
Create a price for the product
To save a product in the Dashboard, you must also add at least one price. You can create multiple prices for a product. To add a price for your product:
- Select a Pricing model.
- Standard pricing: Charge the same price for each unit. If you use this option, select One time or Recurring.
- Package pricing: Charge by the package, or group of units, like charging 25 USD for every 5 units. Purchases are rounded up by default, so a customer buying 8 units would pay 50 USD.
- Graduated pricing: Use pricing tiers that may result in a different price for some units in an order. For example, you might charge 10 USD per unit for the first 100 units and then 5 USD per unit for the next 50. If you use this option, select the currency for the price and fill in the tier table.
- Volume pricing: Charge the same price for each unit based on the total number of units sold. For example, you might charge 10 USD per unit for 50 units, and 7 USD per unit for 100 units. If you use this option, select the currency for the price and fill in the tier table.
- Customer chooses price: Let the payer decide on the amount to pay for your product, service, or cause. Customer chooses price is only compatible with Checkout and Payment Links.
- (Optional) If you’re selling in multiple currencies, click Add more currencies to set how much to charge in each currency.
- Select a Billing period for recurring prices. You can add a custom period if none of the drop-down options are what you want.
- (Optional) Check the box under Billing period if you’re using metered billing.
- Click Set as default price to make this price the default price of your product. It will say This is the default price if this price is already the default price. The first price for the product will automatically be set as the default price.
- (Optional) Enter a Price description. Customers don’t see this description.
- (Optional) Click Add another price if you want to create multiple prices for your product.
- Click Save product to save the product and price. You can edit both later. Click Save and add more if you want to create another product and price.
Edit a product
Dashboard | API
To modify a product in the Dashboard:
- Go to the Products tab.
- Find the product you want to modify, click the overflow menu (), then click Edit product.
- Make your changes to the product.
- Click Save product.
You can also edit products from within the product information page by clicking the overflow menu () or Edit.
Archive a product
If you want to disable a product so that it can’t be added to new invoices or subscriptions, you can archive it. If you archive a product, any existing subscriptions that use the product remain active until they’re canceled and any existing payment links that use the product are deactivated. You can’t delete products that have an associated price, but you can archive them.
Dashboard | API
To archive a product:
- Go to the Products tab.
- Find the product you want to modify, click the overflow menu (), then click Archive product.
To unarchive a product:
- Go to the Archived tab on the Products>Overview page.
- Find the product you want to modify, click the overflow menu (), then click Unarchive product.
You can also unarchive a product from the product information page.
Delete a product
You can only delete products that have no prices associated with them. Alternatively, you can archive a product.
Dashboard | API
If a product has a price associated with it, you have to delete or archive the price before you can delete the product. Payske keeps a record of the price and product for historical transactions.
To permanently delete a product:
- Go to the Products tab.
- Find the product you want to modify, click the overflow menu (), then click Delete product.
Create price
You can create single or multiple prices for a product. For example, Togethere may have a “starter” level offered at 10 USD per month, 100 USD per year, or 9 EUR as a one-time purchase.
After you create a price, you can only update its metadata
, nickname
, and active
fields.
Dashboard | API
To create a price in the Dashboard, you have to create a product first. Then you can create a price:
- Select a Pricing model.
- Standard pricing: Charge the same price for each unit. If you use this option, select One time or Recurring.
- Package pricing: Charge by the package, or group of units, like charging 25 USD for every 5 units. Purchases are rounded up by default, so a customer buying 8 units would pay 50 USD.
- Graduated pricing: Use pricing tiers that may result in a different price for some units in an order. For example, you might charge 10 USD per unit for the first 100 units and then 5 USD per unit for the next 50. If you use this option, select the currency for the price and fill in the tier table.
- Volume pricing: Charge the same price for each unit based on the total number of units sold. For example, you might charge 10 USD per unit for 50 units, and 7 USD per unit for 100 units. If you use this option, select the currency for the price and fill in the tier table.
- Customer chooses price: Let the payer decide on the amount to pay for your product, service, or cause. Customer chooses price is only compatible with Checkout and Payment Links.
- (Optional) If you’re selling in multiple currencies, click Add more currencies to set how much to charge in each currency.
- Select a Billing period for recurring prices. You can add a custom period if none of the drop-down options are what you want.
- (Optional) Check the box under Billing period if you’re using metered billing.
- Click Set as default price to make this price the default price of your product. It will say This is the default price if this price is already the default price. The first price for the product will automatically be set as the default price.
- (Optional) Enter a Price description. Customers don’t see this description.
- (Optional) Click Add another price if you want to create multiple prices for your product.
- Click Save product to save the product and price. You can edit both later. Click Save and add more if you want to create another product and price.
Set a default price
A product’s default price is the most common price you want to present to customers. For example, a product could have multiple prices for seasonal sales, but the default is the regular (non-sale) price. If your product only has one price, that is its default price. The default price must be an active Price.
Dashboard | API
To change your product’s default price in the Dashboard:
- Go to the Products tab.
- Find the product you want to modify, click the overflow menu (), then click Edit product.
- Under the Price information section, find the price you want to set as the new default price, then click Set as default price.
- Click Save product.
To create a new price and make it the new default price in the Dashboard:
- Go to the Products tab.
- Find the product you want to modify and click on it to open the product information page.
- In the Pricing section, click the Add another price button.
- Enter your pricing details and select Set as default price. Read more about the fields available when you create a price.
- Click Add price.
Lookup keys
Most businesses display pricing information on their website. If these prices are hard-coded and you want to change them, the process is often manual and requires you to deploy new code. To better manage these scenarios, you can use the lookup_key attribute on the Price object. This key allows you to:
- Render different prices in your frontend.
- Use the rendered price to bill customers.
You can pass a lookup_key
when you create a price:
curl https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
--data-urlencode product="{{PRODUCT_ID}}" \
-d unit_amount=1000 \
-d currency=usd \
-d "recurring[interval]"=month \
-d lookup_key=standard_monthly
payske prices create \
--product="{{PRODUCT_ID}}" \
--unit-amount=1000 \
--currency=usd \
-d "recurring[interval]"=month \
--lookup-key=standard_monthly
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.create(
{
product: '{{PRODUCT_ID}}',
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.create(
product="{{PRODUCT_ID}}",
unit_amount=1000,
currency="usd",
recurring={"interval": "month"},
lookup_key="standard_monthly",
)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->create(
[
'product' => '{{PRODUCT_ID}}',
'unit_amount' => 1000,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
'lookup_key' => 'standard_monthly',
]
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceCreateParams params =
PriceCreateParams.builder()
.setProduct("{{PRODUCT_ID}}")
.setUnitAmount(1000L)
.setCurrency("usd")
.setRecurring(
PriceCreateParams.Recurring.builder()
.setInterval(PriceCreateParams.Recurring.Interval.MONTH)
.build()
)
.setLookupKey("standard_monthly")
.build();
Price price = Price.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.create({
product: '{{PRODUCT_ID}}',
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
Product: payske.String("{{PRODUCT_ID}}"),
UnitAmount: payske.Int64(1000),
Currency: payske.String(string(payske.CurrencyUSD)),
Recurring: &payske.PriceRecurringParams{
Interval: payske.String(string(payske.PriceRecurringIntervalMonth)),
},
LookupKey: payske.String("standard_monthly"),
};
result, _ := price.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceCreateOptions
{
Product = "{{PRODUCT_ID}}",
UnitAmount = 1000,
Currency = "usd",
Recurring = new PriceRecurringOptions { Interval = "month" },
LookupKey = "standard_monthly",
};
var service = new PriceService();
service.Create(options);
Instead of hard-coding text like 10 USD per month on your pricing page and using a price ID on your backend, you can query for the price using the standard_monthly
key and then render that in your frontend:
curl -G https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "lookup_keys[]"=standard_monthly
payske prices list \
-d "lookup_keys[0]"=standard_monthly
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.list({lookup_keys: ['standard_monthly']})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.list(lookup_keys=["standard_monthly"])
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->all(['lookup_keys' => ['standard_monthly']]);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceListParams params =
PriceListParams.builder().addLookupKey("standard_monthly").build();
PriceCollection prices = Price.list(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const prices = await payske.prices.list({lookup_keys: ['standard_monthly']});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceListParams{
LookupKeys: []*string{payske.String("standard_monthly")},
};
result := price.List(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceListOptions
{
LookupKeys = new List<string> { "standard_monthly" },
};
var service = new PriceService();
PayskeList<Price> prices = service.List(options);
To optimize performance, you might want to add a caching layer to only reload the price occasionally.
When a customer clicks your subscribe or pay button, you pass the price from the GET
request above into the Subscriptions API.
Now that you can render different prices, if you decide that you want to start charging new users 20 USD per month rather than 10 USD per month, you only need to create a new price and transfer the lookup key to that new price using transfer_lookup_key=true:
Rounding
Rounding occurs on the line item level of your invoices. For example, if you create a price with unit_amount_decimal = 0.05
and a monthly subscription for that [price] with quantity = 30
, rounding occurs after multiplying the quantity by the decimal amount. In this case, the calculated amount for the line item would be 0.05 * 30 = 1.5
, which rounds up to 2 cents. If you have multiple line items, each is rounded up before summing up the total amount for the invoice. This ensures that customers are still charged an integer minor unit amount, as decimal amounts only apply for pricing.
curl https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
--data-urlencode product="{{PRODUCT_ID}}" \
-d unit_amount=2000 \
-d currency=usd \
-d "recurring[interval]"=month \
-d lookup_key=standard_monthly \
-d transfer_lookup_key=true
payske prices create \
--product="{{PRODUCT_ID}}" \
--unit-amount=2000 \
--currency=usd \
-d "recurring[interval]"=month \
--lookup-key=standard_monthly \
--transfer-lookup-key=true
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.create(
{
product: '{{PRODUCT_ID}}',
unit_amount: 2000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
transfer_lookup_key: true,
},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.create(
product="{{PRODUCT_ID}}",
unit_amount=2000,
currency="usd",
recurring={"interval": "month"},
lookup_key="standard_monthly",
transfer_lookup_key=True,
)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->create(
[
'product' => '{{PRODUCT_ID}}',
'unit_amount' => 2000,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
'lookup_key' => 'standard_monthly',
'transfer_lookup_key' => true,
]
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceCreateParams params =
PriceCreateParams.builder()
.setProduct("{{PRODUCT_ID}}")
.setUnitAmount(2000L)
.setCurrency("usd")
.setRecurring(
PriceCreateParams.Recurring.builder()
.setInterval(PriceCreateParams.Recurring.Interval.MONTH)
.build()
)
.setLookupKey("standard_monthly")
.setTransferLookupKey(true)
.build();
Price price = Price.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.create({
product: '{{PRODUCT_ID}}',
unit_amount: 2000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
transfer_lookup_key: true,
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
Product: payske.String("{{PRODUCT_ID}}"),
UnitAmount: payske.Int64(2000),
Currency: payske.String(string(payske.CurrencyUSD)),
Recurring: &payske.PriceRecurringParams{
Interval: payske.String(string(payske.PriceRecurringIntervalMonth)),
},
LookupKey: payske.String("standard_monthly"),
TransferLookupKey: payske.Bool(true),
};
result, _ := price.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceCreateOptions
{
Product = "{{PRODUCT_ID}}",
UnitAmount = 2000,
Currency = "usd",
Recurring = new PriceRecurringOptions { Interval = "month" },
LookupKey = "standard_monthly",
TransferLookupKey = true,
};
var service = new PriceService();
service.Create(options);
Edit a price
Multiple properties can be updated on a price, either in the Dashboard or the API. For example, you can change whether the price is active, or modify its metadata.
Note that you can not change a price’s amount in the API. Instead, we recommend creating a new price for the new amount, switch to the new price’s ID, then update the old price to be inactive.
Dashboard | API
To modify a price in the Dashboard:
- Go to the Products tab.
- Find the product for the price you want to modify, and click on it
- Find the price you want to modify, click the overflow menu (), then click Edit price.
- Make your changes to the price. You can add another price at this point.
- Click Save.
Archive a price
If you want to disable a price so that it can’t be added to new invoices or subscriptions, you can archive it. If you archive a price, any existing subscriptions that use the price remain active until they’re canceled and any existing payment links that use the product are deactivated.
Dashboard | API
To archive a price through the Dashboard:
- Go to the Products tab.
- Find the product you want to modify, click the overflow menu ().
- On the product information page, find the price you want to modify, then click the overflow menu () next to it and click Archive price.
To unarchive a price:
- Go to the Products tab.
- Find the product you want to modify, click the overflow menu ().
- On the product information page, find the price you want to modify, then click the overflow menu () next to it and click Unarchive price.
Delete a price
You can only delete prices that you’ve never used. Otherwise, you can archive them.
Dashboard | API
To permanently delete a price in the Dashboard:
- Go to the Products tab.
- Find the product you want to modify, click the overflow menu ().
- On the product information page, find the price you want to modify, then click the overflow menu () next to it and click Delete price.
Use the API
Create a product
Dashboard | API
To create a single product and price:
curl https://api.payske.com/v1/products \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d name="Basic Dashboard" \
-d "default_price_data[unit_amount]"=1000 \
-d "default_price_data[currency]"=usd \
-d "default_price_data[recurring][interval]"=month \
-d "expand[]"=default_price
payske products create \
--name="Basic Dashboard" \
-d "default_price_data[unit_amount]"=1000 \
-d "default_price_data[currency]"=usd \
-d "default_price_data[recurring][interval]"=month \
-d "expand[0]"=default_price
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Product.create(
{
name: 'Basic Dashboard',
default_price_data: {
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
},
expand: ['default_price'],
},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Product.create(
name="Basic Dashboard",
default_price_data={
"unit_amount": 1000,
"currency": "usd",
"recurring": {"interval": "month"},
},
expand=["default_price"],
)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->products->create(
[
'name' => 'Basic Dashboard',
'default_price_data' => [
'unit_amount' => 1000,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
],
'expand' => ['default_price'],
]
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
ProductCreateParams params =
ProductCreateParams
.builder()
.setName("Basic Dashboard")
.setDefaultPriceData(
ProductCreateParams.DefaultPriceData
.builder()
.setUnitAmount(1000L)
.setCurrency("usd")
.setRecurring(
ProductCreateParams.DefaultPriceData.Recurring
.builder()
.setInterval(ProductCreateParams.DefaultPriceData.Recurring.Interval.MONTH)
.build()
)
.build()
)
.addExpand("default_price")
.build();
Product product = Product.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const product = await payske.products.create({
name: 'Basic Dashboard',
default_price_data: {
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
},
expand: ['default_price'],
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ProductParams{
Name: payske.String("Basic Dashboard"),
DefaultPriceData: &payske.ProductDefaultPriceDataParams{
UnitAmount: payske.Int64(1000),
Currency: payske.String(string(payske.CurrencyUSD)),
Recurring: &payske.ProductDefaultPriceDataRecurringParams{
Interval: payske.String("month"),
},
},
};
params.AddExpand("default_price")
result, _ := product.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ProductCreateOptions
{
Name = "Basic Dashboard",
DefaultPriceData = new ProductDefaultPriceDataOptions
{
UnitAmount = 1000,
Currency = "usd",
Recurring = new ProductDefaultPriceDataRecurringOptions { Interval = "month" },
},
Expand = new List<string> { "default_price" },
};
var service = new ProductService();
service.Create(options);
When customers first sign up with Togethere, they’re also charged a setup fee.
To create the fee as a product and price, make the same request using a different product name and price data:
curl https://api.payske.com/v1/products \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d name="Starter Setup" \
-d "default_price_data[unit_amount]"=2000 \
-d "default_price_data[currency]"=usd \
-d "expand[]"=default_price
payske products create \
--name="Starter Setup" \
-d "default_price_data[unit_amount]"=2000 \
-d "default_price_data[currency]"=usd \
-d "expand[0]"=default_price
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Product.create(
{
name: 'Starter Setup',
default_price_data: {unit_amount: 2000, currency: 'usd'},
expand: ['default_price'],
},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Product.create(
name="Starter Setup",
default_price_data={"unit_amount": 2000, "currency": "usd"},
expand=["default_price"],
)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->products->create(
[
'name' => 'Starter Setup',
'default_price_data' => ['unit_amount' => 2000, 'currency' => 'usd'],
'expand' => ['default_price'],
]
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
ProductCreateParams params =
ProductCreateParams
.builder()
.setName("Starter Setup")
.setDefaultPriceData(
ProductCreateParams.DefaultPriceData
.builder()
.setUnitAmount(2000L)
.setCurrency("usd")
.build()
)
.addExpand("default_price")
.build();
Product product = Product.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const product = await payske.products.create({
name: 'Starter Setup',
default_price_data: {unit_amount: 2000, currency: 'usd'},
expand: ['default_price'],
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ProductParams{
Name: payske.String("Starter Setup"),
DefaultPriceData: &payske.ProductDefaultPriceDataParams{
UnitAmount: payske.Int64(2000),
Currency: payske.String(string(payske.CurrencyUSD)),
},
};
params.AddExpand("default_price")
result, _ := product.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ProductCreateOptions
{
Name = "Starter Setup",
DefaultPriceData = new ProductDefaultPriceDataOptions
{
UnitAmount = 2000,
Currency = "usd",
},
Expand = new List<string> { "default_price" },
};
var service = new ProductService();
service.Create(options);
Edit a product
Dashboard | API
To modify a product through the API:
curl https://api.payske.com/v1/products/id \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d name="Updated Product"
payske products update id \
--name="Updated Product"
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Product.update('id', {name: 'Updated Product'})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Product.modify("id", name="Updated Product")
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->products->update('id', ['name' => 'Updated Product']);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Product resource = Product.retrieve("id");
ProductUpdateParams params =
ProductUpdateParams.builder().setName("Updated Product").build();
Product product = resource.update(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const product = await payske.products.update('id', {name: 'Updated Product'});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ProductParams{Name: payske.String("Updated Product")};
result, _ := product.Update("id", params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ProductUpdateOptions { Name = "Updated Product" };
var service = new ProductService();
service.Update("id", options);
Archive a product
If you want to disable a product so that it can’t be added to new invoices or subscriptions, you can archive it. If you archive a product, any existing subscriptions that use the product remain active until they’re canceled and any existing payment links that use the product are deactivated. You can’t delete products that have an associated price, but you can archive them.
Dashboard | API
To archive a product (that is, to indicate that it’s not available for purchase) through the API, change the active parameter to false
.
curl https://api.payske.com/v1/products \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d active=false \
-d name="My product"
payske products create \
--active=false \
--name="My product"
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Product.create({active: false, name: 'My product'})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Product.create(active=False, name="My product")
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->products->create(['active' => false, 'name' => 'My product']);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
ProductCreateParams params =
ProductCreateParams.builder().setActive(false).setName("My product").build();
Product product = Product.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const product = await payske.products.create({active: false, name: 'My product'});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ProductParams{
Active: payske.Bool(false),
Name: payske.String("My product"),
};
result, _ := product.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ProductCreateOptions { Active = false, Name = "My product" };
var service = new ProductService();
service.Create(options);
To unarchive a product (that is, to indicate that it’s not available for purchase) through the API, change the active parameter to true
.
curl https://api.payske.com/v1/products/id \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d active=true
payske products update id \
--active=true
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Product.update('id', {active: true})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Product.modify("id", active=True)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->products->update('id', ['active' => true]);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Product resource = Product.retrieve("id");
ProductUpdateParams params = ProductUpdateParams.builder().setActive(true).build();
Product product = resource.update(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const product = await payske.products.update('id', {active: true});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ProductParams{Active: payske.Bool(true)};
result, _ := product.Update("id", params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ProductUpdateOptions { Active = true };
var service = new ProductService();
service.Update("id", options);
Delete a product
You can only delete products that have no prices associated with them. Alternatively, you can archive a product.
Dashboard | API
To permanently delete a product through the API, use delete product.
curl -X DELETE https://api.payske.com/v1/products/{{PRODUCT_ID}} \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
payske products delete {{PRODUCT_ID}}
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Product.delete('{{PRODUCT_ID}}')
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Product.delete("{{PRODUCT_ID}}")
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->products->delete('{{PRODUCT_ID}}', []);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Product resource = Product.retrieve("{{PRODUCT_ID}}");
Product product = resource.delete();
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const deleted = await payske.products.del('{{PRODUCT_ID}}');
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ProductParams{};
result, _ := product.Del("{{PRODUCT_ID}}", params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new ProductService();
service.Delete("{{PRODUCT_ID}}");
Create price
You can create single or multiple prices for a product. For example, Togethere may have a “starter” level offered at 10 USD per month, 100 USD per year, or 9 EUR as a one-time purchase.
After you create a price, you can only update its
metadata
,nickname
, andactive
fields.
Dashboard | API
To create prices through the API, use create price API.
Togethere wants to charge 10 USD per month for their “starter” service level.
The unit_amount
parameter uses the lowest unit of the currency specified for the price. In the case of Togethere, the lowest unit is cents: 10 USD is 1,000 cents, which means their price unit_amount
is 1000
.
To create the price and assign it to the product, pass the product ID, unit amount, currency, and interval:
curl https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d product="{{PRODUCT_ID}}" \
-d unit_amount=1000 \
-d currency=usd \
-d "recurring[interval]"=month
payske prices create \
--product="{{PRODUCT_ID}}" \
--unit-amount=1000 \
--currency=usd \
-d "recurring[interval]"=month
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.create(
{
product: '{{PRODUCT_ID}}',
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.create(
product="{{PRODUCT_ID}}",
unit_amount=1000,
currency="usd",
recurring={"interval": "month"},
)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->create(
[
'product' => '{{PRODUCT_ID}}',
'unit_amount' => 1000,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
]
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceCreateParams params =
PriceCreateParams
.builder()
.setProduct("{{PRODUCT_ID}}")
.setUnitAmount(1000L)
.setCurrency("usd")
.setRecurring(
PriceCreateParams.Recurring
.builder()
.setInterval(PriceCreateParams.Recurring.Interval.MONTH)
.build()
)
.build();
Price price = Price.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.create({
product: '{{PRODUCT_ID}}',
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
Product: payske.String("{{PRODUCT_ID}}"),
UnitAmount: payske.Int64(1000),
Currency: payske.String(string(payske.CurrencyUSD)),
Recurring: &payske.PriceRecurringParams{
Interval: payske.String(string(payske.PriceRecurringIntervalMonth)),
},
};
result, _ := price.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceCreateOptions
{
Product = "{{PRODUCT_ID}}",
UnitAmount = 1000,
Currency = "usd",
Recurring = new PriceRecurringOptions { Interval = "month" },
};
var service = new PriceService();
service.Create(options);
The setup fee for new customers is 20 USD. Because this charge is separate from the subscription and you only charge it one time, you don’t need to pass the interval
:
curl https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d product="{{PRODUCT_ID}}" \
-d unit_amount=2000 \
-d currency=usd
payske prices create \
--product="{{PRODUCT_ID}}" \
--unit-amount=2000 \
--currency=usd
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.create(
{product: '{{PRODUCT_ID}}', unit_amount: 2000, currency: 'usd'},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.create(product="{{PRODUCT_ID}}", unit_amount=2000, currency="usd")
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->create(
['product' => '{{PRODUCT_ID}}', 'unit_amount' => 2000, 'currency' => 'usd']
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceCreateParams params =
PriceCreateParams
.builder()
.setProduct("{{PRODUCT_ID}}")
.setUnitAmount(2000L)
.setCurrency("usd")
.build();
Price price = Price.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.create({
product: '{{PRODUCT_ID}}',
unit_amount: 2000,
currency: 'usd',
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
Product: payske.String("{{PRODUCT_ID}}"),
UnitAmount: payske.Int64(2000),
Currency: payske.String(string(payske.CurrencyUSD)),
};
result, _ := price.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceCreateOptions
{
Product = "{{PRODUCT_ID}}",
UnitAmount = 2000,
Currency = "usd",
};
var service = new PriceService();
service.Create(options);
Set a default price
A product’s default price is the most common price you want to present to customers. For example, a product could have multiple prices for seasonal sales, but the default is the regular (non-sale) price. If your product only has one price, that is its default price. The default price must be an active Price.
Dashboard | API
curl https://api.payske.com/v1/products/{{PRODUCT_ID}} \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d default_price="{{PRICE_ID}}"
payske products update {{PRODUCT_ID}} \
--default-price="{{PRICE_ID}}"
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Product.update('{{PRODUCT_ID}}', {default_price: '{{PRICE_ID}}'})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Product.modify("{{PRODUCT_ID}}", default_price="{{PRICE_ID}}")
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->products->update(
'{{PRODUCT_ID}}',
['default_price' => '{{PRICE_ID}}']
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Product resource = Product.retrieve("{{PRODUCT_ID}}");
ProductUpdateParams params =
ProductUpdateParams.builder().setDefaultPrice("{{PRICE_ID}}").build();
Product product = resource.update(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const product = await payske.products.update(
'{{PRODUCT_ID}}',
{default_price: '{{PRICE_ID}}'}
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ProductParams{DefaultPrice: payske.String("{{PRICE_ID}}")};
result, _ := product.Update("{{PRODUCT_ID}}", params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ProductUpdateOptions { DefaultPrice = "{{PRICE_ID}}" };
var service = new ProductService();
service.Update("{{PRODUCT_ID}}", options);
Lookup keys
Most businesses display pricing information on their website. If these prices are hard-coded and you want to change them, the process is often manual and requires you to deploy new code. To better manage these scenarios, you can use the lookup_key attribute on the Price object. This key allows you to:
- Render different prices in your frontend.
- Use the rendered price to bill customers.
You can pass a lookup_key
when you create a price:
curl https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
--data-urlencode product="{{PRODUCT_ID}}" \
-d unit_amount=1000 \
-d currency=usd \
-d "recurring[interval]"=month \
-d lookup_key=standard_monthly
payske prices create \
--product="{{PRODUCT_ID}}" \
--unit-amount=1000 \
--currency=usd \
-d "recurring[interval]"=month \
--lookup-key=standard_monthly
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.create(
{
product: '{{PRODUCT_ID}}',
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.create(
product="{{PRODUCT_ID}}",
unit_amount=1000,
currency="usd",
recurring={"interval": "month"},
lookup_key="standard_monthly",
)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->create(
[
'product' => '{{PRODUCT_ID}}',
'unit_amount' => 1000,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
'lookup_key' => 'standard_monthly',
]
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceCreateParams params =
PriceCreateParams.builder()
.setProduct("{{PRODUCT_ID}}")
.setUnitAmount(1000L)
.setCurrency("usd")
.setRecurring(
PriceCreateParams.Recurring.builder()
.setInterval(PriceCreateParams.Recurring.Interval.MONTH)
.build()
)
.setLookupKey("standard_monthly")
.build();
Price price = Price.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.create({
product: '{{PRODUCT_ID}}',
unit_amount: 1000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
Product: payske.String("{{PRODUCT_ID}}"),
UnitAmount: payske.Int64(1000),
Currency: payske.String(string(payske.CurrencyUSD)),
Recurring: &payske.PriceRecurringParams{
Interval: payske.String(string(payske.PriceRecurringIntervalMonth)),
},
LookupKey: payske.String("standard_monthly"),
};
result, _ := price.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceCreateOptions
{
Product = "{{PRODUCT_ID}}",
UnitAmount = 1000,
Currency = "usd",
Recurring = new PriceRecurringOptions { Interval = "month" },
LookupKey = "standard_monthly",
};
var service = new PriceService();
service.Create(options);
Instead of hard-coding text like 10 USD per month on your pricing page and using a price ID on your backend, you can query for the price using the standard_monthly
key and then render that in your frontend:
curl -G https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "lookup_keys[]"=standard_monthly
payske prices list \
-d "lookup_keys[0]"=standard_monthly
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.list({lookup_keys: ['standard_monthly']})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.list(lookup_keys=["standard_monthly"])
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->all(['lookup_keys' => ['standard_monthly']]);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceListParams params =
PriceListParams.builder().addLookupKey("standard_monthly").build();
PriceCollection prices = Price.list(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const prices = await payske.prices.list({lookup_keys: ['standard_monthly']});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceListParams{
LookupKeys: []*string{payske.String("standard_monthly")},
};
result := price.List(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceListOptions
{
LookupKeys = new List<string> { "standard_monthly" },
};
var service = new PriceService();
PayskeList<Price> prices = service.List(options);
To optimize performance, you might want to add a caching layer to only reload the price occasionally.
When a customer clicks your subscribe or pay button, you pass the price from the GET
request above into the Subscriptions API.
Now that you can render different prices, if you decide that you want to start charging new users 20 USD per month rather than 10 USD per month, you only need to create a new price and transfer the lookup key to that new price using transfer_lookup_key=true:
Rounding
Rounding occurs on the line item level of your invoices. For example, if you create a price with unit_amount_decimal = 0.05
and a monthly subscription for that [price] with quantity = 30
, rounding occurs after multiplying the quantity by the decimal amount. In this case, the calculated amount for the line item would be 0.05 * 30 = 1.5
, which rounds up to 2 cents. If you have multiple line items, each is rounded up before summing up the total amount for the invoice. This ensures that customers are still charged an integer minor unit amount, as decimal amounts only apply for pricing.
curl https://api.payske.com/v1/prices \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
--data-urlencode product="{{PRODUCT_ID}}" \
-d unit_amount=2000 \
-d currency=usd \
-d "recurring[interval]"=month \
-d lookup_key=standard_monthly \
-d transfer_lookup_key=true
payske prices create \
--product="{{PRODUCT_ID}}" \
--unit-amount=2000 \
--currency=usd \
-d "recurring[interval]"=month \
--lookup-key=standard_monthly \
--transfer-lookup-key=true
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.create(
{
product: '{{PRODUCT_ID}}',
unit_amount: 2000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
transfer_lookup_key: true,
},
)
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.create(
product="{{PRODUCT_ID}}",
unit_amount=2000,
currency="usd",
recurring={"interval": "month"},
lookup_key="standard_monthly",
transfer_lookup_key=True,
)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->create(
[
'product' => '{{PRODUCT_ID}}',
'unit_amount' => 2000,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
'lookup_key' => 'standard_monthly',
'transfer_lookup_key' => true,
]
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PriceCreateParams params =
PriceCreateParams.builder()
.setProduct("{{PRODUCT_ID}}")
.setUnitAmount(2000L)
.setCurrency("usd")
.setRecurring(
PriceCreateParams.Recurring.builder()
.setInterval(PriceCreateParams.Recurring.Interval.MONTH)
.build()
)
.setLookupKey("standard_monthly")
.setTransferLookupKey(true)
.build();
Price price = Price.create(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.create({
product: '{{PRODUCT_ID}}',
unit_amount: 2000,
currency: 'usd',
recurring: {interval: 'month'},
lookup_key: 'standard_monthly',
transfer_lookup_key: true,
});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
Product: payske.String("{{PRODUCT_ID}}"),
UnitAmount: payske.Int64(2000),
Currency: payske.String(string(payske.CurrencyUSD)),
Recurring: &payske.PriceRecurringParams{
Interval: payske.String(string(payske.PriceRecurringIntervalMonth)),
},
LookupKey: payske.String("standard_monthly"),
TransferLookupKey: payske.Bool(true),
};
result, _ := price.New(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceCreateOptions
{
Product = "{{PRODUCT_ID}}",
UnitAmount = 2000,
Currency = "usd",
Recurring = new PriceRecurringOptions { Interval = "month" },
LookupKey = "standard_monthly",
TransferLookupKey = true,
};
var service = new PriceService();
service.Create(options);
Edit a price
Multiple properties can be updated on a price, either in the Dashboard or the API. For example, you can change whether the price is active, or modify its metadata.
Note that you can not change a price’s amount in the API. Instead, we recommend creating a new price for the new amount, switch to the new price’s ID, then update the old price to be inactive.
Dashboard | API
To edit a price through the API, use update price and specify the parameter you want to change. If you don’t specify a parameter, it remains unchanged.
curl https://api.payske.com/v1/prices/id \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d lookup_key=MY_LOOKUP_KEY
payske prices update id \
--lookup-key=MY_LOOKUP_KEY
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.update('id', {lookup_key: 'MY_LOOKUP_KEY'})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.modify("id", lookup_key="MY_LOOKUP_KEY")
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->update('id', ['lookup_key' => 'MY_LOOKUP_KEY']);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Price resource = Price.retrieve("id");
PriceUpdateParams params =
PriceUpdateParams.builder().setLookupKey("MY_LOOKUP_KEY").build();
Price price = resource.update(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.update('id', {lookup_key: 'MY_LOOKUP_KEY'});
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{LookupKey: payske.String("MY_LOOKUP_KEY")};
result, _ := price.Update("id", params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceUpdateOptions { LookupKey = "MY_LOOKUP_KEY" };
var service = new PriceService();
service.Update("id", options);
Archive a price
If you want to disable a price so that it can’t be added to new invoices or subscriptions, you can archive it. If you archive a price, any existing subscriptions that use the price remain active until they’re canceled and any existing payment links that use the product are deactivated.
Dashboard | API
To use the API to archive a price (that is, to indicate that it can’t be used for new purchases), change the active parameter to false
.
curl https://api.payske.com/v1/prices/id \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d lookup_key=MY_LOOKUP_KEY \
-d active=false
payske prices update id \
--lookup-key=MY_LOOKUP_KEY \
--active=false
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.update('id', {lookup_key: 'MY_LOOKUP_KEY', active: false})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.modify("id", lookup_key="MY_LOOKUP_KEY", active=False)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->update('id', ['lookup_key' => 'MY_LOOKUP_KEY', 'active' => false]);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Price resource = Price.retrieve("id");
PriceUpdateParams params =
PriceUpdateParams.builder().setLookupKey("MY_LOOKUP_KEY").setActive(false).build();
Price price = resource.update(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.update(
'id',
{lookup_key: 'MY_LOOKUP_KEY', active: false}
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
LookupKey: payske.String("MY_LOOKUP_KEY"),
Active: payske.Bool(false),
};
result, _ := price.Update("id", params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceUpdateOptions { LookupKey = "MY_LOOKUP_KEY", Active = false };
var service = new PriceService();
service.Update("id", options);
To use the API to unarchive a price (that is, to indicate that it can be used for new purchases), change the active parameter to true
.
curl https://api.payske.com/v1/prices/id \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d lookup_key=MY_LOOKUP_KEY \
-d active=true
payske prices update id \
--lookup-key=MY_LOOKUP_KEY \
--active=true
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Price.update('id', {lookup_key: 'MY_LOOKUP_KEY', active: true})
# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://account.payske.com/api/key
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Price.modify("id", lookup_key="MY_LOOKUP_KEY", active=True)
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
$payske = new \Payske\PayskeClient('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$payske->prices->update('id', ['lookup_key' => 'MY_LOOKUP_KEY', 'active' => true]);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Price resource = Price.retrieve("id");
PriceUpdateParams params =
PriceUpdateParams.builder().setLookupKey("MY_LOOKUP_KEY").setActive(true).build();
Price price = resource.update(params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const price = await payske.prices.update(
'id',
{lookup_key: 'MY_LOOKUP_KEY', active: true}
);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.PriceParams{
LookupKey: payske.String("MY_LOOKUP_KEY"),
Active: payske.Bool(true),
};
result, _ := price.Update("id", params);
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://account.payske.com/api/key
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new PriceUpdateOptions { LookupKey = "MY_LOOKUP_KEY", Active = true };
var service = new PriceService();
service.Update("id", options);
Delete a price
You can only delete prices that you’ve never used. Otherwise, you can archive them.
Dashboard | API
You can’t delete a price through the API. You can archive a price to mark it as active=false
, which indicates that it’s not available for purchase.