Django
Open the customer portal
The portal lets buyers manage billing, invoices and subscriptions in Vatly.
The portal lets buyers manage billing, invoices and subscriptions in Vatly. Bind a known customer from trusted provisioning code before opening it.
from vatly_django.billing import Billing
def example(billable):
billing = Billing()
# Verify customer_example belongs to this billable before binding.
billing.bind_customer(billable, "customer_example")
return billing.portal(billable)
The sample accepts a saved billable your application has authorized. There is no automatic remote customer creation or email lookup. Bindings are unique in both directions and do not grant order/subscription ownership.
Add a portal button
For a bound, logged-in billable, use the built-in CSRF-protected POST route:
<form method="post" action="{% url 'vatly_django:portal' %}">
{% csrf_token %}
<button type="submit">Manage billing</button>
</form>
| Setting/result | Meaning |
|---|---|
VATLY_PORTAL_REDIRECT_URL | Optional returnUrl link inside the portal |
| 302 | Redirect to a fresh single-use session |
| 400 | No authorized customer binding |
| 502 | Upstream SDK failure |
Never log/cache the credential-bearing URL or accept a browser-supplied customer ID. Each visit creates a short-lived session for the API key's storefront and mode.