← Guide

API reference

Base URL https://api.paywio.com/v1. Machine-readable: openapi.json (OpenAPI 3.1). Amounts are integer cents in USD, times are unix seconds, every request needs Authorization: Bearer sk_….

Products

GET /products

List products with their variants

Parameters

limit, starting_afterqueryCursor paging, newest first.

Response · Product

object"product"
idstring
namestring
slugstring
statusstring
delivery_typestring | null
variantsarray of Variant

GET /products/{id}

Retrieve a product

Parameters

idpath, required

Response · Product

object"product"
idstring
namestring
slugstring
statusstring
delivery_typestring | null
variantsarray of Variant

Checkouts

POST /checkouts

Create a checkout

Returns a hosted payment page url that lasts 24 hours. No amount is ever accepted; unknown fields are rejected. An unusable coupon returns 422 with code `coupon_<reason>`.

Request body (JSON)

variant_idstring, required
customer_emailstring
coupon_codestringA coupon of your store; validated on the server.
success_urlstringWhere the buyer returns after paying. Must be https on your storefront address, a live custom domain, or a return domain you allowed in the dashboard.
cancel_urlstringWhere the buyer returns if they cancel. Same rules as `success_url`.
metadataobjectKeys match `[A-Za-z0-9_.-]{1,40}`.

Response · Checkout

object"checkout"
idstring
urlstring
statusopen | complete | expired
livemodeboolean
variant_idstring
metadataobject
createdintegerUnix seconds.
expires_atinteger | nullUnix seconds.

GET /checkouts/{id}

Retrieve a checkout

Parameters

idpath, required

Response · Checkout

object"checkout"
idstring
urlstring
statusopen | complete | expired
livemodeboolean
variant_idstring
metadataobject
createdintegerUnix seconds.
expires_atinteger | nullUnix seconds.

Orders

GET /orders

List orders

Parameters

statusqueryOrder status.
customer_emailqueryExact customer email.
created[gte]queryCreated at or after (unix seconds).
created[lte]queryCreated at or before (unix seconds).
limit, starting_afterqueryCursor paging, newest first.

Response · Order

object"order"
idstring
statusstring
currency"usd"
subtotalinteger
discountinteger
taxinteger
totalinteger
platform_feeinteger
seller_netinteger
product_idstring
variant_idstring
customerobject
customer.idstring
customer.emailstring
customer.countrystring | null
livemodeboolean
paid_atintegerUnix seconds.

GET /orders/{id}

Retrieve an order

Parameters

idpath, required

Response · Order

object"order"
idstring
statusstring
currency"usd"
subtotalinteger
discountinteger
taxinteger
totalinteger
platform_feeinteger
seller_netinteger
product_idstring
variant_idstring
customerobject
customer.idstring
customer.emailstring
customer.countrystring | null
livemodeboolean
paid_atintegerUnix seconds.

POST /orders/{id}/refund

Refund an order

The refund is requested from Stripe; the order status and your balance change when Stripe confirms (an `order.refunded` webhook follows).

Parameters

idpath, required

Request body (JSON)

amountintegerCents to refund. Omit to refund everything that is left.

Response · Refund

object"refund"
idstring
order_idstring
amountinteger
currency"usd"
statusstring
createdintegerUnix seconds.

Customers

GET /customers

List customers

Parameters

emailqueryExact email.
limit, starting_afterqueryCursor paging, newest first.

Response · Customer

object"customer"
idstring
emailstring
namestring | null
countrystring | null
createdintegerUnix seconds.

GET /customers/{id}

Retrieve a customer

Parameters

idpath, required

Response · Customer

object"customer"
idstring
emailstring
namestring | null
countrystring | null
createdintegerUnix seconds.

Subscriptions

GET /subscriptions

List subscriptions

Parameters

statusquerySubscription status.
customer_emailqueryExact customer email.
limit, starting_afterqueryCursor paging, newest first.

Response · Subscription

object"subscription"
idstring
statusactive | past_due | canceled | unpaid | incomplete
product_idstring
variant_idstring
customerobject
customer.idstring
customer.emailstring
customer.countrystring | null
current_period_startinteger | nullUnix seconds.
current_period_endinteger | nullUnix seconds.
cancel_at_period_endboolean
canceled_atinteger | nullUnix seconds.
order_idstring | null
livemodeboolean

GET /subscriptions/{id}

Retrieve a subscription

Parameters

idpath, required

Response · Subscription

object"subscription"
idstring
statusactive | past_due | canceled | unpaid | incomplete
product_idstring
variant_idstring
customerobject
customer.idstring
customer.emailstring
customer.countrystring | null
current_period_startinteger | nullUnix seconds.
current_period_endinteger | nullUnix seconds.
cancel_at_period_endboolean
canceled_atinteger | nullUnix seconds.
order_idstring | null
livemodeboolean

POST /subscriptions/{id}/cancel

Cancel a subscription

Parameters

idpath, required

Request body (JSON)

at_period_endbooleantrue: end at the close of the paid period. false: end now and revoke any license.

Response · Subscription

object"subscription"
idstring
statusactive | past_due | canceled | unpaid | incomplete
product_idstring
variant_idstring
customerobject
customer.idstring
customer.emailstring
customer.countrystring | null
current_period_startinteger | nullUnix seconds.
current_period_endinteger | nullUnix seconds.
cancel_at_period_endboolean
canceled_atinteger | nullUnix seconds.
order_idstring | null
livemodeboolean

License keys

GET /license-keys

List the license keys of an order

For a subscription renewal order the keys of the subscription are returned.

Parameters

order_idquery, required Order id (`ord_…`).

Response · LicenseKey

object"license_key"
idstring
order_idstring
subscription_idstring | null
keystring
statusactive | revoked

Coupons

GET /coupons

List coupons

Parameters

limit, starting_afterqueryCursor paging, newest first.

Response · Coupon

object"coupon"
idstring
codestring
namestring | null
typepercent | amount
percent_offinteger | null
amount_offinteger | null
currencystring | null
starts_atinteger | nullUnix seconds.
expires_atinteger | nullUnix seconds.
max_redemptionsinteger | null
redemptions_countinteger
product_idsarray
activeboolean
createdintegerUnix seconds.

POST /coupons

Create a coupon

Type and value cannot be changed later. A subscription coupon discounts the first payment only.

Request body (JSON)

codestring, required
namestring
typepercent | amount, required
percent_offinteger
amount_offintegerCents.
starts_atintegerUnix seconds.
expires_atintegerUnix seconds.
max_redemptionsinteger
product_idsarrayRestrict to these products. Omit for all.

Response · Coupon

object"coupon"
idstring
codestring
namestring | null
typepercent | amount
percent_offinteger | null
amount_offinteger | null
currencystring | null
starts_atinteger | nullUnix seconds.
expires_atinteger | nullUnix seconds.
max_redemptionsinteger | null
redemptions_countinteger
product_idsarray
activeboolean
createdintegerUnix seconds.

GET /coupons/{id}

Retrieve a coupon

Parameters

idpath, required

Response · Coupon

object"coupon"
idstring
codestring
namestring | null
typepercent | amount
percent_offinteger | null
amount_offinteger | null
currencystring | null
starts_atinteger | nullUnix seconds.
expires_atinteger | nullUnix seconds.
max_redemptionsinteger | null
redemptions_countinteger
product_idsarray
activeboolean
createdintegerUnix seconds.

DELETE /coupons/{id}

Delete a coupon

Parameters

idpath, required

Response · Deleted

objectstring
idstring
deleted"true"

Webhook endpoints

GET /webhook-endpoints

List webhook endpoints of the key's mode

Parameters

limit, starting_afterqueryCursor paging, newest first.

Response · WebhookEndpoint

object"webhook_endpoint"
idstring
urlstring
eventsarray
modelive | test
statusactive | disabled
createdintegerUnix seconds.

POST /webhook-endpoints

Create a webhook endpoint

The mode of the endpoint is the mode of the key. The signing `secret` is returned only here.

Request body (JSON)

urlstring, required https, port 443, public host.
eventsarray

Response · WebhookEndpointWithSecret

object"webhook_endpoint"
idstring
urlstring
eventsarray
modelive | test
statusactive | disabled
createdintegerUnix seconds.
secretstringSigning secret (`whsec_…`), shown only once.

GET /webhook-endpoints/{id}

Retrieve a webhook endpoint

Parameters

idpath, required

Response · WebhookEndpoint

object"webhook_endpoint"
idstring
urlstring
eventsarray
modelive | test
statusactive | disabled
createdintegerUnix seconds.

PATCH /webhook-endpoints/{id}

Update a webhook endpoint

Parameters

idpath, required

Request body (JSON)

urlstring
eventsarray
statusactive | disabled

Response · WebhookEndpoint

object"webhook_endpoint"
idstring
urlstring
eventsarray
modelive | test
statusactive | disabled
createdintegerUnix seconds.

DELETE /webhook-endpoints/{id}

Delete a webhook endpoint

Parameters

idpath, required

Response · Deleted

objectstring
idstring
deleted"true"

POST /webhook-endpoints/{id}/test

Send a test event

Parameters

idpath, required