Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
python-version: '3.12'
- run: >-
uv run --isolated --no-project --default-index https://pypi.org/simple
--with 'vatly-api-python==0.1.0a2' --with 'pytest>=8,<10'
--refresh-package vatly-api-python
--with 'vatly-api-python==0.1.0a3' --with 'pytest>=8,<10'
--with 'pytest-asyncio>=1,<2' --with 'pyyaml>=6,<7'
python -m pytest -q tests/test_docs.py
18 changes: 14 additions & 4 deletions docs/Orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,32 @@ from vatly import VatlyClient
def example(client: VatlyClient):
order = client.orders.get("order_example")
lines = [(line.product_type, line.product_id, line.quantity) for line in order.lines]
subscription_ids = [
line.related_resources.subscription_id
for line in order.lines
if line.related_resources is not None
]
refundable = Decimal(order.refundable_subtotal.root.value)
return order.status, lines, refundable
return order.status, lines, subscription_ids, refundable
```

| Response field | Meaning |
| --- | --- |
| `id`, `status`, `customer_id` | Order identity and payment state |
| `lines` | OrderLine models with `id`, `product_type`, `product_id`, `quantity` |
| `lines` | OrderLine models with `id`, `product_type`, `product_id`, `quantity`, `related_resources` |
| `refundable_subtotal`, `reversed_subtotal` | Money wrappers; read `.root.value` and `.root.currency` |
| `links.customer_invoice` | Optional customer invoice link |
| `testmode`, `metadata` | Mode and custom data |

`product_type="subscription_plan"` means `product_id` is a plan ID;
`"subscription"` means a subscription ID. Never substitute one for the other.
This alpha has no typed related-resources accessor; extra response fields survive
validation, but application linkage support still needs a package update.

`line.related_resources.subscription_id` is the subscription associated with a
signup, renewal or immediate-update line. `related_resources` is `None` on
historical and unrelated lines. On a signup line, `subscription_id` is `None`
until the subscription is available; read the order again later. An ID alone
does not prove activation or entitlement: check the subscription's ownership and
status before granting access.

## List orders and request an invoice-details link

Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ integration, use Fluent Python or Vatly Django.
## Install and connect

```bash
python -m pip install vatly-api-python==0.1.0a2
python -m pip install vatly-api-python==0.1.0a3
```

Set `VATLY_API_KEY` in your server environment. Test and live keys use the same
Expand Down Expand Up @@ -63,4 +63,4 @@ camelCase wire keys. Unknown response fields are preserved.

[API reference](https://docs.vatly.com/api-reference) contains the complete request
and response contracts. Examples in these guides are executed against published
`0.1.0a2` packages with local HTTP fixtures; tests make no Vatly account changes.
`0.1.0a3` packages with local HTTP fixtures; tests make no Vatly account changes.
Loading