Sessions
A session is one checkout attempt. It carries the currency, the cart and the customer, lasts 15 minutes and is used once.
Every payment on Altruon starts from a session. The session fixes what is being sold and in which currency before the shopper sees a payment form, so the browser can never change the price.
- Your server or a hosted linkSession createdCurrency, line items, optional customer data.
- AltruonCheckoutHosted page or Altruon.js renders the routed payment methods.
- ResultPaid, failed or expiredSingle use. Gone after 15 minutes.
Who creates the session
| Checkout | Who creates it | How |
|---|---|---|
| Hosted pages | Altruon | When the shopper opens the link, from the page you configured in the backoffice |
| Dynamic hosted checkout | Your server | POST /api/session/v1/create with hostedCheckout: true |
| Altruon.js | Your server | POST /api/session/v1/create, then pass the session_id to the browser |
Sessions you create need your secret key, so they are always created from your backend. See Create a session.
What a session holds
| Part | Fields | Notes |
|---|---|---|
| Payment | paymentData.currency, optional paymentData.paymentMethod | The currency is required |
| Cart | billingData.billingPlatformId, billingData.lineItems | Required. Items are plans, charges and add-ons from your billing platform |
| Pricing options | billingData.couponCodes, billingData.forceTrialPeriodDays | See Coupons and Trials |
| Metadata | billingData.metadata | Passed through to the billing platform when the subscription is created |
| Customer | customerData, document | Pre-fills dynamic hosted checkout |
| Behavior | hostedCheckout, redirectUrl, locale | |
| Appearance | styleCustomization | Altruon.js only |
The currency, the line items and the billing platform are set when the session is created and cannot be changed from the browser.
Discovery or a pinned payment method
- Discovery. Leave
paymentData.paymentMethodout. The shopper chooses from every payment method that has a routing entry for the session's currency. After a failed payment, all methods stay available. - Pinned. Pass a method such as
cardorpix. The session is locked to it.
The response tells you which mode applies in payment_method_pinned_at_create.
Lifetime
- A session expires 15 minutes after it is created. The response includes
expires_at. - A session is single use. Once it has been paid it cannot take another payment.
- On dynamic hosted checkout, a shopper whose payment fails comes back to the same URL with the form restored, as long as the session has not expired.
- An expired session cannot be restarted. Create a new one.
- A hosted page link never expires. Each visit creates a fresh session behind it.
Sessions and your tenant
A session belongs to your tenant and only works on your tenant's subdomain. Treat a session id as a one-time checkout token: send a dynamic checkout URL only to the shopper it is meant for.