Python Fluent
Read orders and reversals
Use an order handle to read purchased lines, an invoice link and exact reversal amounts.
Use an order handle to read purchased lines, an invoice link and exact reversal
amounts. Authorize the order in your application first. Examples accept the
configured vatly from Configuration.
from vatly_fluent import Vatly
async def example(vatly: Vatly):
order = vatly.order("order_example")
return {
"invoice_url": await order.invoice_url(),
"lines": await order.lines(),
"refundable": await order.refundable_subtotal(),
"partially_reversed": await order.is_partially_reversed(),
"refunds": await order.refunds(),
}
| Method | Return |
|---|---|
model, sync | Cached SDK Order; refresh the handle |
invoice_url | Customer invoice URL or None |
lines | OrderLine models |
reversed_subtotal, refundable_subtotal | Decimal in currency units |
is_reversed, is_fully_reversed, is_partially_reversed | Predicates derived from both totals |
refunds, chargebacks | Local stored records, or an empty list without repositories |
model() and the derived fields share one lazy read; sync() refreshes it. Do not
convert financial values to floats. Preserve each amount's currency from the SDK
resource when combining totals.
Request a full refund
from vatly import RequestOptions
from vatly_fluent import Vatly
async def example(vatly: Vatly):
return await vatly.api.orders.create_full_refund(
"order_example",
{},
options=RequestOptions(idempotency_key="refund:42"),
)
Fluent exposes the raw SDK as vatly.api for operations without a convenience
handle. A timeout is ambiguous; reuse the same refund key instead of issuing a
second refund. Signed reversal events update optional local repositories.