Overview

Build your ideal product catalog with OpenPay using any pricing model—tiered, usage-based, flat-rate, and more. Automate recurring billing, payments, and invoicing, all while offering coupons, free trials, and prorations to scale your business.

Your product catalog consists of product and price objects, which define what you sell and how you price it. In OpenPay, the product catalog hierarchy is as follows:

Product families > Products > Prices > Add-ons

  • Product Families allow you to group various products, prices, and add-ons into organized clusters tied to specific products.

  • Products have prices at which your customers can purchase your product or service.

  • Prices can be configured at different currencies and pricing models.

  • Add-ons are prices that can only be purchased with other prices.

Here’s how you would create a product and price using the admin console or the API:

To create a product, head over to the products tab and click [+Add Product] on the top right.

Once you have created your product, click into the product details to create the prices for that product.

See how you can create add-on prices here:

Add-ons

Add-ons are supplementary charges applied on top of a subscription's main price.

Now you can create subscriptions for your customers using any of these prices:

Create subscription

Experience the ease of creating subscriptions with OpenPay's intuitive design and robust features.

Install and import our clientCopied!

For this recipe, we will use the Python SDK, which you can install using pip install getopenpay or poetry add getopenpay

# Products and Prices are most commonly created via our UI

from getopenpay.client import ApiKeys, OpenPayClient

OP_PUBLISHABLE_TOKEN = 'TODO_YOUR_PUBLISHABLE_TOKEN'
OP_SECRET_TOKEN = 'TODO_YOUR_SECRET_TOKEN'

api_keys = ApiKeys(publishable_key=OP_PUBLISHABLE_TOKEN, secret_key=OP_SECRET_TOKEN)

# sandbox/staging environment
sandbox_host = 'https://connto.openpaystaging.com'

# production environment
production_host = 'https://connto.getopenpay.com'

client = OpenPayClient(api_keys=api_keys, host=sandbox_host)

Create a productCopied!

The Product object is the foundation of every subscription. It is a representation of the service you want to offer on your platform.

Define the attributes of your product. You can link it to an SKU in your existing system, list the features that differentiate this product from the others, and even choose what each unit of this product should be called.

product = client.products.create_product(
  CreateProductRequest(
    name='Standard license',
    description='For personal use',
    account_sku='970000000001',
    features=['Priority support'],
    unit_label='seat',
    is_active=True
  )
)

Create a priceCopied!

Define the value of your Product with a Price object. Our API gives you the ability to create prices as simple or as complex as you want, from basic flat-rate models to tiered models that charge based on usage.

price_amount_atom = 9000 # = $90.00
price = client.prices.create_price_for_product(
  CreatePriceRequest(
    product_id=product.id,
    unit_amount_atom=price_amount_atom,
    is_active=True,
    
    # Simple pricing model with a flat rate and 7-day trial
    pricing_model=PricingModel.STANDARD,
    trial_period_days=7,

    # Bill every month
    price_type=PriceTypeEnum.RECURRING,
    billing_interval=CalendarIntervalEnum.MONTH,
    billing_interval_count=1,
    
    # Require a minimum of two months' commitment
    contract_term_multiple=2,
    contract_auto_renew=True,
  )
)