Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 2.05 KB

OneOffProducts.md

File metadata and controls

60 lines (46 loc) · 2.05 KB

One-off products

Sell a digital product once rather than on a recurring schedule. Create it in the catalog, then pass its ID to a checkout. Examples accept the client from setup.

Create a product

from vatly import VatlyClient
from vatly.models import CreateOneOffProductRequest


def example(client: VatlyClient):
    return client.one_off_products.create(
        CreateOneOffProductRequest(
            name="Python handbook",
            description="A downloadable programming book",
            product_type="ebook",
            base_price={"value": "29.00", "currency": "EUR"},
        )
    )
Input field Type Required?
name, description string Yes
base_price EUR money with a two-decimal string Yes
product_type "saas" or "ebook" Yes
tax_behavior "exclusive" or "inclusive" No

Dictionary inputs use basePrice, productType and taxBehavior. Responses may contain additional product-type strings; the SDK preserves them. That does not make those strings valid creation inputs.

Read, update and archive

from vatly import VatlyClient


def example(client: VatlyClient):
    products = list(client.one_off_products.list_all({"includeArchived": True}))
    product = client.one_off_products.get("one_off_product_example")
    client.one_off_products.update(product.id, {"name": "Revised handbook"})
    client.one_off_products.archive(product.id)
    return products, client.one_off_products.unarchive(product.id)

Archiving stops new sales and returns None. Unarchiving returns the product. Live catalog changes may await approval; test-mode changes are auto-approved.

Response field Meaning
id one_off_product_... catalog ID
name, description Buyer-facing content
base_price, product_type Exact price and category
testmode, links Mode and resource links

Product API reference · All methods