Skip to Content
Concepts

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.

One session, three checkouts
  1. Your server or a hosted link
    Session created
    Currency, line items, optional customer data.
  2. Altruon
    Checkout
    Hosted page or Altruon.js renders the routed payment methods.
  3. Result
    Paid, failed or expired
    Single use. Gone after 15 minutes.

Who creates the session

CheckoutWho creates itHow
Hosted pagesAltruonWhen the shopper opens the link, from the page you configured in the backoffice
Dynamic hosted checkoutYour serverPOST /api/session/v1/create with hostedCheckout: true
Altruon.jsYour serverPOST /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

PartFieldsNotes
PaymentpaymentData.currency, optional paymentData.paymentMethodThe currency is required
CartbillingData.billingPlatformId, billingData.lineItemsRequired. Items are plans, charges and add-ons from your billing platform
Pricing optionsbillingData.couponCodes, billingData.forceTrialPeriodDaysSee Coupons and Trials
MetadatabillingData.metadataPassed through to the billing platform when the subscription is created
CustomercustomerData, documentPre-fills dynamic hosted checkout
BehaviorhostedCheckout, redirectUrl, locale
AppearancestyleCustomizationAltruon.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.paymentMethod out. 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 card or pix. 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.