# Customer data (/docs/checkout/altruon-js/customer-data) Your checkout form collects the shopper's details. Four setter methods pass them to the session before you trigger the payment. This page shows each one and explains which values the browser cannot set. ## What you can set from the browser [#what-you-can-set-from-the-browser] A session needs four values before a payment can start. Three of them are fixed when your server creates the session. | Data | Required | Where you set it | |---|---|---| | Currency (`paymentData.currency`) | Yes | Create Session only. The browser cannot set or change it | | Line items (`billingData.lineItems`) | Yes | Create Session only. The browser cannot change them | | Billing platform (`billingData.billingPlatformId`) | Yes | Create Session only. The browser cannot change it | | Billing address country | Yes | `setAddresses()`, or `customerData.billingAddress.country` on Create Session | | Name, email, phone, IP address | No | `setCustomer()`, or `customerData` on Create Session | | Billing and shipping address | No | `setAddresses()`, or `customerData` on Create Session | | Tax document, card type, wallet username | No | `setPaymentExtra()` | | Coupon codes | No | Create Session only (`billingData.couponCodes`). To change them, create a new session | Apart from the billing address country, every customer field is optional. For the server side, see [Create a session](/docs/api/sessions/create). For coupons, see [Coupons](/docs/subscriptions/coupons). ## When to call the setters [#when-to-call-the-setters] Call them after `setSession()` and before `processPaymentAndSubscription()`. The component can already be on screen: the merchant demo renders it first and calls the setters when the shopper clicks the pay button. ```js altruon.setSession(sessionId); await altruon.renderComponent('#altruon-payment-container'); payButton.addEventListener('click', () => { altruon.setCustomer({ firstName, lastName, email }); altruon.setAddresses({ billing: { street, city, zipCode, country } }); altruon.processPaymentAndSubscription(); }); ``` ## Set the customer [#set-the-customer] ```js altruon.setCustomer({ firstName: 'Jane', lastName: 'Smith', email: 'jane.smith@example.com', phone: '+1234567890', ip: '127.0.0.1', }); ``` All five properties are optional strings. Some acquirers use the IP address. See [`setCustomer`](/docs/sdk/methods#setcustomer) for the full list. ## Set the addresses [#set-the-addresses] Pass the billing address, and a shipping address if it differs. ```js altruon.setAddresses({ billing: { street: '123 Main St', number: 'Apt 4B', city: 'New York', state: 'NY', zipCode: '10001', country: 'US', }, shipping: { street: '456 Oak Ave', city: 'Brooklyn', state: 'NY', zipCode: '11201', country: 'US', }, }); ``` `country` is an ISO 3166-1 alpha-2 code. `number` holds the apartment, suite or unit. `shipping` is optional. See [`setAddresses`](/docs/sdk/methods#setaddresses). A payment cannot complete without a billing address country. Set it with `setAddresses()`, or in `customerData` when you create the session. If it is missing, `onDataRequired` reports it. ## Set extra payment data [#set-extra-payment-data] Some payment methods need data that belongs to the payment, not to the customer. Brazilian payment methods such as Pix need a tax document (CPF or CNPJ). UPI needs the shopper's wallet identifier. ```js altruon.setPaymentExtra({ document: taxDocument, // CPF or CNPJ for Brazilian payment methods cardType: 'visa', // optional card brand hint walletUsername: 'user@upi', // wallet or UPI identifier }); ``` The merchant demo sets the document only when the payment is Brazilian: ```js // PagBrasil (BRL) requires a CPF or CNPJ document on the payment. if (country === 'BR' || currency === 'BRL') { altruon.setPaymentExtra({ document: taxDocument }); } ``` All three properties are optional. See [`setPaymentExtra`](/docs/sdk/methods#setpaymentextra). ## Set billing platform data [#set-billing-platform-data] `setBilling()` passes billing platform data from the browser. ```js altruon.setBilling({ lineItems: [{ type: 'plan', id: '{plan-id}', quantity: 1 }], platformId: '{billing-platform-id}', platformName: 'stripe', }); ``` `lineItems` and `platformId` are required in this object. `platformId` is the same connection ID that the Create Session API calls `billingData.billingPlatformId`. Both values must be on the session when your server creates it, and the browser cannot change them afterwards. `platformName` (for example `stripe` or `chargebee`) and `frequency` (for example `monthly` or `yearly`) are optional. See [`setBilling`](/docs/sdk/methods#setbilling). ## Collect data progressively [#collect-data-progressively] You do not need every value before you show the component. Initialize early, keep the form values in an object, and pass them to the session when the shopper moves on. ```js altruon .init('pk_sandbox_...', 'your-domain') .on('onSuccess', (data) => { window.location.href = `/success?trx_id=${data.transactionId}`; }) .on('onFailure', (error) => { showError(error.message); }); altruon.setSession(sessionId); const customer = {}; for (const field of ['email', 'firstName', 'lastName']) { document.getElementById(field).addEventListener('blur', (event) => { customer[field] = event.target.value; }); } // The shopper finished the details step: pass the data and show the component. document.getElementById('continue-button').addEventListener('click', () => { altruon.setCustomer(customer); altruon.renderComponent('#altruon-payment-container'); }); // The shopper entered the payment details: start the payment. document.getElementById('pay-button').addEventListener('click', () => { altruon.processPaymentAndSubscription(); }); ``` When a value changes later, call the setter again with the complete object. ## When data is missing [#when-data-is-missing] If a payment cannot complete because a value is missing, Altruon.js calls `onDataRequired` with the names of the missing fields, for example `billingAddress.zipCode,phone,document`. Collect them, call the matching setter and trigger the payment again. See [Data required](/docs/checkout/altruon-js/payment-results#data-required). ## Test it [#test-it] In the sandbox, leave a required field empty and click your pay button. `onDataRequired` fires and `requiredFields` names what is missing. Fill the field in, call the setter and trigger the payment again. ## Next steps [#next-steps] # Examples (/docs/checkout/altruon-js/examples) Working code for the most common Altruon.js setups. Start with the merchant demo if you want a complete integration to read, or copy one of the shorter examples below. ## The merchant demo [#the-merchant-demo] The [Altruon merchant demo](https://github.com/Altruon-io/merchant-demo) is the open-source reference integration: a branded SaaS checkout built with React and a minimal Express backend. It uses every Altruon.js method and callback, and every file is commented to be read. ```bash git clone https://github.com/Altruon-io/merchant-demo cd merchant-demo npm run setup cp server/.env.example server/.env # fill in your sandbox keys npm run dev # backend on :4242, frontend on :3030 ``` | What it shows | Where to look | |---|---| | Session creation on the server, with the secret key isolated in one file | [`server/src/altruonClient.js`](https://github.com/Altruon-io/merchant-demo/blob/main/server/src/altruonClient.js), [`server/src/routes.js`](https://github.com/Altruon-io/merchant-demo/blob/main/server/src/routes.js) | | The full Altruon.js flow: init, set session, render, process | [`client/src/pages/CheckoutPage.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/pages/CheckoutPage.jsx) | | Live tax and discount estimates with coupon codes | [`client/src/components/OrderSummary.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/OrderSummary.jsx) | | A notice before a 3D Secure or bank redirect (`onActionRequired` with `REDIRECT`) | [`client/src/components/RedirectModal.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/RedirectModal.jsx) | | A scan-to-pay overlay for Pix and UPI (`onActionRequired` with `QR_CODE`) | [`client/src/components/QrOverlay.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/QrOverlay.jsx) | | Failure handling with a retry on a fresh session | [`client/src/components/FailureModal.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/FailureModal.jsx) | | A transaction report after payment, with deep links to the acquirer and billing dashboards | [`client/src/pages/ResultPage.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/pages/ResultPage.jsx) | | Styling the component to match the host page | `buildStyleCustomization()` in [`server/src/routes.js`](https://github.com/Altruon-io/merchant-demo/blob/main/server/src/routes.js) | ### Server: create the session [#server-create-the-session] The browser never sees the secret key. It calls the demo's own `/api/session` route, which calls Altruon. The route runs when the checkout page mounts, and again when the shopper changes something that needs new pricing, such as a coupon. ```js title="server/src/routes.js" router.post("/session", async (req, res) => { const { customer, country, couponCodes, redirectUrl } = req.body || {}; const data = await createSession({ paymentData: { currency: "USD" }, // After a redirect flow (3D Secure, bank login) Altruon returns the // shopper to this URL with ?trx_id= appended. redirectUrl, billingData: { billingPlatformId: process.env.BILLING_CONNECTION_ID, // Strict ordering: exactly one "plan" item first, then add-ons. lineItems: [{ type: "plan", id: process.env.PLAN_ID, quantity: 1 }], ...(couponCodes?.length ? { couponCodes } : {}), }, customerData: { email: customer?.email, ...(country ? { billingAddress: { country } } : {}), }, // Make the embedded component match the storefront brand. styleCustomization: { accentColor: "#6366F1", borderRadius: "10px" }, }); res.json({ sessionId: data.session_id }); }); ``` `createSession()` lives in `server/src/altruonClient.js`. It sets the `x-secret-key` header, resolves the environment and handles errors. It is the only file in the demo that talks to Altruon with the secret key. ### Browser: bind Altruon.js and pay [#browser-bind-altruonjs-and-pay] ```js title="client/src/pages/CheckoutPage.jsx" // 1. The backend creates the session with the secret key. const { sessionId } = await createCheckoutSession({ couponCodes, redirectUrl }); // 2. Bind Altruon.js to the session and mount the component. altruon .init(publishableKey, tenant) .on("onSuccess", handleSuccess) // go to /result?trx_id=... .on("onFailure", handleFailure) // failure modal; a retry needs a new session .on("onActionRequired", handleActionRequired) // redirect notice or QR overlay .on("onDataRequired", handleDataRequired); altruon.setSession(sessionId); await altruon.renderComponent("#altruon-payment-container"); // 3. When the shopper clicks Subscribe, pass their details to the session // and trigger the payment. altruon.setCustomer({ firstName, lastName, email }); altruon.setAddresses({ billing: { street, city, zipCode, country } }); altruon.processPaymentAndSubscription(); // 4. The outcome arrives through the callbacks registered above. ``` ## Framework examples [#framework-examples] Each component takes a `sessionId` that your server created, loads the script, renders the component and triggers the payment from its own button. ```tsx title="AltruonCheckout.tsx" import { useEffect, useState } from 'react'; type Props = { sessionId: string; customerEmail?: string; onSuccess: (data: { transactionId: string; message: string }) => void; }; export default function AltruonCheckout({ sessionId, customerEmail, onSuccess }: Props) { const [loaded, setLoaded] = useState(false); const [processing, setProcessing] = useState(false); const [error, setError] = useState(null); useEffect(() => { const script = document.createElement('script'); script.src = 'https://cdn.altruon.io/altruon-sdk.min.js'; script.async = true; script.onload = () => { const altruon = (window as any).altruon; altruon .init(process.env.REACT_APP_ALTRUON_PUBLIC_KEY!, 'your-domain') .on('onSuccess', (data: any) => { setProcessing(false); onSuccess(data); }) .on('onFailure', (failure: any) => { setProcessing(false); setError(failure.message); }); altruon.setSession(sessionId); if (customerEmail) altruon.setCustomer({ email: customerEmail }); altruon.renderComponent('#altruon-payment-container'); setLoaded(true); }; document.body.appendChild(script); return () => { document.body.removeChild(script); }; }, []); const pay = () => { setProcessing(true); setError(null); (window as any).altruon.processPaymentAndSubscription(); }; return (
{error &&

{error}

}
{loaded && ( )}
); } ``` The page asks your server for a session, then renders the component. ```tsx title="CheckoutPage.tsx" function CheckoutPage() { const navigate = useNavigate(); const [sessionId, setSessionId] = useState(null); useEffect(() => { fetch('/api/create-checkout-session', { method: 'POST' }) .then((res) => res.json()) .then((data) => setSessionId(data.sessionId)); }, []); if (!sessionId) return
Loading...
; return ( navigate(`/success?trx_id=${data.transactionId}`)} /> ); } ``` ```vue title="AltruonCheckout.vue" ``` ```tsx title="components/AltruonCheckout.tsx" 'use client'; import { useEffect, useState } from 'react'; import Script from 'next/script'; export default function AltruonCheckout({ sessionId }: { sessionId: string }) { const [scriptLoaded, setScriptLoaded] = useState(false); const [processing, setProcessing] = useState(false); const [error, setError] = useState(null); // Initialise once, when the script has loaded. useEffect(() => { if (!scriptLoaded) return; (window as any).altruon .init(process.env.NEXT_PUBLIC_ALTRUON_PUBLIC_KEY!, 'your-domain') .on('onSuccess', (data: any) => { window.location.href = `/success?trx_id=${data.transactionId}`; }) .on('onFailure', (failure: any) => { setError(failure.message); setProcessing(false); }); }, [scriptLoaded]); // Bind and render for each session, including a new one after a failure. useEffect(() => { if (!scriptLoaded) return; const altruon = (window as any).altruon; altruon.setSession(sessionId); document.querySelector('#altruon-payment-container')!.innerHTML = ''; altruon.renderComponent('#altruon-payment-container'); }, [scriptLoaded, sessionId]); const pay = () => { setProcessing(true); setError(null); (window as any).altruon.processPaymentAndSubscription(); }; return ( <> ``` ```bash npm install @altruon/altruon-js ``` ```js import Altruon from '@altruon/altruon-js'; ``` The examples in these docs use the CDN script and its global `altruon` object. ## Build the checkout [#build-the-checkout] ### Create a session on your server [#create-a-session-on-your-server] Call the Create Session API with your secret key. The session holds the currency, the plan and your billing platform connection. These three values can only be set here, not from the browser. `redirectUrl` is where Altruon returns the shopper after a redirect flow such as 3D Secure. `paymentMethod` is optional: leave it out to let the shopper choose. ```bash curl -X POST "https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create" \ -H "Content-Type: application/json" \ -H "x-secret-key: sk_sandbox_..." \ -d '{ "paymentData": { "currency": "USD", "paymentMethod": "card" }, "redirectUrl": "https://yourdomain.com/success", "billingData": { "lineItems": [{ "type": "plan", "id": "{plan-id}", "quantity": 1 }], "billingPlatformId": "{billing-platform-id}" } }' ``` ```js const response = await fetch('https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-secret-key': process.env.ALTRUON_SECRET_KEY, }, body: JSON.stringify({ paymentData: { currency: 'USD', paymentMethod: 'card' }, redirectUrl: 'https://yourdomain.com/success', billingData: { lineItems: [{ type: 'plan', id: '{plan-id}', quantity: 1 }], billingPlatformId: '{billing-platform-id}', }, }), }); const { session_id } = await response.json(); ``` ```python import os import requests response = requests.post( "https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create", headers={ "Content-Type": "application/json", "x-secret-key": os.environ["ALTRUON_SECRET_KEY"], }, json={ "paymentData": {"currency": "USD", "paymentMethod": "card"}, "redirectUrl": "https://yourdomain.com/success", "billingData": { "lineItems": [{"type": "plan", "id": "{plan-id}", "quantity": 1}], "billingPlatformId": "{billing-platform-id}", }, }, ) session_id = response.json()["session_id"] ``` ```ruby require 'httparty' response = HTTParty.post( 'https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', headers: { 'Content-Type' => 'application/json', 'x-secret-key' => ENV['ALTRUON_SECRET_KEY'] }, body: { paymentData: { currency: 'USD', paymentMethod: 'card' }, redirectUrl: 'https://yourdomain.com/success', billingData: { lineItems: [{ type: 'plan', id: '{plan-id}', quantity: 1 }], billingPlatformId: '{billing-platform-id}' } }.to_json ) session_id = response['session_id'] ``` ```php use Illuminate\Support\Facades\Http; $response = Http::withHeaders([ 'Content-Type' => 'application/json', 'x-secret-key' => env('ALTRUON_SECRET_KEY'), ])->post('https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', [ 'paymentData' => ['currency' => 'USD', 'paymentMethod' => 'card'], 'redirectUrl' => 'https://yourdomain.com/success', 'billingData' => [ 'lineItems' => [['type' => 'plan', 'id' => '{plan-id}', 'quantity' => 1]], 'billingPlatformId' => '{billing-platform-id}', ], ]); $sessionId = $response->json()['session_id']; ``` Pass `session_id` to the browser: return it from your own endpoint, such as `/api/session`, or render it into the page template. A session is single use and expires 15 minutes after you create it. These examples call the sandbox. In production the host is `https://{your-domain}.api.altruon.io`. [Create a session](/docs/api/sessions/create) lists every request and response field. ### Add a container to your page [#add-a-container-to-your-page] Load the script and add an empty element where the component goes. Add your own pay button: Altruon.js does not render one. ```html
```
### Initialize Altruon.js and register callbacks [#initialize-altruonjs-and-register-callbacks] Call `init()` once with your publishable key and your Altruon domain. It returns the Altruon instance, so you can chain the callbacks. ```js altruon .init('pk_sandbox_...', 'your-domain') .on('onSuccess', (data) => { window.location.href = `/success?trx_id=${data.transactionId}`; }) .on('onFailure', (error) => { document.getElementById('message').textContent = error.message; }) .on('onActionRequired', (action) => { if (action.actionType === 'REDIRECT') window.location.href = action.redirectUrl; }) .on('onDataRequired', (info) => { document.getElementById('message').textContent = info.message; }); ``` Register the callbacks before you render the component. ### Set the session and render the component [#set-the-session-and-render-the-component] ```js altruon.setSession(sessionId); await altruon.renderComponent('#altruon-payment-container'); ``` What the component shows depends on the session: - With a `paymentMethod` on the session, it shows the fields for that method. - Without one, it follows your routing entries for the currency. Several matching entries give the shopper a drawer to choose a payment method. A single matching entry shows the fields for that method directly, with no drawer. ### Trigger the payment from your button [#trigger-the-payment-from-your-button] Altruon.js does not start the payment by itself. When the shopper clicks your button, pass their details to the session and call `processPaymentAndSubscription()`. ```js document.getElementById('pay-button').addEventListener('click', () => { altruon.setCustomer({ firstName: 'Jane', lastName: 'Smith', email: 'jane.smith@example.com' }); altruon.setAddresses({ billing: { country: 'US' } }); altruon.processPaymentAndSubscription(); }); ``` The billing address country is required. Set it here or when you create the session. Every other customer field is optional. See [Customer data](/docs/checkout/altruon-js/customer-data). ### Handle the result [#handle-the-result] The outcome arrives through the callbacks you registered. `onSuccess` gives you a `transactionId` and nothing else. Send it to your server and read the subscription, customer and invoice with [Get transaction details](/docs/api/transactions/get-details). [Handle payment results](/docs/checkout/altruon-js/payment-results) covers failures, missing data, redirects and QR codes.
## Complete example [#complete-example] A minimal Express server and one HTML page. Replace the placeholders with your sandbox values and point `redirectUrl` and the `onSuccess` handler at your own success page. ```js title="server.js" import express from 'express'; const app = express(); app.use(express.static('public')); app.post('/api/session', async (req, res) => { const response = await fetch('https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-secret-key': process.env.ALTRUON_SECRET_KEY, }, body: JSON.stringify({ paymentData: { currency: 'USD', paymentMethod: 'card' }, redirectUrl: 'https://yourdomain.com/success', billingData: { lineItems: [{ type: 'plan', id: process.env.PLAN_ID, quantity: 1 }], billingPlatformId: process.env.BILLING_PLATFORM_ID, }, }), }); const data = await response.json(); res.status(response.status).json({ sessionId: data.session_id }); }); app.listen(4242); ``` ```html title="public/checkout.html" Checkout

``` ## Test it [#test-it] 1. Start the server and open `http://localhost:4242/checkout.html`. The component appears in the container. 2. Enter a test card from [Testing](/docs/resources/testing) and click your button. 3. `onSuccess` fires and the browser goes to your success page with the transaction ID in the URL. If the component stays empty, check these in order: - The acquirer connection is active and a routing entry exists for the session currency and payment method. - The billing platform connection is valid. - The session request contains `paymentData.currency`, `billingData.lineItems` and `billingData.billingPlatformId`. - The container element exists in the page before you call `renderComponent()`. ## Merchant demo [#merchant-demo] The [Altruon merchant demo](https://github.com/Altruon-io/merchant-demo) is an open-source reference integration: a React checkout with an Express backend that uses every Altruon.js method and callback. [Examples](/docs/checkout/altruon-js/examples#the-merchant-demo) shows how to run it and where each feature lives in the code. ## Next steps [#next-steps] # Handle payment results (/docs/checkout/altruon-js/payment-results) After you call `processPaymentAndSubscription()`, Altruon.js reports the outcome through one of four callbacks. This guide shows what your page and your server do in each case. | Callback | Fires when | What you do | |---|---|---| | `onSuccess` | The payment and the subscription are complete | Send the transaction ID to your server and confirm to the shopper | | `onFailure` | The payment failed | Show the message and offer a retry on a new session | | `onDataRequired` | The payment cannot complete because data is missing | Collect the missing fields and trigger the payment again | | `onActionRequired` | The shopper has one more step: 3D Secure (3DS), a bank page or a QR code | Redirect the shopper or show the QR code | The [Callbacks reference](/docs/sdk/callbacks) lists every payload field. ## Register the callbacks [#register-the-callbacks] Register all four, once, before you call `renderComponent()`. ```js altruon .init('pk_sandbox_...', 'your-domain') .on('onSuccess', handleSuccess) .on('onFailure', handleFailure) .on('onDataRequired', handleDataRequired) .on('onActionRequired', handleActionRequired); altruon.setSession(sessionId); altruon.renderComponent('#altruon-payment-container'); ``` ## Success [#success] `onSuccess` gives you a `transactionId` and a `message`, nothing more. Send the ID to your server, which reads the full result with the secret key, then move the shopper on. ```js async function handleSuccess(data) { await fetch('/api/payment-success', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ transactionId: data.transactionId }), }); window.location.href = `/success?trx_id=${data.transactionId}`; } ``` If the call to your own server fails, the payment has still succeeded. Show the transaction ID so the shopper can quote it to your support team. ## Failure [#failure] `onFailure` gives you a `status` and a `message` written for the shopper. Show the message, re-enable your pay button and offer a retry. ```js function handleFailure(error) { document.getElementById('error-message').textContent = error.message; document.getElementById('pay-button').disabled = false; } ``` The `status` tells you why, for example `declined`, `insufficient_funds` or `expired_card`. See [status values](/docs/sdk/callbacks#status-values) for the list and a suggested action for each. A retry needs a new session: see [Recover from a failed payment](#recover-from-a-failed-payment). ## Data required [#data-required] `onDataRequired` fires when a required value is missing, such as part of the billing address, a phone number or a tax document. `requiredFields` is a comma-separated string of field names, for example `billingAddress.zipCode,phone,document`. Ask the shopper for the missing values, pass them with the setters and trigger the payment again. ```js const customer = {}; // what you passed to setCustomer() const billing = {}; // what you passed to setAddresses() function handleDataRequired(info) { const fields = info.requiredFields.split(',').map((field) => field.trim()); // Your own form: shows info.details and one input per field. askForFields(fields, info.details, (values) => { for (const field of fields) { if (field.startsWith('billingAddress.')) { billing[field.split('.')[1]] = values[field]; } else if (field === 'document') { altruon.setPaymentExtra({ document: values[field] }); } else { customer[field] = values[field]; } } altruon.setCustomer(customer); altruon.setAddresses({ billing }); altruon.processPaymentAndSubscription(); }); } ``` [Customer data](/docs/checkout/altruon-js/customer-data) explains each setter. The field names you can receive are listed under [required fields](/docs/sdk/callbacks#required-fields). ## Action required [#action-required] `onActionRequired` fires when the payment needs one more step from the shopper. `actionType` is `REDIRECT` or `QR_CODE`. ### Redirects [#redirects] 3D Secure and bank authorization happen on another page. Send the shopper to `redirectUrl`. ```js function handleActionRequired(action) { if (action.actionType === 'REDIRECT') { sessionStorage.setItem('paymentInProgress', 'true'); window.location.href = action.redirectUrl; } } ``` After the redirect flow, Altruon returns the shopper to the `redirectUrl` you set on the session, with `?trx_id=` and the transaction ID appended. On that page, read the ID and ask your server for the result. ```js const transactionId = new URLSearchParams(window.location.search).get('trx_id'); if (transactionId) { sessionStorage.removeItem('paymentInProgress'); const response = await fetch(`/api/transactions/${transactionId}`); const details = await response.json(); showResult(details.transaction.status); // success, failed or pending } ``` On mobile, make sure the shopper can return from a 3D Secure or bank redirect. Save what you need before the redirect, as with the `paymentInProgress` flag above, and check the payment status with your server when your page loads again. The merchant demo shows a short notice before it redirects, so the shopper knows why they leave the page. See [`RedirectModal.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/RedirectModal.jsx). ### QR codes [#qr-codes] Pix and UPI are paid by scanning a code. `qrData` is a PNG image as a base64 data URI, so you can use it directly as the `src` of an image. Show it with the `message`. ```html ``` ```js function handleActionRequired(action) { if (action.actionType === 'QR_CODE' && action.qrData) { document.getElementById('qr-message').textContent = action.message; document.getElementById('qr-image').src = action.qrData; document.getElementById('qr-overlay').hidden = false; pollPaymentStatus(); } } ``` The shopper completes the payment outside your page, so keep the code on screen and ask your server whether the payment has arrived. In this example `/api/check-payment-status` is your own endpoint: the page polls it every 3 seconds and stops after 10 minutes. Your server can track the outcome with [webhooks](/docs/api/webhooks), for example the `payment.succeeded` event. ```js function pollPaymentStatus() { const poll = setInterval(async () => { const response = await fetch('/api/check-payment-status'); const { status } = await response.json(); if (status === 'completed') { clearInterval(poll); window.location.href = '/success'; } }, 3000); setTimeout(() => clearInterval(poll), 10 * 60 * 1000); } ``` The merchant demo has a complete scan-to-pay overlay in [`QrOverlay.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/QrOverlay.jsx). ## Fetch transaction details [#fetch-transaction-details] The browser only ever holds the transaction ID. Your server reads the transaction, the customer, the invoice and the subscription with the secret key. ```js title="server.js" app.get('/api/transactions/:id', async (req, res) => { const response = await fetch( `https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/${req.params.id}/details`, { headers: { 'Content-Type': 'application/json', 'x-secret-key': process.env.ALTRUON_SECRET_KEY, }, }, ); res.status(response.status).json(await response.json()); }); ``` Use the result to link the payment to the account in your own system and to store the subscription and invoice IDs from your billing platform. [Get transaction details](/docs/api/transactions/get-details) lists every field. ## Recover from a failed payment [#recover-from-a-failed-payment] A session is single use. After `onFailure`, do not reuse it: ask your server for a new session with the same cart, bind it and render the component again. ```js function handleFailure(error) { showFailureMessage(error.message, { onRetry: retryCheckout }); } async function retryCheckout() { // 1. A new session for the same cart. const response = await fetch('/api/session', { method: 'POST' }); const { sessionId } = await response.json(); // 2. Bind it and mount the component again. Altruon.js appends an iframe // to the container, so clear the previous one first. altruon.setSession(sessionId); document.querySelector('#altruon-payment-container').innerHTML = ''; await altruon.renderComponent('#altruon-payment-container'); } ``` Do not call `init()` again: the callbacks you registered stay in place. The merchant demo implements this pattern in [`FailureModal.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/FailureModal.jsx). ## Test it [#test-it] Trigger each callback in the sandbox. [Testing](/docs/resources/testing) has the card numbers. | Callback | How to trigger it | |---|---| | `onSuccess` | Pay with a card that is approved | | `onFailure` | Pay with a card that is declined | | `onDataRequired` | Leave required fields empty and trigger the payment | | `onActionRequired` with `REDIRECT` | Pay with a card that requires 3D Secure | | `onActionRequired` with `QR_CODE` | Select Pix or UPI as the payment method | ## Troubleshooting [#troubleshooting] 1. Register the callbacks before you call `renderComponent()`. 2. Check that `setSession()` was called with the `session_id` your server returned. 3. Look for errors in the browser console. ```js altruon .init('pk_sandbox_...', 'your-domain') .on('onSuccess', handleSuccess) .on('onFailure', handleFailure); altruon.setSession(sessionId); altruon.renderComponent('#altruon-payment-container'); ``` Altruon.js was initialized more than once. Call `init()` one time per page. ```js if (!window.altruonInitialized) { altruon.init('pk_sandbox_...', 'your-domain'); window.altruonInitialized = true; } ``` Check that `qrData` is present and starts with `data:image/png;base64,` before you set it as the image source. ```js altruon.on('onActionRequired', (action) => { if (action.actionType === 'QR_CODE') { console.log(action.qrData.substring(0, 50)); } }); ``` For problems outside the callbacks, see [Troubleshooting](/docs/resources/troubleshooting). ## Next steps [#next-steps] # Style the component (/docs/checkout/altruon-js/styling) You style the Altruon.js component from your server. Add a `styleCustomization` object to the Create Session request and the component renders with those styles. There is nothing to configure in the browser. Add `styleCustomization` to the request body. The styles are stored with the session. `renderComponent()` applies them automatically. `styleCustomization` styles the embedded component. Hosted pages and dynamic hosted checkout take their appearance from **Settings > Checkout** in the backoffice. ## Style a session [#style-a-session] ### Add styleCustomization to the session [#add-stylecustomization-to-the-session] Every property is optional. This example sets two of them. The rest keep their defaults. ```js title="server.js" body: JSON.stringify({ paymentData: { currency: 'USD' }, redirectUrl: 'https://yourdomain.com/success', billingData: { lineItems: [{ type: 'plan', id: process.env.PLAN_ID, quantity: 1 }], billingPlatformId: process.env.BILLING_PLATFORM_ID, }, styleCustomization: { accentColor: '#6366F1', borderRadius: '10px' }, // [!code highlight] }), ``` ### Render the component as usual [#render-the-component-as-usual] The browser code does not change. The session already has the styles. ```js altruon.setSession(sessionId); altruon.renderComponent('#altruon-payment-container'); ``` ### Check the result [#check-the-result] Open your checkout page. The annotated example below shows which part of the component each property changes. [Style options](/docs/sdk/style-options) lists all nine properties with their types and defaults. ## Theme recipes [#theme-recipes] The merchant demo maps its storefront branding onto the component, so the component looks like part of the host page. ```js title="server/src/routes.js" function buildStyleCustomization(branding = {}) { return { backgroundColor: '#FFFFFF', primaryColor: '#E2E8F0', // input borders and dividers inside the component secondaryColor: '#FFFFFF', accentColor: branding.primaryColor || '#6366F1', // buttons and focus states borderRadius: '10px', headerTextColor: '#0F172A', textColor: '#0F172A', fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif", dropShadow: false, }; } ``` ```js styleCustomization: { backgroundColor: '#1F2937', primaryColor: '#3B82F6', secondaryColor: '#374151', accentColor: '#60A5FA', borderRadius: '8px', headerTextColor: '#F9FAFB', fontFamily: 'Inter, system-ui, sans-serif', textColor: '#E5E7EB', dropShadow: true, } ``` Sharp corners, black on white, no shadow. ```js styleCustomization: { backgroundColor: '#FFFFFF', primaryColor: '#000000', secondaryColor: '#E5E5E5', accentColor: '#000000', borderRadius: '0px', headerTextColor: '#000000', fontFamily: 'Arial, sans-serif', textColor: '#333333', dropShadow: false, } ``` More complete themes are in [Style options](/docs/sdk/style-options#example-themes). ## Different styles per plan [#different-styles-per-plan] Styles are set per session, so your server can choose them at runtime: by plan, by shopper type or by the page the shopper came from. ```js title="server.js" const themes = { basic: { accentColor: '#9CA3AF', borderRadius: '4px', dropShadow: false }, premium: { accentColor: '#60A5FA', borderRadius: '8px', dropShadow: true }, enterprise: { backgroundColor: '#1F2937', textColor: '#F3F4F6', accentColor: '#FBBF24', borderRadius: '12px' }, }; app.post('/create-checkout-session', async (req, res) => { const styleCustomization = themes[req.body.planType] || themes.basic; // Send styleCustomization in the Create Session request body. }); ``` ## Language [#language] The language of the component is also set on the session, with the `locale` field. See [Create a session](/docs/api/sessions/create). ## Accessibility and fonts [#accessibility-and-fonts] - **Contrast.** Keep at least the WCAG AA ratio of 4.5:1 between `textColor` and `backgroundColor`. Dark text such as `#1F2937` on `#FFFFFF` passes. Light gray text such as `#D1D1D1` on `#EFEFEF` does not. - **Focus states.** `accentColor` marks the focused field. Choose a value that stays visible against `backgroundColor`. - **Font fallbacks.** Give `fontFamily` a list, not a single font: `'"YourBrandFont", Arial, sans-serif'`. If the custom font is unavailable, the next one is used. - **Custom fonts.** Load the font on your page before you render the component. - **System fonts.** A system stack such as `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif` needs no download and performs best. ## Test it [#test-it] Create one session per theme you want to compare, then check each one: - Colors match what you set and text is readable. - The font loads. - The corner radius applies to all elements, and the shadow shows if you enabled it. - The component looks right in Chrome, Firefox, Safari and Edge, on iOS and Android, at different screen sizes, and with light and dark system themes. ## Troubleshooting [#troubleshooting] 1. Check that `styleCustomization` is in the Create Session request body. 2. Check that the session was created: the response has a `session_id`. 3. Check the property names for typos. 4. Check that each color is a valid hex, RGB or named value. 1. Make sure the font is loaded on your page before you render the component. 2. Add fallback fonts: `fontFamily: '"CustomFont", Arial, sans-serif'`. 3. If it still fails, use a web-safe or system font. 1. Check the color format (hex, `rgb()` or `rgba()`). 2. If you use `rgba()`, check the transparency value. 3. Compare on more than one device and browser. ## Next steps [#next-steps] # Dynamic hosted checkout (/docs/checkout/dynamic-hosted-checkout) Dynamic hosted checkout sends a shopper to a checkout page hosted by Altruon, with the cart and the customer data defined at runtime by your server. Pick this route when each checkout is unique (plan, customer, coupons) and created from your backend, for example when you replace Stripe Billing hosted pages with Altruon and your billing platform. ## Before you start [#before-you-start] The routing entries for the session currency decide which payment methods the page shows. See [Acquirers](/docs/connections/acquirers) and [Routing](/docs/optimize/routing). You pass its connection ID as `billingData.billingPlatformId`. See [Billing platforms](/docs/connections/billing-platforms). Branding, fields, redirect and skin come from **Settings > Checkout**, the same configuration hosted pages use. See [Set up your checkout appearance](/docs/checkout/hosted-pages#set-up-your-checkout-appearance). Sessions are created with the `x-secret-key` header. See [Authentication](/docs/api/authentication). ## Create a checkout [#create-a-checkout] ### Create the session [#create-the-session] Call the Create Session API from your server with `hostedCheckout: true`, the line items, and the URL the shopper returns to. Add `customerData` to open the form pre-filled. ```bash curl -X POST "https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create" \ -H "Content-Type: application/json" \ -H "x-secret-key: sk_sandbox_..." \ -d '{ "hostedCheckout": true, "paymentData": { "currency": "BRL" }, "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [{ "type": "plan", "id": "price_xxx", "quantity": 1 }] }, "customerData": { "firstName": "João", "lastName": "Silva", "email": "joao@example.com" }, "redirectUrl": "https://your-site.com/success" }' ``` ```js title="server.js" const response = await fetch('https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-secret-key': process.env.ALTRUON_SECRET_KEY, }, body: JSON.stringify({ hostedCheckout: true, // [!code highlight] paymentData: { currency: 'BRL' }, billingData: { billingPlatformId: '3287b8c7-ce43-41fd-9d58-f510e610b8f3', lineItems: [{ type: 'plan', id: 'price_xxx', quantity: 1 }], }, customerData: { firstName: 'João', lastName: 'Silva', email: 'joao@example.com', }, redirectUrl: 'https://your-site.com/success', }), }); const session = await response.json(); ``` ```python title="server.py" import os import requests response = requests.post( 'https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', headers={ 'Content-Type': 'application/json', 'x-secret-key': os.environ['ALTRUON_SECRET_KEY'], }, json={ 'hostedCheckout': True, # [!code highlight] 'paymentData': {'currency': 'BRL'}, 'billingData': { 'billingPlatformId': '3287b8c7-ce43-41fd-9d58-f510e610b8f3', 'lineItems': [{'type': 'plan', 'id': 'price_xxx', 'quantity': 1}], }, 'customerData': { 'firstName': 'João', 'lastName': 'Silva', 'email': 'joao@example.com', }, 'redirectUrl': 'https://your-site.com/success', }, ) session = response.json() ``` In production, call `https://{your-domain}.api.altruon.io` with your production secret key. The [Create Session reference](/docs/api/sessions/create) lists every field. ### Read the response [#read-the-response] Altruon returns the session ID, the checkout URL and the expiry time. ```json { "session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "expires_at": "2026-06-21T12:15:00Z", "checkout_url": "https://{your-domain}.sandbox.altruon.io/checkout/s/a1b2c3d4-e5f6-7890-abcd-ef1234567890", "locale": "pt_br", "payment_method_pinned_at_create": false, "available_payment_methods": [ { "payment_method": "pix", "gateway": "PAGBRASIL", "gateway_connection_id": "..." }, { "payment_method": "card", "gateway": "CHECKOUTCOM", "gateway_connection_id": "..." } ] } ``` ### Redirect the shopper [#redirect-the-shopper] Send the shopper to `checkout_url`. You can also build the URL yourself from `session_id`: ```text https://{your-domain}.altruon.io/checkout/s/{sessionId} Production https://{your-domain}.sandbox.altruon.io/checkout/s/{sessionId} Sandbox ``` Altruon loads the session and renders your branded checkout with the order summary and the fields pre-filled from the session. You do not need a separate update call before the redirect. ### Receive the shopper back [#receive-the-shopper-back] On success, the shopper is redirected to the session's `redirectUrl`, or to the **Redirect URL** of your site's checkout configuration. A subscription is created on your billing platform and the invoice is marked paid. ## Test it [#test-it] 1. Create a session against the sandbox URL with your sandbox secret key. 2. Open `checkout_url` in a browser. Check that the order summary shows the plan and that the fields you sent are filled in. 3. Complete a test payment. See [Testing](/docs/resources/testing) for sandbox test cards. 4. Confirm that you land on your `redirectUrl` and that the subscription exists on your billing platform. ## Pre-fill customer data [#pre-fill-customer-data] When the shopper opens `/checkout/s/{sessionId}`, Altruon pre-populates the form with the `customerData` and the top-level `document` you sent in the Create Session call. This applies to dynamic hosted checkout only: [hosted pages](/docs/checkout/hosted-pages) always start with empty customer fields. ### What gets pre-filled [#what-gets-pre-filled] | Create Session field | Hosted checkout field | |---|---| | `customerData.firstName` | First name (main customer block) | | `customerData.lastName` | Last name (main customer block) | | `customerData.email` | Email | | `customerData.phone` | Phone | | `customerData.billingAddress.street` | Billing address line 1 | | `customerData.billingAddress.number` | Billing address line 2 | | `customerData.billingAddress.city` | City | | `customerData.billingAddress.state` | State or province | | `customerData.billingAddress.zipCode` | Zip or postal code | | `customerData.billingAddress.country` | Country | | `customerData.shippingAddress.*` | Shipping fields, if enabled in the backoffice | | `document` (top level) | PagBrasil CPF or CNPJ on the Pix and card forms | | `billingData.couponCodes` | Pre-applied coupons in the order summary | | `billingData.lineItems` | Plan, add-ons and pricing in the order summary | ### Field visibility [#field-visibility] Only the fields enabled under **Settings > Checkout > Fields** are shown on the page. Data you send for a hidden field is still stored on the session and used at payment time, but the shopper does not see that input. Email and the main first name and last name fields are always collected. The billing and shipping address blocks depend on your field configuration. ### Good practice [#good-practice] - **Send the address early.** Include as much of `billingAddress` as you already know, especially `country`, which is used for tax and routing. Altruon skips its IP-based country guess when the session already provides a country. - **Names inside the billing address.** If your checkout skin shows first name and last name inside the billing address section, set `billingAddress.firstName` and `billingAddress.lastName` as well as `customerData.firstName` and `customerData.lastName`. - **Pre-filled values are a starting point.** They are not locked. The shopper can change them before subscribing. - **Retries keep the data.** After a 3D Secure failure or a card decline, the shopper returns to the same session URL and the form is restored from the saved session data. ### Address and document example [#address-and-document-example] The request in [Create the session](#create-the-session) pre-fills the name and the email only. This `customerData` block adds the phone, the full address and the document for a shopper in Brazil: ```json { "customerData": { "firstName": "João", "lastName": "Silva", "email": "joao@example.com", "phone": "+5511999999999", "billingAddress": { "street": "Av. Paulista", "number": "1000", "city": "São Paulo", "state": "SP", "zipCode": "01310-100", "country": "BR" } }, "document": "12345678909" } ``` ## Session options [#session-options] These fields of the Create Session request shape the hosted page. The [Create Session reference](/docs/api/sessions/create) has the full list with types and limits. | Field | What it does on the hosted page | |---|---| | `hostedCheckout` | Set it to `true`. The response then includes `checkout_url`. Do not combine it with `hostedPageConfigId`. | | `paymentData.paymentMethod` | Omit it to let the shopper choose among all the methods routed for the currency. Set it to show one method only. See [Payment method](#payment-method). | | `customerData`, `document` | Pre-fill the form. See [Pre-fill customer data](#pre-fill-customer-data). | | `locale` | Sets the language of the page. See [Language](#language). | | `billingData.couponCodes` | Pre-applies coupons in the order summary. See [Coupons](/docs/subscriptions/coupons). | | `billingData.metadata` | Attaches your own key and value pairs to the subscription on your billing platform. See [Metadata and custom fields](#metadata-and-custom-fields). | | `billingData.customerCustomFields` | Chargebee only: writes custom fields on the Chargebee customer. | | `billingData.forceTrialPeriodDays` | Overrides the trial length for this checkout. See [Override trial length per checkout](/docs/subscriptions/trials#override-trial-length-per-checkout). | | `redirectUrl` | Where the shopper lands after a successful payment. | ### Full example [#full-example] ```json { "hostedCheckout": true, "paymentData": { "currency": "BRL" }, "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ { "type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1 } ], "couponCodes": ["LAUNCH10"], "metadata": { "field_1": "value_123", "user_id": "user_456" }, "customerCustomFields": { "cf_field1": "value_1", "cf_field2": "value_2" } }, "customerData": { "firstName": "João", "lastName": "Silva", "email": "joao@example.com", "phone": "+5511999999999", "billingAddress": { "street": "Av. Paulista", "number": "1000", "city": "São Paulo", "state": "SP", "zipCode": "01310-100", "country": "BR" } }, "document": "12345678909", "locale": "pt_br", "redirectUrl": "https://your-site.com/subscription/success" } ``` ### Payment method [#payment-method] | You send | Mode | What the shopper sees | `payment_method_pinned_at_create` | |---|---|---|---| | No `paymentData.paymentMethod` | Discovery | Every payment method routed for the currency, for example Pix and card for BRL. All methods stay available if a payment fails. | `false` | | `"paymentMethod": "card"` (or `"pix"`, and so on) | Pinned | Only that method, for the whole session. | `true` | In discovery mode the response lists the routed methods in `available_payment_methods`, as in the example above. ### Language [#language] Set `locale` to `en` or `pt_br`. The API also accepts `pt-BR`, `pt` and `en-US`. Unsupported values fall back to English. When you omit `locale`, the hosted page picks the language from the currency: Portuguese for BRL, English for every other currency. ### Metadata and custom fields [#metadata-and-custom-fields] `billingData.metadata` attaches your key and value pairs to the subscription on your billing platform: subscription metadata on Stripe Billing, `meta_data` on Chargebee. It is the equivalent of `subscription_data.metadata` on Stripe hosted checkout. When Chargebee is the billing platform for the checkout, pass customer custom fields in `billingData.customerCustomFields`: - Altruon sends every key that starts with `cf_`, such as `cf_field1` or `cf_field2`, on the Chargebee customer create call. - Keys that do not start with `cf_` are rejected. - The map is separate from `billingData.metadata`. Metadata is stored on the subscription, `customerCustomFields` is written on the Chargebee customer. - Set the map when you create the session. It is not returned to the shopper, and the hosted page cannot change it. ### Document for Brazil [#document-for-brazil] Set the top-level `document` field to pre-fill the PagBrasil CPF or CNPJ on the Pix and card forms. ## Appearance [#appearance] The logo, the colors, the Classic or Neo skin and the redirect after payment come from **Settings > Checkout**. The per-session `styleCustomization` object does not apply here: it styles the embedded [Altruon.js](/docs/checkout/altruon-js/styling) component only. ## Failed payments [#failed-payments] If a card payment fails after a redirect to the acquirer, for example a failed 3D Secure challenge or a decline, the shopper returns to the same `/checkout/s/{sessionId}` URL. The form data is restored so they can retry while the session is still valid. ## Session expiry [#session-expiry] A session expires 15 minutes after you create it. An expired dynamic session cannot be restarted from the checkout page: create a new session from your server and redirect the shopper again. ## Security [#security] - Create sessions only from your server, with the `x-secret-key` header. Never expose the secret key in the browser. - Sessions are scoped to your subdomain. A session created for one Altruon domain cannot be loaded on another. - The session ID is the access token for that checkout. Treat it like a single-use checkout token and share the URL only with the intended shopper. ## Differences from hosted pages [#differences-from-hosted-pages] | | Hosted pages (`/checkout/p/{id}`) | Dynamic hosted checkout (`/checkout/s/{sessionId}`) | |---|---|---| | **Setup** | Created in the backoffice under **Settings > Hosted Pages** | Created with the Create Session API from your server | | **Cart and customer** | Fixed per link, editable in the backoffice | Passed in each API call | | **URL** | Opaque hosted page ID | Session ID from the API response | | **Conversion analytics** | Per-link stats in the backoffice | Not tracked in **Settings > Hosted Pages**, because there is no static configuration | | **Session expiry** | The shopper can restart from the same link | You must create a new session | | **Branding** | Site checkout configuration, Classic or Neo skin | The same site checkout configuration | | **Customer pre-fill** | No. The shopper enters all details | Yes, from `customerData` in the Create Session call | See [Choose your checkout](/docs/checkout) for the comparison with Altruon.js. ## Next steps [#next-steps] # Hosted pages (/docs/checkout/hosted-pages) A hosted page is a reusable checkout link that Altruon hosts for you. You build it in the backoffice: each link carries its own plan, add-ons, coupons and currency, and reports its own conversion stats. Pick this route when you want to sell a plan from a link without writing code. Pick the plan, currency, coupons and add-ons in the backoffice. From your pricing page, an email or your CRM. Creates a single-use session, renders your branded page and takes the payment. The invoice is marked paid. ## Before you start [#before-you-start] You can sign in to your sandbox backoffice. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). The routing entries for a currency decide which payment methods the checkout shows. See [Acquirers](/docs/connections/acquirers) and [Routing](/docs/optimize/routing). Only active connections can be selected on a hosted page. See [Billing platforms](/docs/connections/billing-platforms). These are the platform setup steps of the [quickstart](/docs/get-started/quickstart). ## How the configuration is split [#how-the-configuration-is-split] Hosted pages are configured in two layers: | Layer | Where | What it holds | Scope | |---|---|---|---| | Checkout appearance | **Settings > Checkout** | Branding, the customer fields you collect, the redirect after payment, the page skin | Set once, applied to all your hosted pages | | Hosted pages | **Settings > Hosted Pages** | One named checkout link per page, with its own plan, add-ons, coupons and currency | As many as you need: one per plan, per campaign, per region | ## Set up your checkout appearance [#set-up-your-checkout-appearance] You do this once for the whole site. [Dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout) uses the same configuration. ### Set your branding [#set-your-branding] Go to **Settings > Checkout** and open the **Configuration** tab. Fill in: | Setting | What it does | |---|---| | **Your logo** | Click to upload a JPG or PNG. A square image works best. Shown in the checkout header. | | **Brand color** | Colors the Subscribe button and the interactive elements. | | **Company Display name** | Shown at checkout and used on bank statements. | | **Terms & Conditions URL** | Linked from the consent checkbox. Used by the Neo skin. | | **Redirect URL** | Where shoppers land after a successful payment, for example `https://your-website.com/thank-you`. | Then pick a **Hosted page skin**: - **Classic**: a traditional two-column layout with the order summary on the right. - **Neo**: a split layout with the pricing summary on the left and the payment on the right. Click **Save** at the bottom right. ### Choose the fields you collect [#choose-the-fields-you-collect] In the same **Checkout** section, open the **Fields** tab and toggle what the checkout asks for: | Toggle | Fields | |---|---| | **Billing address** | First name, Last name, Address line 1, Address line 2, City, Zipcode, Country. Each field has its own toggle. | | **Shipping address** | The same set of fields, collected separately. | | **Coupon code** | Lets shoppers type their own coupon codes on the checkout page. This is independent from the coupons you pre-apply on a hosted page. | First name, last name and email are always collected, whatever you toggle here. We recommend enabling **Billing address** with Address line 1, City, Zipcode and Country. Click **Save** at the bottom right. ## Create a hosted page [#create-a-hosted-page] ### Open the hosted pages list [#open-the-hosted-pages-list] Go to **Settings > Hosted Pages** and click **New hosted page** at the top right. ### Configure the page [#configure-the-page] In the **Create hosted page** modal, fill in: | Field | Description | |---|---| | **Name** | A label for your own use, for example `Pro Plan Annual (US)`. Shoppers never see it. | | **Billing Platform** | The billing platform connection the subscription is created on. Only active connections are listed. | | **Product Family**, **Item**, **Item Price** | Drill down through your billing platform's catalog to the exact plan price this link sells. | | **Currency** | Asked only when the selected plan price supports several currencies. The payment methods at checkout are the ones your routing entries map to this currency. | | **Coupon codes** (optional) | Discount codes that are pre-applied and built into the link, for example for a promotion. Shoppers do not type anything. | | **Add Addons** (optional) | Recurring add-ons from your catalog, each with its own quantity or a flat fee. Available once an **Item Price** is selected. | Click **Create**. The page is saved as **Active** and works straight away. ### Share the link [#share-the-link] Copy the URL from the **Link** column, or use the **Copy link** action. Put it on your pricing page, in an email, or send it from your CRM. ```text https://{your-domain}.altruon.io/checkout/p/{id} Production https://{your-domain}.sandbox.altruon.io/checkout/p/{id} Sandbox ``` The URL is opaque: it contains only the hosted page ID. The plan, add-ons, coupons and currency are resolved on Altruon's servers at every visit, so a shopper cannot tamper with them, and you can edit the configuration later without changing the link. ## Test it [#test-it] 1. Open your hosted page link in a browser. 2. Check the page: your logo and colors, the configured plan and any pre-applied coupons in the order summary, the fields you enabled, and the payment methods routed for the currency. 3. Complete a test payment. See [Testing](/docs/resources/testing) for sandbox test cards. Once the payment succeeds: - The shopper is redirected to your **Redirect URL**. - A subscription is created on your billing platform. - The invoice is marked paid. - The transaction is recorded with the acquirer's own transaction ID. - The page's **Converted** counter and its conversion rate update. Altruon then collects the recurring charges until the subscription is paused or canceled. ## Manage your hosted pages [#manage-your-hosted-pages] The list under **Settings > Hosted Pages** is where you track and maintain your links. ### Track conversion [#track-conversion] Each page shows its own numbers. Summary cards at the top aggregate them across all pages. | Column | Meaning | |---|---| | **Sessions** | Checkouts opened from the link | | **Converted** | Completed payments | | **Expired** | Sessions that expired without a completed payment | | Conversion rate | Converted sessions as a share of sessions opened | ### Statuses [#statuses] A hosted page is always in one of three states: | Status | Behavior | |---|---| | **Active** | The link works and shoppers can check out. New pages are created Active. | | **Draft** | Prepared but not live: the link is rejected at checkout. Set it from the **Edit** modal. | | **Archived** | Disabled: the link is rejected at checkout. Use **Archive** and **Reactivate** in the list to switch. | ### Edit a page [#edit-a-page] Click **Edit** to change the name, status, plan, currency, coupons or add-ons. The link itself never changes, so every copy you have already shared keeps working with the updated configuration. ## Sessions and expiry [#sessions-and-expiry] Each visit to a hosted page opens its own session. A session is single use and expires after 15 minutes. Expired sessions count in the **Expired** column. The link itself does not expire: the shopper can open it again to start over. ## Limits [#limits] - **No pre-filled customer data.** Customer fields always start empty on a hosted page. To open the form with the shopper's details already filled in, use [dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout). - **No trial override.** `billingData.forceTrialPeriodDays` is not available on hosted pages. A trial configured on the plan in your billing catalog still applies. See [Trials](/docs/subscriptions/trials). - **One fixed cart per link.** If the plan, the customer or the coupons are decided at runtime by your server, use dynamic hosted checkout. ## Next steps [#next-steps] # Choose your checkout (/docs/checkout) Altruon gives you three ways to put a checkout in front of a shopper. All three run on the same session, the same routing entries and the same billing sync, so you can start with one and add another later, or run several side by side. Reusable checkout links you build in the backoffice, one per plan, with conversion stats per link. Your server creates a session with the cart and the customer, then redirects the shopper to an Altruon-hosted page. Altruon's payment component inside your own checkout page. Results come back through callbacks. ## Compare the three [#compare-the-three] | | Hosted pages | Dynamic hosted checkout | Altruon.js | |---|---|---|---| | **What it is** | A reusable checkout link, fully hosted by Altruon and configured in the backoffice | An Altruon-hosted checkout page for a session your server creates at runtime | Altruon's payment component embedded in your own checkout page | | **Code needed** | None | One server-side call to the Create Session API, then a redirect | A server endpoint that creates the session, plus frontend code that renders the component and handles callbacks | | **Where the cart comes from** | Fixed per link: plan, currency, add-ons and coupons are set in **Settings > Hosted Pages** and can be edited there | Passed in each Create Session call | Passed in each Create Session call | | **Where customer data comes from** | The shopper types everything. Fields always start empty | `customerData` and `document` in the Create Session call pre-fill the form. The shopper can edit the values | Your page collects it and passes it from the browser with `altruon.setCustomer()` and `altruon.setAddresses()` | | **URL pattern** | `https://{your-domain}.altruon.io/checkout/p/{id}` | `https://{your-domain}.altruon.io/checkout/s/{sessionId}` | Your own URL | | **Styling** | **Settings > Checkout**: logo, brand color, company name, Classic or Neo skin | The same **Settings > Checkout** configuration | Your page and your design. `styleCustomization` on the session styles the component | | **Trial override** (`billingData.forceTrialPeriodDays`) | Not supported. A trial set on the plan in your billing catalog still applies | Supported | Supported | | **After the payment** | The shopper is redirected to the **Redirect URL** from **Settings > Checkout** | The shopper is redirected to the session's `redirectUrl` | Your page receives a callback: `onSuccess`, `onFailure`, `onActionRequired` or `onDataRequired` | | **When a session expires** | The shopper restarts from the same link | Your server creates a new session | Your server creates a new session | | **Best for** | Marketing links, campaigns, payment links in emails and invoices, sales-assisted checkout | Checkouts where your server already knows the plan, the customer and the context: a CRM, a game launcher, a subscription upgrade flow | SaaS signup flows and custom checkout experiences | ## What all three share [#what-all-three-share] A hosted link, a session URL or your own page. Shows the payment methods routed for the currency and takes the payment. The acquirer your routing entry points to. The first invoice is marked paid. ### The same setup [#the-same-setup] Every option needs the platform setup from the [quickstart](/docs/get-started/quickstart): a connected acquirer, at least one routing entry, and a connected billing platform. Hosted pages and dynamic hosted checkout also share one appearance configuration under **Settings > Checkout**. ### The same session [#the-same-session] Every checkout runs on a [session](/docs/concepts/sessions). A session is single use and expires 15 minutes after it is created. - With hosted pages, Altruon creates the session for you each time a shopper opens the link. - With dynamic hosted checkout and Altruon.js, your server creates it with `POST /api/session/v1/create` and your secret key. The secret key never reaches the browser. ### The same routing [#the-same-routing] The payment methods a shopper sees are the ones your [routing entries](/docs/optimize/routing) map to the session currency. If you create the session yourself, you can leave the choice to the shopper or pass `paymentData.paymentMethod` to show one method only. ### The same billing sync [#the-same-billing-sync] Once a payment completes, on any of the three: - A subscription is created on your billing platform. - The invoice is marked paid. - The transaction is recorded with the acquirer's own transaction ID. - Altruon collects the recurring charges until the subscription is paused or canceled. [Trials](/docs/subscriptions/trials) set on the plan and [coupons](/docs/subscriptions/coupons) work on all three. See [How billing sync works](/docs/subscriptions) for the detail. ## How to decide [#how-to-decide] 1. **You want a link and no code.** Use [hosted pages](/docs/checkout/hosted-pages). You build each link in the backoffice, share it, and read its conversion stats there. 2. **Each checkout is different, and Altruon should host the page.** Use [dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout). Your server decides the plan, the coupons, the trial length and the customer details for each shopper, and the hosted form opens pre-filled. 3. **The shopper should stay on your own page.** Use [Altruon.js](/docs/checkout/altruon-js). You own the page and the customer form, and the component handles the payment fields. You can combine them. For example, use hosted pages for sales-led deals and Altruon.js for your self-serve signup flow. ## Next steps [#next-steps] # Glossary (/docs/concepts/glossary) | Term | Meaning | |---|---| | Acquirer | The provider that authorizes and settles a payment, for example Adyen or Checkout.com. The backoffice lists acquirers under **Payment Gateways**. You bring your own account. | | Acquirer connection | The credentials and settings that let Altruon send payments to one of your acquirer accounts. | | Altruon.js | The JavaScript library that renders Altruon's payment component inside your own page. | | Altruon Vault | Altruon's PCI Level 1 vault. It stores a card once so it can be charged on any acquirer you connect. | | Backoffice | The Altruon dashboard where you manage connections, routing, checkout, hosted pages, webhooks and keys. | | Billing platform | The system that owns your plans, subscriptions and invoices: Stripe Billing, Chargebee, Recurly or Frisbii. | | CIT | Customer-initiated transaction. A payment made with the shopper present, such as the first payment at checkout. | | Discovery mode | A session created without a payment method. The shopper chooses from every method routed for the currency. | | Dunning | The period after a renewal fails, while the payment is retried. | | Dynamic hosted checkout | A checkout page hosted by Altruon for a session your server created. URL: `/checkout/s/{sessionId}`. | | Hosted page | A reusable checkout link configured in the backoffice. URL: `/checkout/p/{id}`. | | Line item | One entry of the cart in a session: a plan, a one-off charge or an add-on from your billing platform. | | MIT | Merchant-initiated transaction. A payment made without the shopper present, such as a renewal. | | Network token | A token issued by a card network that stands in for a card number and keeps working when the card is reissued. | | Pinned payment method | A session created with a specific payment method. The shopper cannot switch. | | Provider webhook | A webhook from an acquirer or billing platform to Altruon. See [Webhooks](/docs/concepts/webhooks). | | Publishable key | The API key used in the browser to initialize Altruon.js. | | Routing entry | A rule that sends one payment method in one currency to one acquirer. | | Secret key | The API key used on your server, in the `x-secret-key` header. | | Session | One checkout attempt. Single use, valid for 15 minutes. See [Sessions](/docs/concepts/sessions). | | Shopper | The person paying at checkout. | | Tenant | Your workspace on Altruon. Its subdomain is part of your API and checkout URLs. | | Trial | A subscription that starts with nothing due today. A reusable payment method is stored and charged when the trial ends. | | Write-back | Altruon recording a payment result on the invoice in your billing platform. | # Payment lifecycle (/docs/concepts/payment-lifecycle) A subscription has two kinds of payment. The first one happens with the shopper present, at checkout. Every later one is a renewal that Altruon collects without the shopper. Both end the same way: with the result written to the invoice on your billing platform. ## First payment [#first-payment] - The amount comes from your billing platform. Before payment, Altruon asks it for an estimate that includes price, tax, coupons, any trial and the amount due now. - Altruon sends the charge to the acquirer that your [routing entries](/docs/optimize/routing) select for the payment method and currency. - The subscription is created on the billing platform only after the payment succeeds, or after the payment method is stored for a trial. - The first invoice is marked as paid with a reference built from the acquirer, the payment method and the acquirer's transaction id. Some payment methods finish later than the checkout: a 3D Secure challenge, a redirect, a Pix QR code. The acquirer then tells Altruon the outcome through its webhook, and Altruon completes the same steps. ## Trials [#trials] With a trial, nothing is due today. Checkout stores a reusable payment method instead of charging it: | Mode | When it is used | |---|---| | `CHARGE` | A normal payment | | `SETUP` | A card is tokenized at zero amount | | `CONSENT` | The shopper gives a Pix or UPI consent | | `MANDATE` | The shopper signs an open-banking mandate | When the trial ends, the billing platform activates the subscription and raises an invoice. Altruon collects it with the stored method. See [Trials](/docs/subscriptions/trials). ## Renewals [#renewals] The billing platform owns the schedule. When an invoice is due it notifies Altruon, Altruon charges the stored payment method, and the payment is recorded on that invoice. For Pix Automático and UPI, a pre-debit notice is sent to the shopper before each debit. Changes on the billing platform flow the other way too: Altruon follows the subscription as it becomes active, enters a trial, is paused or is canceled. ## When a renewal fails [#when-a-renewal-fails] The invoice moves to dunning with a retry count and a next retry date. Altruon then retries according to your settings, and when retries run out it applies the end action you chose: cancel the subscription on the billing platform, flag the invoice as dunning exhausted, or stop retrying. See [Retries and dunning](/docs/optimize/retries-and-dunning). ## Invoice statuses [#invoice-statuses] | Status | Meaning | |---|---| | Paid | The payment was collected and recorded | | Payment due | The invoice is open and no attempt has succeeded yet | | Dunning | A renewal failed and retries are scheduled | | Dunning exhausted | Retries ran out | | Refunded | The payment was refunded | | Voided | The invoice was voided on the billing platform | | Chargeback | The payment was disputed and reversed | ## Events you can listen to [#events-you-can-listen-to] Each stage emits a webhook event to your server, for example `checkout.session.completed`, `payment.succeeded`, `invoice.paid`, `invoice.dunning_started` and `payment.retry_failed`. The full list is in [Event types](/docs/api/webhooks/events). Webhook payloads are thin: they say what happened and to which resource. Fetch the current state with [Get transaction details](/docs/api/transactions/get-details). ## Related [#related] # Sessions (/docs/concepts/sessions) 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. Currency, line items, optional customer data. Hosted page or Altruon.js renders the routed payment methods. Single use. Gone after 15 minutes. ## Who creates the session [#who-creates-the-session] | Checkout | Who creates it | How | |---|---|---| | [Hosted pages](/docs/checkout/hosted-pages) | Altruon | When the shopper opens the link, from the page you configured in the backoffice | | [Dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout) | Your server | `POST /api/session/v1/create` with `hostedCheckout: true` | | [Altruon.js](/docs/checkout/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](/docs/api/sessions/create). ## What a session holds [#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](/docs/subscriptions/coupons) and [Trials](/docs/subscriptions/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-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 [#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 [#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. ## Related [#related] # Webhooks (/docs/concepts/webhooks) "Webhook" means two different things in an Altruon integration. Mixing them up is the most common setup mistake, so this page separates them. | | Provider webhooks | Altruon webhooks | |---|---|---| | Direction | Acquirer or billing platform to Altruon | Altruon to your server | | Why | Altruon learns that a payment settled, an invoice is due or a subscription changed | You learn that a subscription, invoice, payment or session changed | | Required | Yes. Payments and renewals depend on them | Optional, and recommended | | Where you set it up | In the provider's dashboard, with a URL that Altruon gives you | In the Altruon backoffice, **Settings > Webhooks** | | Guide | Each [connection guide](/docs/connections) | [Webhooks](/docs/api/webhooks) | ## Provider webhooks: into Altruon [#provider-webhooks-into-altruon] Altruon relies on these to finish anything asynchronous: a 3D Secure challenge that completes later, a Pix payment, a direct debit, a trial that becomes an active subscription, a renewal that falls due. There are two families, acquirer webhooks and billing platform webhooks, and providers differ in how they are set up: - Some need you to copy an endpoint URL from Altruon into the provider's dashboard. - Some are registered for you when you connect. - Some are configured by the provider's support team. Follow the webhook step in the guide for each provider you connect. If a provider webhook is missing, payments can stay pending and renewals are not collected. ## Altruon webhooks: to your server [#altruon-webhooks-to-your-server] You register an HTTPS endpoint, choose the events it receives, and get a signing secret. Altruon then posts a signed JSON event each time one of those events happens. - Up to 2 active endpoints per site. - Events are signed with HMAC-SHA256 in the `Altruon-Signature` header. - A delivery succeeds when your server answers with a 2xx within 10 seconds. Failed deliveries are retried, up to 4 attempts in total. - Payloads are thin. Treat an event as a trigger and fetch the current state from the API. Start with [Webhooks](/docs/api/webhooks), then [Event types](/docs/api/webhooks/events) and [Verify signatures](/docs/api/webhooks/signatures). ## Which one do I need to debug [#which-one-do-i-need-to-debug] | Symptom | Look at | |---|---| | A payment stays pending in Altruon | The acquirer's webhook to Altruon | | Renewals are not collected | The billing platform's webhook to Altruon | | A trial never becomes active | The billing platform's webhook to Altruon | | Your server is not notified | The endpoint under **Settings > Webhooks** and its delivery log | More in [Troubleshooting](/docs/resources/troubleshooting). # Build with AI (/docs/get-started/build-with-ai) The docs are published for AI coding assistants as well as for people. Point your assistant at the files below and it can plan and write an Altruon integration with the same facts you see here. ## What is available [#what-is-available] | File | What it is | Use it for | |---|---|---| | [`/SKILL.md`](https://docs.altruon.io/SKILL.md) | An operating guide written for agents: mental model, setup order, the three checkout options, the API, billing platforms, trials, webhooks, troubleshooting | The first thing an agent should read | | [`/llms.txt`](https://docs.altruon.io/llms.txt) | An index of every page with its description | Letting an agent find the right page | | [`/llms-full.txt`](https://docs.altruon.io/llms-full.txt) | The full text of the docs in one file | Loading everything into context | | Copy Markdown | The button under every page title copies that page as Markdown | Pasting one page into a chat | ## What SKILL.md covers [#what-skillmd-covers] - The product model: tenant, session, routing entry, acquirer and billing connections, trials, coupons. - The setup order that always works: acquirer, routing, billing platform, then checkout. - The three checkout options: hosted pages (`/checkout/p/{id}`), dynamic hosted checkout (`/checkout/s/{sessionId}`) and Altruon.js, with its methods and callbacks. - Session API essentials: discovery or pinned payment method, customer pre-fill, locale, metadata, Chargebee customer custom fields, and the error codes. - Billing platforms: how sync works on each one, and [Altruon Billing](/docs/subscriptions/altruon-billing). - Trials: catalog trials, `forceTrialPeriodDays`, and which acquirer and method pairs support them. - Acquirers and payment methods, routing, retries and dunning, the Altruon Vault, network tokens, account updater and 3D Secure. - Environments, keys and what must stay on your server. - Both webhook directions: provider webhooks into Altruon, and [Altruon webhooks](/docs/api/webhooks) to your server. - A troubleshooting sequence and what to send to support. ## Use it with a coding assistant [#use-it-with-a-coding-assistant] ### Give it the guide [#give-it-the-guide] Add `https://docs.altruon.io/SKILL.md` to your assistant's context, or save the file in your repository where your assistant looks for skills or rules. ### Say which checkout you are building [#say-which-checkout-you-are-building] Hosted pages, dynamic hosted checkout or Altruon.js. The setup and the code differ. See [Choose your checkout](/docs/checkout). ### Point it at the reference for exact fields [#point-it-at-the-reference-for-exact-fields] [Create a session](/docs/api/sessions/create) is the request contract. [Callbacks](/docs/sdk/callbacks) lists every payload Altruon.js hands to your page. Do not paste your secret key into a chat. Use a placeholder such as `sk_sandbox_...` and set the real value in your environment. ## A working example to learn from [#a-working-example-to-learn-from] The [Altruon merchant demo](https://github.com/Altruon-io/merchant-demo) is a complete, commented Altruon.js integration (React and Express). Assistants do well when you ask them to follow its structure. # Go-live checklist (/docs/get-started/go-live) Production is a separate environment. Nothing you set up in the sandbox carries over, so going live means repeating the setup with live credentials and checking each link in the chain once. ## Connections [#connections] Use [login.altruon.io](https://login.altruon.io). Sandbox credentials do not work here. Follow the same guide as in the sandbox: [Acquirers](/docs/connections/acquirers). Altruon needs the acquirer's webhook to finalize asynchronous payments. The production webhook URL differs from the sandbox one. See [Billing platforms](/docs/connections/billing-platforms). Renewals start from the billing platform's invoice webhook. Without it, renewals are not collected. ## Routing [#routing] A payment method without a routing entry for the session's currency does not appear at checkout. See [Routing](/docs/optimize/routing). If you offer trials, confirm that each acquirer and payment method pair supports them. See [Trials](/docs/subscriptions/trials). ## Checkout [#checkout] Your server uses the production secret key and `https://{your-domain}.api.altruon.io`. Your page uses the production publishable key. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Create sessions only from your backend. Only the publishable key belongs in the browser. Branding, fields and redirect URL under **Settings > Checkout** apply to hosted pages and to dynamic hosted checkout. Only hosted pages with the status Active resolve. See [Hosted pages](/docs/checkout/hosted-pages). If you use Altruon.js, handle success, failure, data required and action required. See [Handle payment results](/docs/checkout/altruon-js/payment-results). ## Your server [#your-server] Add your HTTPS endpoint under **Settings > Webhooks** and select the events you need. See [Webhooks](/docs/api/webhooks). Check the `Altruon-Signature` header against the raw request body. See [Verify signatures](/docs/api/webhooks/signatures). Return a 2xx within 10 seconds, process asynchronously, and deduplicate on the event `id`. ## Renewals [#renewals] Match your billing platform's dunning emails and cancellation rules to the retry schedule in Altruon, so the two do not work against each other. See [Retries and dunning](/docs/optimize/retries-and-dunning). ## Test in production [#test-in-production] Take one real payment end to end with a low-priced plan, then check: - The subscription exists on your billing platform and its first invoice is paid. - The transaction in Altruon carries the acquirer's transaction id. - Your webhook endpoint received the events and the delivery log shows a 2xx. - The shopper landed on your redirect URL. ## Get help [#get-help] Support for live merchants: [support@altruon.io](mailto:support@altruon.io). When you report a problem, include the session id, the transaction id, and the ids on the acquirer and billing platform side. # How Altruon works (/docs/get-started/how-altruon-works) Altruon sits between two systems you already own: a billing platform that knows what to charge, and one or more acquirers that can charge it. Altruon does the work in the middle. ## Who does what [#who-does-what] | | Billing platform | Altruon | Acquirer | |---|---|---|---| | Plans, prices, coupons, tax | Owns them | Reads them to build the checkout estimate | | | Subscriptions and invoices | Source of truth | Creates the subscription after the first payment, records each payment on the invoice | | | Checkout | | Hosted pages or Altruon.js | | | Choosing where a payment goes | | Routing entries | | | Authorizing the payment | | Sends the request | Authorizes and settles to you | | Renewals | Raises the invoice | Collects it, retries it if it fails | Authorizes | | Funds | | Never holds or settles funds | Settles to your account | You keep your own contract with each acquirer and your own account on the billing platform. Altruon is a technology layer. ## The objects you work with [#the-objects-you-work-with] | Object | What it is | Where you manage it | |---|---|---| | Tenant | Your workspace. Its subdomain appears in your API and checkout URLs as `{your-domain}`. | Provisioned for you | | Acquirer connection | Credentials for one acquirer account | **Settings > Payment Gateways** | | Routing entry | Maps a payment method and a currency to an acquirer | **Settings > Payment Gateways**, **Routing** tab | | Billing connection | Credentials for your billing platform | **Settings > Billing Platforms** | | Session | One checkout attempt: currency, line items, optional customer data. Single use, valid for 15 minutes. | Created by your server or by a hosted page | | Webhook endpoint | Where Altruon sends you signed events | **Settings > Webhooks** | | API keys | A secret key for your server, a publishable key for the browser | **Settings > API Keys** | Read more in [Sessions](/docs/concepts/sessions) and the [Glossary](/docs/concepts/glossary). ## A first payment [#a-first-payment] 1. A session exists: your server created it, or the shopper opened a hosted page link and Altruon created it. 2. The shopper pays on the hosted page or in the Altruon.js component embedded in your page. 3. Altruon picks the acquirer from your routing entries for that payment method and currency, and sends the charge. 4. When the acquirer approves, Altruon creates the subscription on your billing platform and marks the first invoice as paid, with a reference that carries the acquirer, the method and the acquirer's transaction id. 5. The shopper returns to your `redirectUrl`, or your page receives the `onSuccess` callback. Your server can also receive a signed [webhook](/docs/api/webhooks). ## A renewal [#a-renewal] Your billing platform decides when a renewal is due and raises the invoice. Altruon hears about it through the billing platform's webhook, charges the stored payment method through the acquirer, and records the result on the invoice. If the charge fails, the invoice moves to dunning and Altruon retries it. See [Retries and dunning](/docs/optimize/retries-and-dunning). This is why each connection needs its webhook: without it, Altruon never hears that an invoice is due or that an asynchronous payment settled. See [Webhooks](/docs/concepts/webhooks). ## What you configure and what you build [#what-you-configure-and-what-you-build] | You configure, in the backoffice | You build, if you want to | |---|---| | Acquirer and billing platform connections | A server call that creates a session | | Routing entries | Your own checkout page with Altruon.js | | Checkout appearance and hosted pages | A webhook handler for Altruon events | | Webhook endpoints | | With [hosted pages](/docs/checkout/hosted-pages) you build nothing: the whole flow is configured. ## Next steps [#next-steps] # Quickstart (/docs/get-started/quickstart) By the end of this page your sandbox can take a payment and create a subscription on your billing platform. The setup is the same whichever checkout you choose afterwards. Your own account and credentials. Payment method, currency, acquirer. Stripe Billing, Chargebee, Recurly or Frisbii. Hosted link, hosted session or Altruon.js. ## Before you start [#before-you-start] You can sign in to your sandbox backoffice. If not, see [Sandbox and environments](/docs/get-started/sandbox-and-environments). Sandbox or test credentials for at least one [supported acquirer](/docs/connections/acquirers). A test site or sandbox on one of the [supported billing platforms](/docs/connections/billing-platforms), with at least one plan. ## Set up your sandbox [#set-up-your-sandbox] ### Sign in [#sign-in] Sign in to your sandbox with your merchant credentials. ### Connect an acquirer [#connect-an-acquirer] Go to **Settings > Payment Gateways** and click **+ Add Integration**. Pick your acquirer and follow its guide in [Connections > Acquirers](/docs/connections/acquirers): each one lists the credentials to copy and the webhook to set up. ### Add a routing entry [#add-a-routing-entry] Once the acquirer is connected, open the **Routing** tab and click **+ Add Entry**. Select the payment method (card, Pix, UPI and so on), the currency, and the acquirer that should process it. A payment method only appears at checkout when a routing entry exists for it in the session's currency. See [Routing](/docs/optimize/routing). ### Connect your billing platform [#connect-your-billing-platform] Go to **Settings > Billing Platforms** and click **+ Add Integration**. Follow the guide for your platform in [Connections > Billing platforms](/docs/connections/billing-platforms). ### Choose how shoppers reach checkout [#choose-how-shoppers-reach-checkout] Payments are now routed to your acquirer and subscriptions are created on your billing platform. Pick a checkout. You can use more than one at the same time, for example hosted pages for sales-led deals and Altruon.js for self-serve signup. Checkout links you create in the backoffice. Pick a plan, share the URL. Your server creates the session. Altruon hosts the page and pre-fills the customer. A payment component inside your own checkout, with results through callbacks. Not sure which one fits? See [Choose your checkout](/docs/checkout). ## Check the result [#check-the-result] After a test payment completes, whichever checkout you used: - A subscription exists on your billing platform. - Its first invoice is marked as paid. - The transaction is recorded in Altruon with the acquirer's own transaction id. - Renewals are collected by Altruon until the subscription is paused or canceled. Use the cards and scenarios in [Testing](/docs/resources/testing) to try declines and 3D Secure. The [Altruon merchant demo](https://github.com/Altruon-io/merchant-demo) is an open-source reference integration of Altruon.js: a branded SaaS checkout with an Express backend, live tax estimates, redirect and QR payment flows, and a transaction report after payment. Clone it and add your sandbox keys. ## Next steps [#next-steps] # Sandbox and environments (/docs/get-started/sandbox-and-environments) Altruon runs two separate environments. The sandbox is for building and testing. Production takes real payments. Each has its own sign-in, its own keys and its own connections. ## Get sandbox access [#get-sandbox-access] Altruon provisions a dedicated sandbox for each merchant. ### Ask for a sandbox [#ask-for-a-sandbox] Email [support@altruon.io](mailto:support@altruon.io). Include your company name, your contact details and the kind of testing you plan to do. ### Sign in [#sign-in] When the sandbox is ready you receive your credentials and your sign-in URL. You can also use the generic sign-in page at [login.sandbox.altruon.io](https://login.sandbox.altruon.io). ### Set it up [#set-it-up] Follow the [Quickstart](/docs/get-started/quickstart) to connect an acquirer and your billing platform. ## URLs per environment [#urls-per-environment] Your tenant has a subdomain, shown below as `{your-domain}`. It is part of your API and checkout URLs. | | Sandbox | Production | |---|---|---| | Backoffice sign-in | `https://login.sandbox.altruon.io` | `https://login.altruon.io` | | API | `https://{your-domain}.api.sandbox.altruon.io` | `https://{your-domain}.api.altruon.io` | | Hosted pages | `https://{your-domain}.sandbox.altruon.io/checkout/p/{id}` | `https://{your-domain}.altruon.io/checkout/p/{id}` | | Dynamic hosted checkout | `https://{your-domain}.sandbox.altruon.io/checkout/s/{sessionId}` | `https://{your-domain}.altruon.io/checkout/s/{sessionId}` | ## API keys [#api-keys] You find your keys in the backoffice under **Settings > API Keys**. There are two, and they are not interchangeable. | Key | Looks like | Use it | Never | |---|---|---|---| | Secret key | `sk_sandbox_test_...` | On your server, in the `x-secret-key` header, to create sessions and read transactions | Put it in browser code, a mobile app or a public repository | | Publishable key | `pk_sandbox_...` | In the browser, to initialize Altruon.js | Use it for server calls | See [Authentication](/docs/api/authentication) for the header format. ## What is separate between environments [#what-is-separate-between-environments] - **Sign-in and users.** Sandbox credentials do not work in production. - **API keys.** Sandbox keys only work against the sandbox API. - **Connections.** An acquirer or billing platform connected in the sandbox is not connected in production. Connect each one again with its live credentials. Provider webhooks point at a different URL per environment. - **Hosted pages, routing entries and webhook endpoints.** Configure them again in production. When you are ready for real payments, work through the [Go-live checklist](/docs/get-started/go-live). ## Get help [#get-help] Questions about your sandbox: [support@altruon.io](mailto:support@altruon.io). # Introduction (/docs) Altruon is the payment layer between the billing platform you already run and the acquirers you already have. You connect both once. Altruon then runs checkout, routes each payment to an acquirer, collects renewals, retries the ones that fail, and records every result on the invoice. ## Start here [#start-here] ### Get a sandbox [#get-a-sandbox] Ask for a sandbox and sign in. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). ### Follow the quickstart [#follow-the-quickstart] Connect an acquirer, add a routing entry, connect your billing platform, and take a test payment. See the [Quickstart](/docs/get-started/quickstart). ### Choose your checkout [#choose-your-checkout] Share a hosted link, create a hosted checkout from your server, or embed Altruon.js in your own page. See [Choose your checkout](/docs/checkout). ## What you can build [#what-you-can-build] ## How these docs are organized [#how-these-docs-are-organized] | Tab | What is in it | Use it when | |---|---|---| | [Guides](/docs) | Setup, concepts, checkout, subscriptions, routing, vault | You are building or configuring something | | [Connections](/docs/connections) | One setup guide per billing platform and acquirer | You are connecting a provider | | [API reference](/docs/api) | Sessions, transactions, webhooks | You need the exact request or response | | [Altruon.js reference](/docs/sdk) | Methods, callbacks, style options | You need the exact signature or payload | | [Changelog](/docs/changelog) | What changed, and when | You want to know what is new | Every page has a **Copy Markdown** button, and the whole site is available to coding assistants. See [Build with AI](/docs/get-started/build-with-ai). ## Get help [#get-help] - Write to [support@altruon.io](mailto:support@altruon.io) - Something not working: start with [Troubleshooting](/docs/resources/troubleshooting) # Analytics (/docs/manage/analytics) Each acquirer reports in its own dashboard, in its own format, and your billing platform reports revenue somewhere else. The Altruon dashboard puts them side by side, because every payment and every renewal passes through the same layer. It is the first screen you see when you sign in to the backoffice. ## Choose the period [#choose-the-period] The period menu at the top sets the range for the payment metrics and every chart: **Yesterday**, **Last 7 days**, **Last 30 days** (the default), **This Year** or **Custom**. The dashboard counts complete days, so a range ends yesterday. Each change is compared with the previous period of the same length. Amounts are shown in your preferred display currency. An admin sets it under **Settings > Site Configuration > Preferred display currency**. Payments in other currencies are converted at current exchange rates. ## Payment metrics [#payment-metrics] | Card | What it shows | |---|---| | **Total Processed Volume** | Successful payments in the period, with a sparkline and the change against the previous period | | **Transactions** | The number of successful payments, with the change against the previous period | | **Authorization Rate** | Successful payments out of all attempts, with chips for the rate excluding retries, for MIT and for CIT | | **Active Integrations** | Your connected acquirers and billing platforms | MIT is a merchant-initiated transaction such as a renewal. CIT is a customer-initiated transaction such as a first payment. See the [Glossary](/docs/concepts/glossary). ## Subscription metrics [#subscription-metrics] The second row shows the health of your recurring revenue, from the subscriptions and invoices synced from your billing platform. | Metric | What it shows | |---|---| | MRR | Monthly recurring revenue of your active subscriptions | | ARR | Annual recurring revenue of your active subscriptions | | Active subscriptions | Subscriptions that are currently active | | Due invoice amount | The total still owed on unpaid invoices | | Due invoice count | The number of unpaid invoices | | Active vaulted cards | Cards stored in the [Altruon Vault](/docs/protect/vault), a PCI Level 1 vault, that renewals can charge | Due invoices are the ones [retries and dunning](/docs/optimize/retries-and-dunning) work to recover. Active vaulted cards needs the Altruon Vault to be turned on. ## Charts [#charts] | Chart | What it shows | |---|---| | **Processed Volume Over Time** | Volume and transactions per day, week or month (**Daily**, **Weekly**, **Monthly**), with the totals for the period | | **Volume by Payment Method** | Each payment method's share of volume. **View all payment methods** lists every method with its change against the previous period | | **Volume by Currency** | Volume in each currency and converted to your display currency. **View all currencies** shows both amounts side by side | ## Integration health [#integration-health] **Integration Health** shows each connection as **Healthy**, **Degraded** or **Down**. Connections are checked about every hour. When one goes down you receive an email alert and the dashboard prompts you to fix it. ## Recent activity [#recent-activity] **Recent Activity** lists the five latest changes in the backoffice, such as a routing version published or a refund issued. Admins can open any of them, or **View all activity** to go to the [audit trail](/docs/manage/audit-trail). ## Down to one transaction [#down-to-one-transaction] Subscriptions, invoices and transactions each have a list with filters and CSV export. A transaction's detail shows the acquirer's own response code and failure reason, so you see what the acquirer said and not only a normalized label. ## Access and audit [#access-and-audit] - Roles: user and admin. - Two-factor authentication. - An [audit trail](/docs/manage/audit-trail) of sign-ins and every change in the backoffice. ## Related [#related] # Audit trail (/docs/manage/audit-trail) Every action that changes something in the backoffice is recorded: a setting saved, a connection turned off, a routing version published, a refund issued. So is every sign-in. When a number moves or a checkout looks different, the audit trail tells you who changed what, and when. ## Who can see it [#who-can-see-it] The audit trail is for admins. In the backoffice sidebar, open **Audit Logs** under **Workspace**. Users with the user role do not see it. The dashboard also shows the five latest events in **Recent Activity**. Click an event to open it in Audit Logs, or **View all activity** to see the full list. ## What is recorded [#what-is-recorded] | Area | Events | |---|---| | Sign-ins and security | Successful and failed logins, logouts, two-factor authentication turned on or off, password changes | | Team | Users registered, edited, activated, deactivated or deleted | | Connections | Acquirer and billing platform connections created, turned on or off, or deleted. **Raw card data** and Google Pay turned on or off | | Checkout | Checkout configuration such as logo, color and company name, checkout page fields, hosted page settings, payment links and webhook endpoints | | Routing | Routing entries created, turned on or off, or deleted. Dynamic routing turned on or off, drafts saved, versions published and rolled back | | Altruon Vault features | Vaulting type, network tokens, account updater and 3D Secure settings, and account update requests | | Payments and exports | Refunds, and CSV exports of transactions, subscriptions and invoices | | Altruon Billing | Catalog and coupon changes, subscriptions created, updated or canceled, next billing date and trial end changes, one-time charges, invoice collection and credit notes | An action that fails is recorded too. Its status is **FAILURE** and the entry shows the error, so you can see attempts as well as changes. Actions that run without a person behind them, such as an automatic process, show **System** as the actor. ## Find an event [#find-an-event] The list shows **Timestamp**, **Actor**, **Action**, **Resource**, **Summary** and **Status**, newest first. Narrow it with: - **Search**: by summary, resource ID or actor email. - **All Actions**: one type of action, for example **Refund Issued** or **Routing Policy Published**. - **All Resources**: one type of object, for example **Gateway Connection** or **Subscription**. - **All Users**: one person. - The period: **All Time** by default, a preset or a custom range. **Clear Filters** resets them all. Show 50, 75 or 100 events per page. The filters are kept in the page address, so you can share a filtered view with another admin. ## Read an event [#read-an-event] Click an event to open it on the right. | Question | Where to look | |---|---| | Who and when | **Timestamp**, **Actor** and their **Role**, and **Status**. A failed action adds the **Error** | | What | **Action**, **Resource** with the ID of the object, and **Summary**. For a routing version, the summary includes the change note written when it was published | | Where from | **Metadata**: the IP address, the browser (user agent) and the request that made the change | | What changed | **Diff**: each changed field with its value **Before** and **After**. A color shows a swatch and a new logo shows a preview | Some events also show the full **Before / After**, the **Request payload** or the **Response payload**. The address of an open event can be shared with another admin. ## What is never shown [#what-is-never-shown] Secrets are replaced with `[REDACTED]` before an event is stored: passwords, API keys, tokens, webhook secrets, card numbers, security codes and IBANs. The audit trail never holds card data. When Altruon staff change a setting on your account, the event appears with **SYSTEM** as the actor and no metadata. Their own sign-ins and exports are not listed. ## Related [#related] # Global expansion (/docs/manage/global-expansion) Entering a market usually means a local acquirer and a local payment method. On Altruon both are a connection and a routing entry, not a new integration: your checkout and your billing platform stay as they are. ## Add a market [#add-a-market] ### Pick the acquirer and the methods [#pick-the-acquirer-and-the-methods] | Market | Payment methods | Acquirer | |---|---|---| | Brazil | Cards, Pix, Pix Automático | [PagBrasil](/docs/connections/acquirers/pagbrasil), [dLocal](/docs/connections/acquirers/dlocal) | | India | Cards, UPI | [dLocal](/docs/connections/acquirers/dlocal) | | South Korea | Cards, KakaoPay | [Checkout.com](/docs/connections/acquirers/checkout-com) | | Eurozone | SEPA Direct Debit | [Trustly](/docs/connections/acquirers/trustly) | | United Kingdom | Bacs | [Trustly](/docs/connections/acquirers/trustly) | | Sweden | Autogiro | [Trustly](/docs/connections/acquirers/trustly) | These are examples, not the full list. New acquirers are connected on request. ### Connect it [#connect-it] Follow the acquirer's guide in [Connections](/docs/connections/acquirers). ### Route the method and currency [#route-the-method-and-currency] Add a [routing entry](/docs/optimize/routing) for each payment method in the local currency. The method then appears at checkout for sessions in that currency. ## Help from Altruon's team [#help-from-altruons-team] Altruon offers expert services for merchants entering new markets: - Acquirer sourcing and negotiation - Local market launches - Onboarding and KYC with payment providers - Pricing reviews To talk through a market, write to [support@altruon.io](mailto:support@altruon.io). ## Related [#related] # Reconcile (/docs/manage/reconcile) Reconciliation answers one question: for this invoice, which payment paid it, and where is that payment at the acquirer? Altruon keeps both links on every transaction. ## What is linked [#what-is-linked] Marked paid with Altruon's reference. Stores the acquirer's own transaction id. Settles to your account. - Each transaction stores the acquirer's own id, and links both ways: to the invoice and subscription on the billing platform, and to the payment at the acquirer. - The reference written on the invoice is made of the acquirer, the payment method and the acquirer's transaction id. - In the backoffice, every subscription, invoice and transaction has a link to its record in the billing platform's dashboard and in the acquirer's dashboard. ## Find a payment [#find-a-payment] The backoffice lists subscriptions, invoices and transactions, with filters and CSV export. A transaction's detail shows: - the acquirer's response code and failure reason - the acquirer's reference - the card brand and last four digits - a link to view it in the acquirer's dashboard From your own systems, [Get transaction details](/docs/api/transactions/get-details) returns the transaction with its customer, invoice and subscription, including the deep links `urlAtGateway` and `urlAtBilling`. ## Payments that arrive late [#payments-that-arrive-late] Some payments finish after checkout, and some results arrive out of order. Background repair jobs attach late or orphan transactions to the right invoice cycle, so a payment is not left without an invoice. ## Chargebacks [#chargebacks] Chargebacks are recorded on the billing platform. Today this covers direct debit reversals with Trustly. ## Invoice statuses [#invoice-statuses] Paid, payment due, dunning, dunning exhausted, refunded, voided and chargeback. See [Payment lifecycle](/docs/concepts/payment-lifecycle#invoice-statuses). ## Related [#related] # Account updater (/docs/optimize/account-updater) Account updater asks Visa or Mastercard whether a stored card has a newer number or a newer expiry. When the network has one, the [Altruon Vault](/docs/protect/vault) replaces the stored card details before the next renewal. The vault token does not change, and neither does the subscription or the record on your billing platform. It applies to Visa and Mastercard cards in the Altruon Vault. Other brands are not checked. Account updater only works on cards stored in the Altruon Vault. The Altruon Vault must be turned on for your account before you can use it. Ask your Altruon account manager or write to [support@altruon.io](mailto:support@altruon.io). See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). ## Why it is separate from a network token [#why-it-is-separate-from-a-network-token] A [network token](/docs/optimize/network-tokens) stays valid when the plastic changes, because the card network updates the mapping behind the token. A charge that still uses the card number needs the stored number and expiry themselves to change. That is what account updater does. Real time does not check a card that already has an active network token. The network keeps that token current, so a second check would not change what the renewal sends. ## How a check runs [#how-a-check-runs] A Visa or Mastercard card in the vault is selected for a check. Visa or Mastercard reports a new number, a new expiry, or nothing newer. The vault token and the subscription stay the same. The next renewal uses the fresh details. The **Strategy** on **Settings > Vault**, **Account updater** tab, decides which cards are checked: | Strategy | What Altruon does | |---|---| | **Never** | No card is checked. | | **Real time** | Altruon checks every card that is about to expire, starting 45 days before the end of its expiry month. You can also ask for one card with the call below. | | **On demand** | Nothing runs in the background. Your server asks for a check of one card. | A card checked in the last 24 hours is not sent to the network again. The call returns the stored result. The **Last 30 days** counters are **Cards checked**, **Updated** (a new number or expiry came back), **No update** (the network had nothing newer) and **Needs attention** (the account is closed, or the network says to contact the shopper). ## Check one card [#check-one-card] ```bash POST /api/session/v1/payment-source/{paymentSourceId}/account-update x-secret-key: sk_sandbox_... ``` Call it from your server with your secret key. `{paymentSourceId}` is the id of the stored card. A successful response includes `outcome`, `result_code`, `checked_at`, the current `card` (brand, last four, expiry month and year) and `previous` when the card changed. | Status | Meaning | |---|---| | 401 | The secret key is missing or not valid for this account. | | 404 | No stored card with that id on this account. | | 409 | Account updater is off, the card is not eligible, or a check of this card is already running. | | 429 | The account has reached its daily check limit. | | 502 | The network did not answer. The card was not changed. Repeat the call. | ## Before you start [#before-you-start] Without it, there is no **Settings > Vault** page and no stored card can be checked. See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). The **Account updater** tab stays unavailable until Altruon turns the feature on. Write to [support@altruon.io](mailto:support@altruon.io) to ask for it. **Visa acquirer BIN**, **Visa card acceptor ID (CAID)** and **Mastercard merchant ID (MID)**. Ask your acquirer, or the gateway you process through, such as Stripe, Adyen or Checkout.com. They must match that acquirer's records. ## Turn account updater on [#turn-account-updater-on] ### Open Vault [#open-vault] Go to **Settings > Vault**. If **Account updater** says it appears once Altruon has turned it on, the steps below are not available yet. The **Overview** tab lists what is still to do: the business profile, the acquirer identifiers and card network onboarding. ### Save the business profile [#save-the-business-profile] Open **Business profile**. This is the legal entity registered with Visa and Mastercard, and it is the same profile [network tokens](/docs/optimize/network-tokens) use. Fill in **Business**, **Registration**, **Contact** and **Address**. A star marks a required field. Click **Save business profile**. ### Save the acquirer identifiers [#save-the-acquirer-identifiers] Open **Account updater**. Under **Acquirer identifiers**, enter the **Visa acquirer BIN**, the **Visa card acceptor ID (CAID)** and the **Mastercard merchant ID (MID)**. If you use several acquirers, enter the identifiers from the one that handles most of your volume. Click **Save identifiers**. A network that is already submitted keeps its identifiers. The other network can still be saved. To change a submitted identifier, write to [support@altruon.io](mailto:support@altruon.io). ### Choose a strategy [#choose-a-strategy] Under **Strategy**, choose **Never**, **Real time** or **On demand**, then click **Save strategy**. **Real time** and **On demand** stay blocked until the business profile is saved. The message is **Save the business profile first**. ### Submit to Visa and Mastercard [#submit-to-visa-and-mastercard] Click **Submit to Visa and Mastercard**, then **Confirm**. The button stays disabled until the business profile and the acquirer identifiers are saved. If you have unsaved identifier edits, save them first. The profile and the identifiers are sent to both networks. After you confirm, the business details and the identifiers of a submitted network are locked. Later changes go through [support@altruon.io](mailto:support@altruon.io). ### Wait until each network is active [#wait-until-each-network-is-active] Visa and Mastercard are each **Not submitted**, **Onboarding**, **Active** or **Failed**. Click **Refresh status** to update the list. Checks start when that network is **Active**. Until then, no card is checked, whatever the strategy. If the page says account updater is paused, Altruon rejected the configuration: check the identifiers and submit again. ## See that it worked [#see-that-it-worked] On **Real time**, the **Cards checked** counter moves as cards enter the 45-day window. On **On demand**, call the endpoint above for one stored card and read `outcome`. **Updated** means a new number or expiry was stored. The subscription id does not change. ## Related [#related] # Network tokens (/docs/optimize/network-tokens) A network token is a payment credential issued by the card network. It stands in for the card number, the primary account number (PAN), on a checkout and on later renewals. The network keeps the real card number. Altruon and the acquirer use the token. Altruon requests network tokens for Visa and Mastercard cards stored in the [Altruon Vault](/docs/protect/vault). American Express, Discover and other brands are charged on the card number. Network tokens only work on cards stored in the Altruon Vault. The Altruon Vault must be turned on for your account before you can use them. Ask your Altruon account manager or write to [support@altruon.io](mailto:support@altruon.io). See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). ## Why a network token [#why-a-network-token] A card number stored at one acquirer can only be charged by that acquirer, and it stops working when the bank reissues the card. A network token is different: - **The network holds the card number.** The first payment is sent with a one-time cryptogram from the network. Each renewal passes the network token, not the card number. - **A reissued card keeps the same token.** Lost, replaced and updated cards stay chargeable. The subscription does not change. - **The token is not locked to one acquirer.** It is kept with the card in the Altruon Vault, so any acquirer you connect that accepts network tokens can charge it. - **A missing token does not fail the payment.** If the network is not active yet, the acquirer cannot take the token, or the cryptogram is not available, Altruon sends the card number instead and the payment continues. [Account updater](/docs/optimize/account-updater) solves the other half of the same problem. A network token stays valid because the network updates the mapping behind it. Account updater refreshes the stored card number and expiry, which is what a charge on the card number needs. Real time account updater does not check a card that already has an active network token. ## How Altruon uses one [#how-altruon-uses-one] The shopper pays once. The card is stored in the vault. Visa or Mastercard issues a token. It is kept with the card. The first payment is sent with a cryptogram. Each renewal passes the network token. Which cards get a token depends on the strategy you save under **Settings > Vault**, on the **Network tokens** tab: | Strategy | What Altruon does | |---|---| | **Off** | No network token is requested. The card number is charged. | | **Always** | Every new card stored in the Altruon Vault gets a network token when its network supports it. | | **On request** | A token is requested only when the session you create sets `networkToken` to `true`. See [Create a session](/docs/api/sessions/create). | **On request** does not apply to [hosted pages](/docs/checkout/hosted-pages). A hosted page does not send `networkToken`, so those checkouts charge the card number unless the strategy is **Always**. The **Last 30 days** counters on the same tab show what happened: **Payments**, **Charged with a token**, **Used the card instead** and **Not used**. ## Before you start [#before-you-start] Without it, there is no **Settings > Vault** page and no card can get a network token. See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). The **Network tokens** tab stays unavailable until Altruon turns the feature on. Write to [support@altruon.io](mailto:support@altruon.io) to ask for it. ## Turn network tokens on [#turn-network-tokens-on] ### Open Vault [#open-vault] Go to **Settings > Vault**. The **Overview** tab lists network tokens, account updater and 3D Secure, and a setup list of what is still to do. If **Network tokens** says it appears once Altruon has turned it on, the steps below are not available yet. ### Save the business profile [#save-the-business-profile] Open the **Business profile** tab. Visa and Mastercard issue tokens to this legal entity. Account updater uses the same profile. Fill in **Business**, **Registration**, **Contact** and **Address**. A star marks a required field. Then click **Save business profile**. Saving keeps the profile at Altruon. It is not sent to the networks yet. | Section | Required | |---|---| | Business | **Full legal name**, **Website**, **Merchant category code (MCC)**, **Statement descriptor**, **Business description** | | Registration | **Registration type**, **Registration number** | | Contact | **Name**, **Job title**, **Phone**, **Email** | | Address | **Address line 1**, **City**, **Postal code**, **Country code** | **Country code** is two letters, for example `FR`. **Phone** includes the country calling code. ### Choose a strategy [#choose-a-strategy] Open the **Network tokens** tab. Under **Strategy**, choose **Off**, **Always** or **On request**, then click **Save strategy**. **Always** and **On request** stay blocked until the business profile is saved. The message is **Save the business profile first**. ### Submit to Visa and Mastercard [#submit-to-visa-and-mastercard] On the same tab, click **Submit to Visa and Mastercard**, then **Confirm**. The saved profile is sent to both networks. After you confirm, the business details are locked. Later changes go through [support@altruon.io](mailto:support@altruon.io). The same button is on the **Business profile** tab. Save the profile first: an unsaved edit blocks the submit. ### Wait until each network is active [#wait-until-each-network-is-active] The onboarding card lists Visa and Mastercard. Each one is **Not submitted**, **Onboarding**, **Active** or **Failed**. Click **Refresh status** to update the list. A failed network shows the reason. Tokens start when that network is **Active**. Until then, checkout still charges the card number, even if the strategy is **Always** or **On request**. ## See that it worked [#see-that-it-worked] Take a card payment in sandbox with a Visa or Mastercard test card, on a strategy that requests a token. On **Settings > Vault**, open **Network tokens**. **Charged with a token** counts a payment where the acquirer was sent the network token. **Used the card instead** counts a payment that fell back to the card number. ## Related [#related] # Retries and dunning (/docs/optimize/retries-and-dunning) A failed renewal is not a lost subscription. Altruon moves the invoice to dunning, retries the payment, and tells your billing platform the outcome of every attempt. The charge for a due invoice fails. The invoice gets a retry count and a next retry date. The payment is recorded on the invoice. Your end action applies. ## Retry types [#retry-types] | Type | How it works | |---|---| | Basic | A fixed schedule that you set, in days after the failed attempt | | Smart | Retries timed by AI. A premium option | | Second-acquirer retry | A soft-declined renewal cascades to another acquirer, set in the **Recurring (MIT)** rules of [Dynamic routing](/docs/optimize/routing#cascading). The Altruon Vault must be turned on first. See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault) | ## When retries run out [#when-retries-run-out] You choose one end action: - Cancel the subscription on the billing platform. - Flag the invoice as dunning exhausted and leave the subscription for you to handle. - Stop retrying. ## Payment methods with their own schedule [#payment-methods-with-their-own-schedule] | Payment method | Schedule | |---|---| | Cards | Your Basic or Smart schedule | | Pix and Pix Automático | A platform schedule: days 1, 3 and 6, up to 3 attempts | | UPI | The scheme's own rules | | SEPA Direct Debit, Bacs, Autogiro | The scheme's own rules | For Pix Automático and UPI, a pre-debit notice is sent to the shopper before each debit. ## Safeguards [#safeguards] - **No double charge.** Every retry is claimed once before it runs, so two processes can never charge the same attempt. - **Late results are matched.** When a payment outcome arrives after the retry was scheduled, it is recorded against the right invoice, so dunning does not run twice. ## Keep your billing platform in step [#keep-your-billing-platform-in-step] Your billing platform has its own dunning emails and cancellation rules. If it cancels a subscription on day 5 and Altruon retries on day 6, the retry has nothing to collect. Set the billing platform's dunning window to be at least as long as the retry schedule in Altruon, and decide which of the two sends emails to the customer. ## Events [#events] | Event | When it fires | |---|---| | `invoice.dunning_started` | An invoice moves to dunning after a failed renewal | | `payment.retry_failed` | A retry attempt fails | | `invoice.dunning_exhausted` | Retries have run out | | `invoice.paid` | A retry succeeds and the invoice is paid | See [Event types](/docs/api/webhooks/events) for the full list. ## Related [#related] # Routing (/docs/optimize/routing) Every payment needs a destination. Routing chooses it at two levels: routing entries for every account, and Dynamic routing for card payments stored in the Altruon Vault. | | Routing entries | Dynamic routing | |---|---|---| | Where | **Settings > Payment Gateways > Routing** | **Settings > Dynamic routing** | | Available to | Every account | Accounts with the [Altruon Vault](/docs/protect/vault) turned on | | Payment methods | Every method | Cards | | Decides on | Payment method and currency | Rules on the card, the amount, the currency and the customer | | Payment types | One table for every payment | Separate rules for subscription checkouts, one-time checkouts and renewals | | After a decline | The payment is declined | Optional cascade: the same card is tried on another acquirer | ## Routing entries [#routing-entries] A routing entry has three parts: a payment method, a currency and an acquirer. It is the minimum you need before checkout can show a payment method. The session sets the currency. The shopper picks a method, or you pin one. The entry for that method and currency names the acquirer. Sent with your own credentials. Settled to your account. ### Open the routing table [#open-the-routing-table] Go to **Settings > Payment Gateways** and open the **Routing** tab. ### Add an entry [#add-an-entry] Click **+ Add Entry** and select the payment method, the currency and the acquirer that should process it. ### Repeat for each method and currency [#repeat-for-each-method-and-currency] Add one entry for every combination you sell in, for example cards in EUR, cards in USD and Pix in BRL. What routing entries change at checkout: - A payment method appears at checkout only if a routing entry exists for it in the session's currency. - When a session has no payment method (discovery), the shopper sees every method routed for that currency. In Altruon.js, several matching entries render a method selection drawer, and a single match renders that method's fields directly. - When a session pins a payment method, only that method is offered. - Renewals follow the routing table too, unless Dynamic routing is on with **Recurring (MIT)** rules. If a method you expect is missing at checkout, check the routing table first. See [Troubleshooting](/docs/resources/troubleshooting). ## Dynamic routing [#dynamic-routing] Dynamic routing only works on cards stored in the Altruon Vault. The Altruon Vault must be turned on for your account before **Settings > Dynamic routing** appears. Ask your Altruon account manager or write to [support@altruon.io](mailto:support@altruon.io). See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). A card stored in the Altruon Vault is not tied to the acquirer that first charged it. Dynamic routing uses that: your own rules choose the acquirer of each card payment, from what is known about the card and the payment, and a declined card can be tried again on another acquirer. **Settings > Dynamic routing** is a rule engine with five tabs: | Tab | What you do there | |---|---| | **Overview** | Turn Dynamic routing on or off, see the published rules, and check which acquirers the rules can use | | **Rules** | Build the rules of each payment type in a visual workflow, save a draft and publish it | | **Test** | Run sample payments through any version of the rules. Nothing is saved and no payment is made | | **History** | See every published version, edit a copy of one, or use it again | | **Retry** | Manage the retry profiles that declined renewals use | ### Payment types [#payment-types] Each payment type has its own workflow, chosen at the top of the **Rules** tab. A customer-initiated transaction (CIT) is a payment the shopper makes at checkout. A merchant-initiated transaction (MIT) is a charge you make on a saved card, without the shopper. | Payment type | What it covers | When it has no rules of its own | |---|---|---| | **Checkout payments (CIT subscription)** | A shopper pays for a subscription, or saves a card for a trial, at checkout | Always on. Every account starts here | | **Checkout payments (CIT one-time)** | A shopper pays a basket once at checkout | Uses the subscription checkout rules, and cards are saved in your account's own vault | | **Recurring (MIT)** | Renewals of cards saved in the Altruon Vault | Renewals keep today's behavior: the acquirer that collected the card | Turn on **Own rules** on the one-time or recurring payment type to give it its own workflow. Only card payments run these workflows. Other payment methods keep using **Settings > Payment Gateways > Routing**. ### How rules are read [#how-rules-are-read] A rule has a name, one or more conditions, and a **Then** that says where a matching payment is charged. - **Conditions.** Each condition compares one fact of the payment with a value, for example **Currency** **equals** `EUR`. With several conditions, choose **All** (every condition must hold) or **Any** (one is enough). - **Priority.** Rules are checked from top to bottom, and the first match decides. Move a rule with **Top**, **Up**, **Down** and **Bottom** in its panel, or drag it on the canvas. - **All other conditions (Otherwise).** Always last. It catches every payment that matches no rule. With no rules at all, it reads **Every payment**. The facts a condition can check: | Fact | What it holds | Known | |---|---|---| | **Currency** | 3-letter ISO code, for example `EUR` | From the start of the payment | | **Amount** | In minor units of the currency: `1999` is 19.99 | From the start of the payment | | **Payment method** | The method the shopper pays with | From the start of the payment | | **Card brand** | Visa, Mastercard, American Express, Discover, Diners Club, JCB, UnionPay, Maestro, Elo, Hipercard or Cartes Bancaires | Once the shopper submits the card | | **Card BIN** | The first 6 to 8 digits, single BINs or ranges such as `510000-519999` | Once the shopper submits the card | | **Card type** | `credit`, `debit` or `prepaid` | Once the shopper submits the card | | **Card issuer country** | Country of the bank that issued the card, 2-letter ISO code | Once the shopper submits the card | | **Customer country** | The shopper's billing country, 2-letter ISO code. Not the card's country | Once the shopper submits the payment. Not for renewals | | **Card's original gateway** | The acquirer that first collected the card | Renewals only | The comparisons depend on the fact: **equals**, **does not equal**, **is one of**, **is none of**, **is greater than**, **is at least**, **is less than**, **is at most**, **is between**, **BIN is in**, **starts with**, **is known** and **is not known**. A rule on a fact that a payment type never knows would never match, so the editor offers only the facts that payment type can use. ### What a rule does [#what-a-rule-does] The **Then** of a rule is one of: - **One gateway.** Every matching payment is charged on that acquirer. - **Split traffic.** Matching payments are shared between acquirers by percentage, for example 70% and 30%. The shares must add up to 100%. A checkout keeps the same share for the same session, and a renewal keeps the same share for the same subscription, so each subscription is charged on the same acquirer every cycle. On **Checkout payments (CIT one-time)**, each acquirer step also chooses where a card is saved when the shopper ticks **Save my card for faster checkout**: | **Save the card in** | What happens | |---|---| | **Site default** | The Altruon Vault when the checkout captures cards there, otherwise the acquirer's token | | **Altruon vault** | The card can later be charged on any acquirer | | **Gateway token** | Kept by this acquirer only. Nothing is saved if it cannot keep cards | | **Never save** | Cards are charged once and never kept, even when the shopper asks | Split shares save cards in your account's own vault. Use a single gateway or a cascade step to choose another place. Each rule also shows two chips, **Token** and **3DS**, with the [network token](/docs/optimize/network-tokens) and [3D Secure](/docs/protect/3d-secure) strategies saved under **Settings > Vault**. They are shown for information and are changed on the Vault page, not per rule. Renewals have no 3DS chip: there is no shopper to authenticate. ### Cascading [#cascading] A cascade tries the same card on another acquirer after a soft decline, without asking the shopper for anything. Every acquirer step in the workflow has two outcomes: **Approved** ends the payment, and **Declined** either ends it or cascades. To add one, open an acquirer step on the canvas and turn on **Cascade** under **Declined**. Choose the acquirer in **Try the same card on**, then which declines cascade: - **Recommended reasons.** The decline codes that another acquirer often approves: do not honor, issuer unavailable and processing errors. This is the default. - **Selected reasons.** Only the codes you tick in the acquirer's list. The list is grouped into **Retry-friendly**, **Card / funds** and **Hard declines**, and it can be searched. Ticking a hard decline shows a warning: card networks can charge fees for retrying a lost, stolen, fraudulent, invalid or expired card. A cascade step can cascade again. Each step must try an acquirer not tried before for that payment, and the editor shows how many acquirers one payment may try (three unless Altruon sets another limit). What also applies: - Timeouts are never cascaded. - At checkout, hard declines are not cascaded. A decline after 3D Secure is retried when the shopper returns to the checkout page. - Google Pay cascades only to an acquirer with Google Pay turned on. - A renewal moves to another acquirer only if that acquirer is enabled for renewals and the card can be charged there without the shopper, which needs a network transaction id. - Cascading may not be available on your account yet. Write to [support@altruon.io](mailto:support@altruon.io) to have it turned on. ### Retry of declined renewals [#retry-of-declined-renewals] On **Recurring (MIT)**, a renewal that still ends declined after its last cascade goes to the workflow's retry, one setting for every renewal rule. Click **Set up retry** above the canvas, then choose: - **Retry profile.** A Basic profile retries after a fixed number of days you choose. A Smart profile lets Altruon predict the best time for each retry, and needs Smart retry turned on for your account. Profiles are created and edited in the **Retry** tab, with what happens **After the last retry fails**. - **Retry on gateway.** **Card's original gateway (as today)**, or another acquirer. A card that cannot be charged on the one you choose (no network transaction id, or the acquirer is not enabled for renewals) is retried on its original acquirer. With retry off, declined renewals use your account's retry settings on the card's original acquirer. See [Retries and dunning](/docs/optimize/retries-and-dunning). ## Set up Dynamic routing [#set-up-dynamic-routing] See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). Only administrators can open **Settings > Dynamic routing** and change raw card data. Each acquirer the rules use must accept full card numbers from Altruon on your credentials. Today the rules can send cards to Adyen, Stripe and Checkout.com. A card row in the routing table still decides whether cards are offered in that currency. ### Turn on raw card data for each acquirer [#turn-on-raw-card-data-for-each-acquirer] In **Settings > Payment Gateways**, open the acquirer and turn on **Raw card data**. Tick that the acquirer has confirmed raw card data is enabled for these credentials, then click **Turn on**. Altruon cannot check this with the acquirer. If raw card data is not enabled there, card payments sent to that acquirer are declined. ### Check the acquirers the rules can use [#check-the-acquirers-the-rules-can-use] Open **Settings > Dynamic routing**. On **Overview**, **Gateways the rules can use** shows **Yes** for each acquirer that is ready, or the reason it is not: **Inactive**, **Not supported yet** or **Raw card data is off**. ### Build the rules [#build-the-rules] Open **Rules**. Use **Start from** to begin with a template: **One gateway for everything**, **70/30 split between two gateways**, or **Example: rules by currency and amount**. Pick a payment type, click **Add rule**, then click a rule to edit its conditions, or an acquirer to change where it charges and what happens on a decline. ### Save the draft [#save-the-draft] Click **Save draft**. The editor lists anything to finish first, such as a rule without a gateway or a split that does not add up to 100%. Click a problem to see it in the workflow. ### Test it [#test-it] Open **Test**. In **Rules to test**, choose the rules in the editor, the saved draft or a published version, and optionally one to **Compare with**. - **Many payments** describes the payments you expect (payment type, brands, amounts) and shows where the rules would send them and what would change. - **One payment** follows a single payment through the rules, step by step. Move **Soft decline rate** above 0% to see your cascades at work. ### Publish [#publish] Click **Publish…**, write a **Change note** (required), and publish. The draft becomes the next version, and the previous one stays in **History**. ### Turn Dynamic routing on [#turn-dynamic-routing-on] On **Overview**, turn the switch on and confirm. Card payments now go where the published version says. Once it is on, each new version applies as soon as you publish it. ## Dynamic routing and routing entries [#dynamic-routing-and-routing-entries] While Dynamic routing is on: - Your rules choose the acquirer of each card payment. The card rows of the routing table no longer decide the acquirer, and the **Routing** tab says so. - A card row still decides whether cards are offered in its currency. - Other payment methods keep the routing table. - A card row on an acquirer that collects the card itself keeps its acquirer, because the card cannot be sent to another one. **Card routing in Payment gateways**, on **Overview**, marks each card row as **Follow your rules** or **Charged on** that acquirer. To route those payments with your rules, point the card row at an acquirer with raw card data turned on. Turning Dynamic routing off takes effect straight away: every payment uses the routing table again. Your rules and their history are kept, and you can turn it back on at any time. ## Versions [#versions] Every publish creates a version, with who published it, when, and its change note. In **History**: - **View** shows the rules of a version. - **Edit a copy** loads a version into the editor, to change and publish as a new version. - **Use again** publishes a copy of an older version as a new version. Nothing in history is changed. ## Related [#related] # 3D Secure (/docs/protect/3d-secure) 3D Secure (3DS) is how a card issuer confirms that the shopper is the cardholder. It is the usual way to meet strong customer authentication in the EEA and the UK. Altruon runs it for you as part of the payment. ## Where it runs [#where-it-runs] | Checkout | What happens when the issuer asks for a challenge | |---|---| | [Hosted pages](/docs/checkout/hosted-pages) and [dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout) | The hosted page shows the challenge and continues the payment. You do nothing | | [Altruon.js](/docs/checkout/altruon-js) | The challenge or redirect is handed to your page through the `onActionRequired` callback | For Altruon.js, see [Handle payment results](/docs/checkout/altruon-js/payment-results) for how to respond to an action, and [Callbacks](/docs/sdk/callbacks) for the payload. ## After a failed challenge [#after-a-failed-challenge] On dynamic hosted checkout, a shopper who fails the challenge or whose card is declined returns to the same checkout URL with the form restored, as long as the session has not expired. See [Dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout). ## Who runs the challenge [#who-runs-the-challenge] On a connection that cannot take an authentication from Altruon, the acquirer runs 3D Secure as part of the charge. With the [Altruon Vault](/docs/protect/vault), Altruon can authenticate first, on its own, and then pass the result to the acquirer routing selects. The challenge does not depend on which acquirer will charge the card. 3D Secure run by Altruon only works on cards stored in the Altruon Vault. The Altruon Vault must be turned on for your account before you can use it. Ask your Altruon account manager or write to [support@altruon.io](mailto:support@altruon.io). See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). Altruon asks the issuer before the charge, using the acquirer BIN and merchant ID you saved for that card's network. The issuer approves the card with no challenge, or asks the shopper to complete one. Altruon then sends the result with the payment: the electronic commerce indicator, the authentication value and the directory server transaction id. The acquirer authorizes on that result instead of starting its own 3D Secure. Altruon authenticates the card networks you fill in for that connection. Networks you leave empty stay with the payment processor, which runs 3D Secure itself. A technical failure does not fail the payment. The acquirer runs 3D Secure instead. An issuer that refuses the shopper does stop the payment. A later charge on a saved card is not authenticated again. A retry on the same acquirer, with the same acquirer BIN and merchant ID, can reuse the authentication, so the shopper is not challenged twice. A retry on a different acquirer runs 3D Secure again. The result is bound to the acquirer it was requested with. ## Turn it on [#turn-it-on] First, the Altruon Vault must be turned on for your account. See [Turn on the Altruon Vault](/docs/protect/vault#turn-on-the-altruon-vault). Then the **3D Secure** tab on **Settings > Vault** stays unavailable until Altruon turns the feature on. Write to [support@altruon.io](mailto:support@altruon.io) to ask for it. ### Choose a strategy [#choose-a-strategy] Go to **Settings > Vault** and open **3D Secure**. Under **Strategy**, choose one and click **Save strategy**. | Strategy | What Altruon does | |---|---| | **Always** | Every new card is authenticated before it is charged. The issuer decides whether to challenge the shopper. | | **When required by the issuer** | Only cards whose issuer requires authentication are authenticated. A payment declined for the lack of it is retried with authentication. | | **Never** | No card is authenticated on the connections Altruon can authenticate, and the payment processor's own 3D Secure is switched off there too. | **Never** asks you to confirm. Issuers that require authentication decline these payments, and fraud liability stays with you. ### Save the acquirer data [#save-the-acquirer-data] Under **Acquirer connections**, open the connection. The list holds the processors that can take an authentication Altruon ran. If the list is empty, no connected processor can take one yet, and each processor runs 3D Secure itself. Enter the merchant details and at least one card network. The values must match the acquirer's records. | Field | What to enter | |---|---| | **Merchant name, as registered at your acquirer** | The name the acquirer has on file | | **Website** | The merchant website | | **Country code** | Two letters, for example `FR` | | **Merchant category code (MCC)** | Four digits | | **Acquirer BIN** and **Merchant ID (MID)** | One row per network you want Altruon to authenticate: Visa, Mastercard, American Express, Discover, Cartes Bancaires | Click **Save acquirer data**. Altruon authenticates cards of the networks you filled in. The payment processor keeps authenticating the others. American Express also asks for **American Express requestor type** (`MER` for a merchant). Cartes Bancaires asks for a **SIRET number**. Discover asks for a **Discover client ID** if Discover gave you one. ### Wait for the first answered authentication [#wait-for-the-first-answered-authentication] Saving does not verify the connection. The first authentication an issuer answers does. Until then the connection is **Not verified yet**. After that it is **Verified**. **Needs attention** means the 3D Secure service rejected the acquirer data. Correct it and save again. Until you do, the payment processor runs 3D Secure on that connection. **Remove** stops Altruon authenticating on that connection. The payment processor runs 3D Secure itself again. The **Last 30 days** counters are **Authentications**, **Approved** (no challenge), **With a challenge** and **Not completed** (the issuer refused, the shopper left, or authentication was unavailable). ## Test it [#test-it] Use the 3D Secure test card in [Testing](/docs/resources/testing) to see the challenge in the sandbox. ## Related [#related] # Altruon Vault (/docs/protect/vault) When a card is stored by an acquirer, it can only be charged by that acquirer. The Altruon Vault stores the card outside any acquirer, so every acquirer you connect can charge it, and so routing, retries and network tokens can work across all of them. The shopper types the card into fields served by the vault. One token per card, deduplicated by fingerprint. Card details are known before the charge. Card data is added only to the request to that acquirer. ## Turn on the Altruon Vault [#turn-on-the-altruon-vault] There is no setup to follow. Ask your Altruon account manager, or write to [support@altruon.io](mailto:support@altruon.io), and Altruon turns the vault on for your account. These features work only on cards stored in the Altruon Vault. Turn the vault on before you use them: | Feature | What the vault makes possible | |---|---| | [3D Secure run by Altruon](/docs/protect/3d-secure) | Authenticate once, then pass the result to the acquirer routing selects | | [Network tokens](/docs/optimize/network-tokens) | A Visa or Mastercard token in place of the card number | | [Account updater](/docs/optimize/account-updater) | New card numbers and expiry dates applied before the renewal | | [Dynamic routing](/docs/optimize/routing#dynamic-routing) | Rules on the card and the payment, splits, and cascades of a declined card to another acquirer | | [Renewal cascades and retry](/docs/optimize/routing#retry-of-declined-renewals) | Try a soft-declined renewal on another acquirer, then retry it on the acquirer you choose | Your acquirer must also accept raw card data from Altruon on the API credentials you connect. Each [card acquirer guide](/docs/connections/acquirers) includes this check. ## How cards are stored [#how-cards-are-stored] - **Secure fields.** Shoppers type their card into the same secure form whichever acquirer will be charged. Card data never reaches your servers. - **Only good cards are kept.** A declined card never becomes a stored token. - **One card, one token.** Each card is stored once and deduplicated by fingerprint. - **Details before the charge.** BIN, brand, funding type, issuer country and last four digits are known before the payment is sent, which is what routing rules use. - **The security code is used once.** It is used for the first payment only. ## How cards are used [#how-cards-are-used] - Card data is injected only into the request to the acquirer you charge. - No application can read a card number back out of the vault. ## Who sees what [#who-sees-what] | | Sees the full card number | |---|---| | Your servers | No | | Your browser code | No. The fields are served by the vault | | The Altruon backoffice | No. Brand and last four digits only | | The acquirer you charge | Yes, in the payment request | ## Bring your existing cards [#bring-your-existing-cards] You do not start from zero. The Altruon Vault is a PCI Level 1 vault, and it can receive cards stored with any acquirer, orchestrator or independent vault provider, for example Stripe or Adyen. A migration usually follows the process that is standard in the industry. The PCI Level 1 company that holds your cards exports them in a file encrypted with PGP, and Altruon imports the file into the vault. - Copying never removes a card from the old provider. - Move subscriptions in waves, and roll any subscription back if you need to. To plan a migration, talk to your Altruon account manager or write to [support@altruon.io](mailto:support@altruon.io). ## Take your cards with you [#take-your-cards-with-you] Your tokens can be exported to any other vault or acquirer on request. This is written into your contract. ## Where the vault runs [#where-the-vault-runs] The Altruon Vault is hosted in the EU. ## Related [#related] # Testing (/docs/resources/testing) Test your integration in sandbox before you take a real payment. Sandbox is a separate environment with its own backoffice, URLs and keys. This page lists the test cards and the scenarios to run. ## Sandbox at a glance [#sandbox-at-a-glance] | | Sandbox value | |---|---| | Backoffice | `https://login.sandbox.altruon.io` | | API base URL | `https://{your-domain}.api.sandbox.altruon.io` | | Hosted page link | `https://{your-domain}.sandbox.altruon.io/checkout/p/{id}` | | Dynamic hosted checkout URL | `https://{your-domain}.sandbox.altruon.io/checkout/s/{sessionId}` | | Secret key (server only) | `sk_sandbox_...` | | Publishable key (browser) | `pk_sandbox_...` | See [Sandbox and environments](/docs/get-started/sandbox-and-environments) for how to get access. ## Test cards [#test-cards] Use these card numbers in sandbox. Enter any future expiry date and any three-digit CVC. | Scenario | Card number | |---|---| | Successful payment | `4111 1111 1111 1111` | | Declined payment | `4000 0000 0000 0002` | | 3D Secure required | `4000 0027 6000 3184` | | Insufficient funds | `4000 0000 0000 9995` | ## Test a hosted checkout [#test-a-hosted-checkout] These steps apply to [hosted pages](/docs/checkout/hosted-pages) and to [dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout). 1. Open the hosted page link, or create a sandbox session with `hostedCheckout: true` and open its `checkout_url`. 2. Check the page: your logo and colors, the plan and any pre-applied coupons in the order summary, the fields you enabled, and the payment methods routed for the currency. 3. On dynamic hosted checkout, check that the fields you sent in `customerData` are pre-filled. 4. Pay with the successful test card. Once the payment succeeds: - The shopper is redirected to your redirect URL. - A subscription is created on your billing platform. - The invoice is marked paid. - The transaction is recorded with the acquirer's own transaction ID. - For a hosted page, the **Converted** counter and the conversion rate of the page update under **Settings > Hosted Pages**. ### Scenarios worth running [#scenarios-worth-running] | Scenario | What to expect | |---|---| | A declined card or a failed 3D Secure challenge on dynamic hosted checkout | The shopper returns to the same `/checkout/s/{sessionId}` URL with the form restored and can retry while the session is valid. | | A failed payment on a session created without `paymentData.paymentMethod` | Every routed payment method stays available, so the shopper can switch method. | | A session left open for more than 15 minutes | The session expires. A hosted page link can be opened again and the session counts in the **Expired** column. A dynamic session cannot be restarted: create a new one. | | A hosted page in **Draft** or **Archived** status | The link is rejected at checkout. | ## Test Altruon.js callbacks [#test-altruonjs-callbacks] Trigger each callback of your [Altruon.js](/docs/checkout/altruon-js) integration at least once. | Callback | How to trigger it | |---|---| | `onSuccess` | Pay with the successful test card, `4111 1111 1111 1111`. | | `onFailure` | Pay with the declined test card, `4000 0000 0000 0002`. | | `onDataRequired` | Leave required fields empty and attempt the payment. | | `onActionRequired` with a redirect | Pay with the 3D Secure test card, `4000 0027 6000 3184`. | | `onActionRequired` with a QR code | Select Pix or UPI as the payment method. | A session is single use. After a failed payment in Altruon.js, create a new session before the shopper retries. See [Payment results](/docs/checkout/altruon-js/payment-results) for how to handle each callback, and the [callbacks reference](/docs/sdk/callbacks) for their payloads. To see a complete integration running against your sandbox keys, clone the merchant demo described in [Altruon.js examples](/docs/checkout/altruon-js/examples). ## Test trials [#test-trials] 1. Use sandbox plans with a trial period configured on each billing platform you connect. 2. Check that the estimate returns `trialEnd` before the payment. 3. Complete the checkout, then confirm that the subscription is in `trial` status in Altruon. 4. Confirm that the subscription becomes `active` after the trial end webhooks arrive. 5. Run a checkout without a trial and one with an amount due today, and confirm that both still charge as before. See [Trials](/docs/subscriptions/trials) for the supported acquirers and payment methods. ## Test coupons [#test-coupons] Test every coupon in sandbox before you use it in production. Invalid or unknown codes are rejected by the billing platform. See [Coupons](/docs/subscriptions/coupons) for the identifier each billing platform expects. ## Check the result [#check-the-result] After a successful test payment, look up the outcome from your server with the transaction ID: ```http GET https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/{transactionId}/details ``` The response describes the transaction with its customer, invoice and subscription. See [Get transaction details](/docs/api/transactions/get-details). ## Next steps [#next-steps] # Troubleshooting (/docs/resources/troubleshooting) Most problems come from one missing link in the chain: a connection, a routing entry or a webhook. Work down the list for your symptom. ## Checkout fails or payment methods do not appear [#checkout-fails-or-payment-methods-do-not-appear] ### Check the acquirer connection [#check-the-acquirer-connection] Under **Settings > Payment Gateways**, the acquirer must be connected and active. ### Check the routing entry [#check-the-routing-entry] A payment method appears only when a routing entry exists for it in the session's currency. See [Routing](/docs/optimize/routing). ### Check the billing connection [#check-the-billing-connection] Under **Settings > Billing Platforms**, the connection must be configured and valid. ### Check the session request [#check-the-session-request] The request needs `paymentData.currency`, `billingData.lineItems` and `billingData.billingPlatformId`. See [Create a session](/docs/api/sessions/create) and [Errors](/docs/api/errors). ### Check provider webhooks [#check-provider-webhooks] If payments stay pending, events from the acquirer or the billing platform are not reaching Altruon. Redo the webhook step in the [connection guide](/docs/connections). ## By symptom [#by-symptom] Only hosted pages with the status Active resolve. Draft and Archived links are rejected. See [Hosted pages](/docs/checkout/hosted-pages). Sessions expire after 15 minutes and are single use. An expired session cannot be restarted: create a new one. See [Sessions](/docs/concepts/sessions). Trials work only on certain acquirer and payment method pairs. Other combinations return an unsupported error when the session is created, and hosted checkout hides methods that cannot run a trial. Check that the estimate returns a trial end date. See [Trials](/docs/subscriptions/trials). Renewals start from the billing platform's invoice webhook. Check the webhook step for your [billing platform](/docs/connections/billing-platforms). See the troubleshooting section of [Handle payment results](/docs/checkout/altruon-js/payment-results). See [Style the component](/docs/checkout/altruon-js/styling). Per-session styles apply to Altruon.js only. Hosted checkout takes its appearance from **Settings > Checkout**. ## Your server does not receive Altruon webhooks [#your-server-does-not-receive-altruon-webhooks] ### Check the endpoint is active [#check-the-endpoint-is-active] Under **Settings > Webhooks**. Endpoints are disabled automatically after sustained failures. ### Check the event is selected [#check-the-event-is-selected] The event type must be in the endpoint's subscription list. ### Read the delivery log [#read-the-delivery-log] The endpoint's detail page shows each delivery with its status, response code and payload. Resend failed deliveries from there. ### Check your handler [#check-your-handler] It must answer with a 2xx within 10 seconds, and verify the signature against the raw request body. See [Verify signatures](/docs/api/webhooks/signatures). ## Contact support [#contact-support] Send the concrete identifiers. They let support find the payment without a back and forth. From the Create Session response. From the `onSuccess` callback or a webhook event. The payment id at the acquirer and the invoice or subscription id on the billing platform. The event id and the delivery log entry, if a webhook is involved. Write to [support@altruon.io](mailto:support@altruon.io). # Coupons (/docs/subscriptions/altruon-billing/coupons) A coupon is a discount your customers redeem with a code, or that you apply to a subscription. It takes a percentage or a fixed amount off the whole invoice or off selected products, for the first invoice, for a limited period or forever. You create coupons in the backoffice and use them on every checkout. Discount, eligible products, duration and limits. Pre-applied, typed by the shopper, or sent in the session. Shown with the coupon's name on invoices. ## Before you start [#before-you-start] To limit a coupon to some products, their prices must exist first. See [Product catalog](/docs/subscriptions/altruon-billing/product-catalog). Only admins can open **Settings > Altruon Billing**. ## Create a coupon [#create-a-coupon] ### Name the coupon and choose its code [#name-the-coupon-and-choose-its-code] Go to **Settings > Altruon Billing**, open the **Coupons** tab and click **New coupon**. | Field | What to enter | |---|---| | **Name** | Your internal name, up to 50 characters. | | **Code** | What customers enter at checkout, up to 50 characters. A code in capitals is suggested from the name, for example `LAUNCH20`. It cannot be changed later. | | **Name on invoices** | Optional. Shown on the discount line. Leave it empty to use the name. | ### Set the discount [#set-the-discount] Under **Type**, choose **Percentage** and enter the **Percentage off**, from 0.01% to 100%. Or choose **Fixed amount** and enter the **Amount off** and its **Currency**. Under **Applied to**, choose where the discount is taken off: - **The whole invoice**: taken off the invoice total. - **Each eligible product**: taken off each product you select. Under **Eligible products**, set **Plans**, **Add-ons** and **One-off charges** to **All**, **Selected** or **None**. With **Selected**, tick the prices the discount applies to. At least one must be eligible. ### Set the duration and limits [#set-the-duration-and-limits] Under **How long the discount applies**, choose: | Option | The discount applies to | |---|---| | **First invoice** | The first invoice only. | | **Limited period** | Every invoice for a set number of days, weeks, months or years. | | **Forever** | Every invoice, for the life of the subscription. | Two limits are optional: - **Expires on** is the last day the coupon can be redeemed. It must be in the future. - **Maximum redemptions** caps how many times the coupon can be redeemed. Leave it empty for no limit. Click **Create coupon**. ## Use a coupon at checkout [#use-a-coupon-at-checkout] A coupon is identified by its **Code** everywhere: - **Hosted pages.** Pre-apply it in the hosted page editor, under **Coupon codes**. - **Shopper entry.** Enable **Coupon code** in **Settings > Checkout > Fields** to let shoppers type their own code on hosted pages and on dynamic hosted checkout. - **Sessions.** Pass the code in `billingData.couponCodes`. The [Coupons](/docs/subscriptions/coupons) guide covers each checkout in detail, including how to let shoppers enter a code with Altruon.js. To apply a coupon to a subscription from the backoffice, select it under **Discounts** when you create or edit the subscription. See [Subscriptions](/docs/subscriptions/altruon-billing/subscriptions). ## Track and remove coupons [#track-and-remove-coupons] The **Coupons** tab lists coupons under **Active**, **Expired** and **Archived**. Each row shows the discount, the duration, how many times it was redeemed and when it expires. To stop a coupon from being redeemed, click **Remove coupon**. A coupon that was never redeemed is deleted. One that was redeemed is archived, and you can restore it from **Archived** with **Restore coupon**. ## Notes and limits [#notes-and-limits] - **Codes are permanent.** The code of a coupon cannot be changed after you create it. - **Fixed amounts have a currency.** A fixed amount coupon is only offered on a subscription in the same currency. - **Eligible products are prices.** With **Selected**, the coupon applies to the prices you tick, not to every price of a product. ## Next steps [#next-steps] # Altruon Billing (/docs/subscriptions/altruon-billing) Altruon Billing is a billing platform that Altruon sets up and runs for you. Your product catalog, coupons, subscriptions, invoices and credit notes live in the Altruon backoffice, and Altruon collects every payment through your own acquirers. Use it when you do not run a billing platform yet. If your plans already live in Stripe Billing, Chargebee, Recurly or Frisbii, [connect that platform](/docs/connections/billing-platforms) instead and keep it as the source of truth. Product families, plans, add-ons, one-off charges and prices. A hosted page, dynamic hosted checkout or Altruon.js. The subscription and its first invoice are created after payment. Altruon charges the saved payment method on each invoice. ## What you manage and what Altruon manages [#what-you-manage-and-what-altruon-manages] You run the catalog and the day-to-day billing. Altruon sets up the billing account itself and keeps its currency and billing profile. | Area | Where you find it | Who changes it | |---|---|---| | [Product catalog](/docs/subscriptions/altruon-billing/product-catalog) | **Settings > Altruon Billing > Product catalogue** | You | | [Coupons](/docs/subscriptions/altruon-billing/coupons) | **Settings > Altruon Billing > Coupons** | You | | [Subscriptions](/docs/subscriptions/altruon-billing/subscriptions) | **Subscriptions**, and the page of each customer under **Customers** | You | | [Invoices and credit notes](/docs/subscriptions/altruon-billing/invoices-and-credit-notes) | **Invoices** and **Credit notes** | You | | Currency | **Settings > Altruon Billing > Currency** | Altruon | | Billing profile | **Settings > Altruon Billing > Billing profile** | Altruon | The **Currency** tab shows your base currency and the additional currencies you can price in. The **Billing profile** tab shows your organization name, owner name, phone, VAT number, timezone and address. Both are read only. To change them, contact your Altruon representative. **Settings > Altruon Billing** and the **Actions** menus on customer and subscription pages are available to admins only. ## Set up Altruon Billing [#set-up-altruon-billing] ### Ask Altruon to turn it on [#ask-altruon-to-turn-it-on] Write to [support@altruon.io](mailto:support@altruon.io). Altruon creates your billing account with your organization name, base currency, timezone, address and VAT number. While the account is being created, **Settings > Altruon Billing** shows **Your billing is being set up**. There is nothing you need to do. The page fills in as soon as the account is ready, and **Settings > Billing Platforms** lists Altruon Billing as **Managed by Altruon**, with an **Open Altruon Billing** button. There are no credentials or webhooks for you to manage. ### Connect an acquirer and set up routing [#connect-an-acquirer-and-set-up-routing] Altruon Billing collects payments through your own acquirer accounts, as every other billing platform does. Connect at least one in **Settings > Payment Gateways** and add a routing entry for each payment method and currency you sell. See [Connect an acquirer](/docs/connections/acquirers) and [Routing](/docs/optimize/routing). ### Build your catalog [#build-your-catalog] Create a product family, then the plans, add-ons and one-off charges you sell, each with a price for every currency and billing frequency you offer. See [Product catalog](/docs/subscriptions/altruon-billing/product-catalog). ### Create your coupons [#create-your-coupons] This step is optional. A coupon gives a percentage or a fixed amount off, once, for a limited period or forever. See [Coupons](/docs/subscriptions/altruon-billing/coupons). ### Sell a plan [#sell-a-plan] Every checkout works with Altruon Billing: - **Hosted pages.** In the hosted page editor, choose **Altruon Billing** as the **Billing Platform**, then the product family, plan, price, add-ons and coupons. See [Hosted pages](/docs/checkout/hosted-pages). - **Dynamic hosted checkout and Altruon.js.** Create a session whose `billingData` points at your Altruon Billing connection and lists the price ids from your catalog in `lineItems`. See [Create a session](/docs/api/sessions/create). After the first payment, the subscription and its first invoice appear under **Subscriptions** and **Invoices**. Filter either list on **Altruon Billing** to see only these records. ## Renewals, retries and dunning [#renewals-retries-and-dunning] Renewals are collected the same way as with every other billing platform. When a renewal invoice falls due, Altruon charges the customer's saved payment method through your routing and records the payment on the invoice. A failed renewal follows your retry schedule. See [Retries and dunning](/docs/optimize/retries-and-dunning). When a customer has more than one payment method on file, you choose which one renewals charge on their customer page. See [Change the payment method renewals charge](/docs/subscriptions/altruon-billing/subscriptions#change-the-payment-method-renewals-charge). ## Next steps [#next-steps] # Invoices and credit notes (/docs/subscriptions/altruon-billing/invoices-and-credit-notes) Every charge in Altruon Billing is invoiced: the first charge of a subscription, each renewal, and every one-off charge. Altruon collects each invoice from the customer's saved payment method and records the payment on it. From an invoice you can download its PDF, collect it again when it is unpaid, and create a credit note to give credit or refund the payment. First charge, renewal or one-off charge. The saved payment method is charged through your routing. Credit for a later invoice, or a refund. ## Read an invoice [#read-an-invoice] Open an invoice from **Invoices**, or from the page of its customer or subscription. Filter **Invoices** on **Altruon Billing** to see only these invoices. The invoice shows its total, what is outstanding, when it was issued and when it was paid or voided, or the next collection attempt. Its summary runs from the subtotal, discounts and tax to the total, then the credits applied, the amount paid, adjustments, any amount written off and the amount due. Each payment attempt links to its transaction, and **Processed through** shows the acquirer and the payment method. The details list the invoice number, the type, the dates, the payment terms, whether prices include or exclude tax, the purchase order and the VAT number. | Invoice type | Raised for | |---|---| | First recurring charge | The start of a subscription. | | Renewal | Each later billing period. | | One-off | A one-time charge or a quick charge. | To get the PDF, click **Actions > Download PDF**. ## Collect an unpaid invoice [#collect-an-unpaid-invoice] When an invoice is unpaid and no payment is in progress, admins see **Collect now**. Click it and confirm to charge the payment method on file for the amount due. | Result | What it means | |---|---| | Payment collected | The invoice is paid. | | The payment is being processed | The outcome arrives later and is recorded on the invoice. | | The payment was declined | The invoice stays unpaid. | | A payment was already collected for this invoice | Nothing was charged again. | | There is no payment method on file to charge | [Request a payment method](/docs/subscriptions/altruon-billing/subscriptions#request-a-payment-method) from the customer. | An invoice is charged once. Clicking **Collect now** again, or collecting while a payment is in progress, never charges twice. ## Create a credit note [#create-a-credit-note] A credit note gives back part or all of what an invoice charged. You can create one on an invoice that is paid or partly paid, and not voided. ### Open the invoice [#open-the-invoice] Open the invoice and click **Actions > Create a credit note**. ### Choose what the credit note does [#choose-what-the-credit-note-does] Under **What should this credit note do?**, choose: - **Issue credit**. The customer can use this credit on a later invoice. No money is returned. - **Refund now**. The refund is recorded, and the payment is refunded when it can still be refunded. ### Enter the reason and the amount [#enter-the-reason-and-the-amount] Choose a **Reason**: **Product unsatisfactory**, **Service unsatisfactory**, **Order change**, **Order cancellation**, **Waiver** or **Other**. Enter the **Amount**, up to what the invoice charged minus any earlier credit notes. Add a **Note** if you like, up to 1,000 characters. It is shown on the credit note PDF. ### Create it [#create-it] Create the credit note. Its page opens, with its PDF and the invoice it belongs to. ## Find credit notes [#find-credit-notes] **Credit notes** in the sidebar lists every credit note with its status, issue date, reason, invoice and total. Filter the list on **Refund due**, **Refunded**, **Adjusted** or **Voided**. Credit notes also appear on the page of their subscription and customer. ## Notes and limits [#notes-and-limits] - **No credit on cancellation.** Canceling a subscription does not credit the unused part of the period. Create a credit note on its last invoice to give money back. - **Credit is capped.** All credit notes on an invoice together cannot exceed what the invoice charged. - **Voided invoices.** A voided invoice cannot have a credit note. ## Next steps [#next-steps] # Product catalog (/docs/subscriptions/altruon-billing/product-catalog) The product catalog is everything your customers can buy. Plans are the recurring products customers subscribe to, add-ons are recurring extras sold on top of a plan, and one-off charges are billed once, such as a setup fee. Every product belongs to a product family and is sold through its prices: one price for each currency and billing frequency you offer. ## Before you start [#before-you-start] **Settings > Altruon Billing** shows the **Product catalogue** tab. See [Set up Altruon Billing](/docs/subscriptions/altruon-billing#set-up-altruon-billing). Only admins can open **Settings > Altruon Billing**. A price can be in your base currency or in any additional currency on the **Currency** tab. ## Create a plan [#create-a-plan] ### Create a product family [#create-a-product-family] Go to **Settings > Altruon Billing**, open the **Product catalogue** tab and click **New product family**. A new catalog starts here. | Field | What to enter | |---|---| | **Name** | Up to 50 characters. | | **ID** | Letters, numbers, hyphens and underscores, up to 50 characters. It cannot be changed later. | | **Description** | Optional, up to 500 characters. | Click **Create family**. ### Create the plan [#create-the-plan] Open **Plans** and click **New plan**. | Field | What to enter | |---|---| | **Name** | Your internal name, unique in the catalog, up to 50 characters. | | **ID** | It cannot be changed later. | | **Name shown to customers** | Optional, up to 100 characters. It appears on checkout, invoices and emails. Leave it empty to use the name. | | **Description** | Optional, up to 2,000 characters. | | **Product family** | The family the plan belongs to. | | **Unit of measure** | Optional, up to 30 characters, for example `seat`. Set it when you charge per unit or by tier. | Under **Availability**, choose which add-ons and one-off charges can be sold with this plan: **Every add-on and charge**, or **Selected ones**. Then click **Create plan**. ### Add a price [#add-a-price] The new plan shows **No prices yet**. Click **Add price** and fill in the three sections of **New price**. **Pricing** - **Currency**. It cannot be changed after the price is created. To sell in another currency, add another price. - **Pricing model**. One of the five models in [Pricing models](#pricing-models). For tiered, volume and stairstep, enter each tier's **From** and **Up to** and its price, and click **Add tier** for the next one. The last tier has no upper limit. - **Taxable**. On by default. Tax is calculated on this price according to your tax settings. **Billing** - **Billing frequency**. **Monthly**, **Quarterly**, **Every 6 months**, **Yearly**, or **Custom** for every set number of days, weeks, months or years. - **Free trial**. Plans only. A number of days or months before the first charge. See [Trials](/docs/subscriptions/trials) for how checkout handles a trial. - **Billing cycles**. Optional. The number of periods to bill. Leave it empty to bill until the subscription is canceled. **Reference** The price name and ID are generated from the product, the currency and the frequency when you leave them empty. You can also set a **Name shown to customers** and a description. Click **Create price**. Add one price for every currency and billing frequency you offer, for example monthly and yearly in EUR and USD. ### Add add-ons and one-off charges [#add-add-ons-and-one-off-charges] Open **Add-ons** and click **New add-on**, or open **One-off charges** and click **New one-off charge**. They take the same fields as a plan, without **Availability**. Add a price to each one. One-off charges have no **Billing** section, because they are billed once. An add-on or a one-off charge can be sold with every plan, unless a plan limits its availability to **Selected ones**. ## Pricing models [#pricing-models] | Pricing model | How the amount is calculated | |---|---| | Flat fee | One fixed amount, whatever the quantity. | | Per unit | The same amount for every unit. | | Tiered | Each unit is charged at the rate of its own tier. | | Volume | Every unit is charged at the rate of the tier reached. | | Stairstep | One fixed amount for the tier reached. | A flat fee price has no quantity. Every other model takes a quantity at checkout and on the subscription. ## Sell the plan [#sell-the-plan] Use the price ids from the catalog in your checkout: - **Hosted pages.** Choose **Altruon Billing** as the billing platform, then the product family, plan and price. See [Hosted pages](/docs/checkout/hosted-pages). - **Sessions.** List the price ids in `billingData.lineItems`: the plan price first with the type `plan`, then add-ons, and one-off charges with the type `charge`. See [Create a session](/docs/api/sessions/create). ## Archive or delete a product [#archive-or-delete-a-product] Each product and price has edit, archive and delete icons. - **Archive** stops selling it and keeps its history. Turn on **Show archived** to find it again and restore it. - **Delete** removes it for good. This cannot be undone. A product family that still holds products cannot be deleted. ## Notes and limits [#notes-and-limits] - **IDs are permanent.** The ID of a product family or a product cannot be changed after you create it. - **Currency is fixed per price.** To change the currency of a price, create a new price. - **Currencies come from your account.** A price can only use your base currency or an additional currency. To add a currency, contact your Altruon representative. - **One price per offer.** A product needs a price for each currency and billing frequency you want to sell. ## Next steps [#next-steps] # Subscriptions (/docs/subscriptions/altruon-billing/subscriptions) Most subscriptions start at checkout. You can also create one from the backoffice for a customer who already has a payment method on file, and change, bill or cancel any subscription from its page. Every change that raises a charge is invoiced and collected at once, through your routing. ## Before you start [#before-you-start] The plan needs a price in the customer's currency. See [Product catalog](/docs/subscriptions/altruon-billing/product-catalog). A customer who paid at checkout has one. It is charged for the first invoice. The **Actions** menus on customer and subscription pages are available to admins only. ## Create a subscription [#create-a-subscription] ### Open the customer [#open-the-customer] Go to **Customers** and open the customer. Their page shows their subscriptions, payment methods, invoices, payments, credit notes and timeline. Click **Actions > Create a subscription**. ### Choose the plan [#choose-the-plan] Under **Plan**, choose the **Product family**, the **Plan** and its **Price**. Only prices in the customer's currency are offered. Set the **Quantity**, unless the price is a flat fee. For a flat fee or per unit price, you can change the **Price** for this subscription. The plan is charged and invoiced when the subscription starts. Nothing is left unbilled. ### Add extras and discounts [#add-extras-and-discounts] All of these are optional: - **Add-ons** and **One-off charges** from your catalog, limited to the ones the plan allows. - **Quick charge**: an amount that is not in the catalog, with a description. It is invoiced now. - **Coupons**: any active coupon. Fixed amount coupons are offered only in the customer's currency. - **Manual discount**: **Percentage off** or **Fixed amount off**, applied **Once** or **On every charge**. A subscription holds up to 30 items. ### Set the billing [#set-the-billing] | Field | What it does | |---|---| | **Start date** | **Immediately**, or **On a date**. The plan is invoiced when it starts. | | **Billing cycles** | **Forever**, or **Fixed** from 1 to 500. A fixed number overrides the plan's setting. | | **PO number** | Optional, up to 100 characters. It appears on the invoice as the purchase order. | | **Subscription id** | Optional, up to 50 characters. Leave it empty to have one generated. | Create the subscription. When it starts immediately, the customer's saved payment method is charged for the first invoice. ## Manage a subscription [#manage-a-subscription] Open a subscription from **Subscriptions** or from the customer's page. It shows the recurring amount before discounts and tax, a forecast of the next charge, the current period and anything outstanding, with its invoices, payments, credit notes and timeline. The **Actions** menu is available while the subscription is active, in trial, non renewing, future or paused. | Action | What it does | |---|---| | **Edit subscription** | Change the price or quantity of the plan, add add-ons and one-off charges, change discounts and the billing cycles left. | | **Cancel subscription** | End it now, at the end of the current period, on a date, or at the end of its billing term. | | **Add one-time charges or quick charges** | Bill a one-off charge from the catalog, or any amount. | | **Bill and invoice for future renewals** | Invoice up to 24 renewals in advance. | | **Edit next billing date** | Move the next renewal. | | **Edit trial end date** | End a trial now or on another date. Shown instead of **Edit next billing date** while the subscription is in trial. | ### Edit a subscription [#edit-a-subscription] A subscription has exactly one plan. You can change its price or quantity, add add-ons and one-off charges, and change its coupons and manual discount. A one-off charge that is already on the subscription is not billed again. A new one is invoiced with this change. Under **Billing cycles left**, keep the current setting or set a fixed number from 1 to 500. Under **When this applies**, choose: - **Now**. Any charge this change raises is invoiced immediately. Turn on **Apply proration** to credit the customer for the unused part of what they already paid and charge the new price for the days left. Leave it off to keep this period as it is and use the new price from the next renewal. - **On a specific date**. Nothing is invoiced today. The new terms apply at the start of that date. ### Cancel a subscription [#cancel-a-subscription] Under **When should it cancel?**, choose **Now**, **At the end of the current period**, **On a specific date**, or **At the end of the billing term** when the subscription has a fixed number of billing cycles. No credit is issued for the unused part of the current period. To refund part of a payment, [create a credit note](/docs/subscriptions/altruon-billing/invoices-and-credit-notes#create-a-credit-note) on its invoice. ### Add a one-time charge [#add-a-one-time-charge] A one-time charge is invoiced and collected now. Choose one: - **Catalogue charge**: one or more one-off charges from your catalog, each with a quantity. - **Quick charge**: an amount and a description, with an optional manual discount, an optional service period, and whether the charge is taxable. ### Bill future renewals in advance [#bill-future-renewals-in-advance] Enter the number of renewals to invoice, from 1 to 24, and click **Preview** to see the invoice. Click **Generate** to create it. The invoice is collected as soon as it is generated. ### Move the next billing date [#move-the-next-billing-date] Choose a future date and time, and enter a **Comment** of up to 400 characters. The comment is kept on the subscription and in the audit log. Moving the date does not create a charge or a credit. ### Change the end of a trial [#change-the-end-of-a-trial] Choose **Immediately** to end the trial now and raise the first invoice, or choose a new end date. ## Change the payment method renewals charge [#change-the-payment-method-renewals-charge] The customer's page lists every payment method on file. Click **Make primary** on the one renewals should charge. The current one stays on file. ## Request a payment method [#request-a-payment-method] On the customer's page, click **Actions > Request a payment method**. Altruon emails the customer a link to add a payment method, branded with your checkout's company name, logo and brand color. The customer needs an email address and an active subscription. ## Next steps [#next-steps] # Coupons (/docs/subscriptions/coupons) Coupons live on your billing platform. At checkout you pass their codes in `billingData.couponCodes`, and Altruon uses them for the price estimate and when it creates the subscription. This page shows how to apply coupons on each checkout and how the codes map to each billing platform. `billingData.couponCodes` in the Create Session request. Sends the codes with the estimate and with the subscription. Validates each code and prices the subscription. ## Before you start [#before-you-start] Altruon passes the values through. See [What each billing platform expects](#what-each-billing-platform-expects) for the identifier to use. The way a coupon reaches the session differs per checkout. See [Choose your checkout](/docs/checkout). ## Where coupons come from [#where-coupons-come-from] | Checkout | Coupons you apply | Coupons the shopper enters | |---|---|---| | [Hosted pages](/docs/checkout/hosted-pages) | **Coupon codes** on the hosted page, pre-applied and built into the link | The **Coupon code** toggle under **Settings > Checkout > Fields** | | [Dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout) | `billingData.couponCodes` in the Create Session request, shown as pre-applied in the order summary | The same **Coupon code** toggle | | [Altruon.js](/docs/checkout/altruon-js) | `billingData.couponCodes` in the Create Session request | Your own coupon field. You [re-create the session](#let-shoppers-enter-a-coupon-with-altruonjs) with the updated list | ## Pass coupons when you create the session [#pass-coupons-when-you-create-the-session] Send `couponCodes` inside `billingData` on `POST /api/session/v1/create`. It must be an array of strings. ```json { "paymentData": { "currency": "EUR", "paymentMethod": "card" }, "redirectUrl": "https://yourdomain.com/success", "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ { "type": "plan", "id": "price_123", "quantity": 1 } ], "couponCodes": ["SPRING25", "WELCOME10"] } } ``` The [Create Session reference](/docs/api/sessions/create) lists every other field of the request. ## Let shoppers enter a coupon on hosted checkout [#let-shoppers-enter-a-coupon-on-hosted-checkout] Go to **Settings > Checkout**, open the **Fields** tab and enable **Coupon code**. Shoppers can then type their own codes on hosted pages and on dynamic hosted checkout. This toggle is independent from the coupons you pre-apply. ## Let shoppers enter a coupon with Altruon.js [#let-shoppers-enter-a-coupon-with-altruonjs] Coupons are part of the session's `billingData`, which is set from your server. To let shoppers add or remove a coupon on your own checkout page, re-create the session with the updated list. Creating a session is one API call and every session is single use, so this is the recommended pattern. ### Keep the coupon list in your page state [#keep-the-coupon-list-in-your-page-state] Whenever the shopper applies or removes a coupon, ask your server for a new session that includes the updated list. ```jsx title="CheckoutPage.jsx" const [couponCodes, setCouponCodes] = useState([]); useEffect(() => { // Create a new session whenever the pricing inputs change. initializeCheckout(); // POST /api/session with { couponCodes, ... } }, [couponCodes]); ``` ### Forward the list when you create the session [#forward-the-list-when-you-create-the-session] On your server, add the coupon list to `billingData`. Leave the field out when the list is empty. ```js title="routes.js" const data = await createSession({ paymentData: { currency: cfg.currency }, redirectUrl, billingData: { billingPlatformId: cfg.billingConnectionId, lineItems: buildLineItems(cfg), ...(couponCodes?.length ? { couponCodes } : {}), }, }); ``` ### Render the new session [#render-the-new-session] Bind the new session ID and mount the component again. Altruon.js appends an iframe to the container, so clear the previous mount first. ```js altruon.setSession(sessionId); document.querySelector('#payment-container').innerHTML = ''; await altruon.renderComponent('#payment-container'); ``` Both snippets come from the [Altruon merchant demo](https://github.com/Altruon-io/merchant-demo), which works this way: see [`client/src/pages/CheckoutPage.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/pages/CheckoutPage.jsx) and [`server/src/routes.js`](https://github.com/Altruon-io/merchant-demo/blob/main/server/src/routes.js). ### Show the discount before the shopper pays [#show-the-discount-before-the-shopper-pays] Pair the pattern above with the estimate endpoint: ```http POST /api/checkout/v1/{billingConnectionId}/estimate-subscription ``` It prices the subscription, including the coupon discount and the tax, without creating anything. The demo's order summary ([`client/src/components/OrderSummary.jsx`](https://github.com/Altruon-io/merchant-demo/blob/main/client/src/components/OrderSummary.jsx)) runs the estimate again every time the coupon list or the billing country changes. ## What each billing platform expects [#what-each-billing-platform-expects] You always send `couponCodes` as an array of strings. Altruon maps the values for each billing platform: | Billing platform | Altruon sends them as | The values must be | |---|---|---| | Chargebee | `coupon_ids` | Valid Chargebee coupon IDs | | Recurly | `coupon_codes` | Valid Recurly coupon codes | | Stripe Billing | `discounts[].coupon` | Stripe coupon IDs, not promotion code IDs | | Frisbii | `coupon_codes` | Valid Frisbii coupon codes | With Altruon Billing, send the coupon's **Code** from **Settings > Altruon Billing > Coupons**. See [Altruon Billing coupons](/docs/subscriptions/altruon-billing/coupons). ## Behavior [#behavior] - **Several coupons.** `couponCodes` is an array, so you can send more than one code. - **Empty array.** An empty array means no coupon is sent. - **Invalid codes.** Invalid or unknown coupons are rejected by the billing platform. ## Test it [#test-it] Test every coupon in sandbox before you use it in production. 1. Create a sandbox session with the code in `billingData.couponCodes`, or enter it in the coupon field of a hosted checkout. 2. Check that the order summary shows the discount. 3. Complete a test payment. See [Testing](/docs/resources/testing) for sandbox test cards. A code your billing platform does not know is rejected, so also try one invalid code. ## Next steps [#next-steps] # How billing sync works (/docs/subscriptions) Altruon does not replace your billing platform. Plans, prices, subscriptions and invoices stay where they are. Altruon collects the money and writes the result back, so the two never disagree. Price, tax, coupons, trial and the amount due now come from the billing platform. The first invoice is marked paid with the acquirer's reference. The invoice webhook starts the charge. The payment is recorded on the invoice. Active, trial, paused, canceled. ## What Altruon reads [#what-altruon-reads] - **Your catalog.** Plans, charges and add-ons are referenced by their ids on the billing platform, in the session's `billingData.lineItems`. - **An estimate before payment.** Price, tax, coupons, trial and the amount due now are calculated by the billing platform, so checkout shows the same total the invoice will. - **Invoices that fall due.** The billing platform's webhook tells Altruon that an invoice needs collecting. ## What Altruon writes [#what-altruon-writes] | When | What is written | |---|---| | First payment succeeds, or a trial is set up | The subscription is created | | First payment succeeds | The first invoice is marked as paid, with a reference made of the acquirer, the payment method and the acquirer's transaction id | | A renewal is collected | The payment is recorded on that invoice | | A session carries `billingData.metadata` | The metadata is passed to the subscription | | A chargeback arrives | It is recorded on the billing platform. Today this covers direct debit reversals with Trustly | Every subscription, invoice and transaction in the Altruon backoffice links to its record in the billing platform's dashboard and in the acquirer's dashboard. ## Differences between platforms [#differences-between-platforms] | Billing platform | You provide | How a payment is recorded | |---|---|---| | [Stripe Billing](/docs/connections/billing-platforms/stripe-billing) | Secret key | Stripe does not charge its own payment methods. The invoice is marked as paid out of band | | [Chargebee](/docs/connections/billing-platforms/chargebee) | API token and site URL | The payment is recorded on the invoice | | [Recurly](/docs/connections/billing-platforms/recurly) | Private API key, EU or US domain | A transaction is recorded on the invoice | | [Frisbii](/docs/connections/billing-platforms/frisbii) | API key | The invoice is settled with an Altruon reference | Metadata lands in the platform's own field: subscription metadata on Stripe Billing, `meta_data` on Chargebee, metadata on Frisbii, custom fields on Recurly. ## What you keep doing on the billing platform [#what-you-keep-doing-on-the-billing-platform] - Create and change plans, prices and coupons. - Change, pause or cancel subscriptions. Altruon follows. Your billing platform has its own dunning emails and cancellation rules. Match them to the retry schedule in Altruon so a subscription is not canceled while a retry is still planned. See [Retries and dunning](/docs/optimize/retries-and-dunning). ## Next steps [#next-steps] # Trials (/docs/subscriptions/trials) A trial lets a shopper subscribe with nothing due today. Checkout collects a reusable payment method without charging it, and Altruon bills it automatically when the trial ends. Trials work with all four billing platforms: Stripe Billing, Chargebee, Recurly and Frisbii. ## How a trial works [#how-a-trial-works] 1. **Estimate.** Your billing platform returns the trial data for the cart: `trialEnd` and `amountDueNow`. Altruon uses it to show that nothing is due today and to schedule mandates. 2. **Acquirer setup.** The acquirer runs a zero-amount flow instead of a charge. The flow depends on the payment method: | Collection mode | What happens at signup | |---|---| | `SETUP` | The card is tokenized. | | `CONSENT` | The shopper gives a Pix or UPI consent. | | `MANDATE` | The shopper sets up an open banking mandate. | 3. **Subscription created.** Altruon creates the subscription in trial status, with `trial_start`, `trial_end`, and `nextBillingDate` set to `trial_end`. 4. **Trial end.** The billing platform moves the subscription to active and generates a payment-due invoice. Altruon collects it as a merchant-initiated transaction (MIT) with the credentials stored at signup. A payment method is always required at trial signup. That is what lets the first charge run without the customer. ## Before you start [#before-you-start] Stripe Billing, Chargebee, Recurly or Frisbii. See [Billing platforms](/docs/connections/billing-platforms). Either a plan with a trial configured in your billing catalog, or any paid recurring plan if you set the trial length at checkout. The acquirer and payment method must be one of the [supported pairs](#supported-acquirers-and-payment-methods). ## Where the trial length comes from [#where-the-trial-length-comes-from] By default, the trial length comes from your billing catalog, for example `trial_period_days` on a Stripe Price or the trial on a Chargebee item. This works on every checkout: hosted pages, dynamic hosted checkout and Altruon.js. To decide the trial length for each checkout instead, override it when you create the session. ## Override trial length per checkout [#override-trial-length-per-checkout] Set `billingData.forceTrialPeriodDays` on [Create Session](/docs/api/sessions/create) to set the trial length at checkout time instead of on the plan in your billing catalog. | | | |---|---| | **Field** | `billingData.forceTrialPeriodDays` (integer, days) | | **Range** | 1 to 730 | | **Effect** | Starts a subscription trial of that many days with nothing due for the subscription. Overrides any trial configured on the plan. | | **Due today** | The subscription portion is zero. One-time `lineItems` with `type: "charge"` are still charged today if present. | | **Billing platforms** | Stripe Billing, Chargebee, Recurly, Frisbii | | **Not supported** | Hosted pages (`hostedPageConfigId`, `/checkout/p/`) | ### Add the field to the session request [#add-the-field-to-the-session-request] Put the field inside `billingData`, not at the root of the request body. Use the ID of a paid recurring plan or price: the plan does not need a trial in your catalog. ```json { "hostedCheckout": true, "paymentData": { "currency": "USD" }, "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "forceTrialPeriodDays": 30, "lineItems": [ { "type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1 } ] }, "customerData": { "email": "shopper@example.com" }, "redirectUrl": "https://your-site.com/success" } ``` The field must be a property of `billingData`. If you send it next to `paymentData`, `customerData` or `hostedCheckout`, Altruon ignores it. ### Check the trial in the response [#check-the-trial-in-the-response] The Create Session response includes a `trial` object that reflects the override: ```json { "trial": { "inTrial": true, "trialStart": "2026-06-25T12:00:00Z", "trialEnd": "2026-07-25T12:00:00Z", "amountDueNow": "0", "nextInvoiceDate": "2026-07-25T12:00:00Z" } } ``` The `trial` object is output only. Do not send `forceTrialPeriodDays` inside it. With a one-time charge line item, `amountDueNow` is the total of the charges, and the subscription portion stays at zero. ### Send the shopper to checkout [#send-the-shopper-to-checkout] Redirect the shopper to `checkout_url`, or pass the session to Altruon.js. Checkout runs the zero-amount flow and the subscription starts in trial. ### How the override combines with the catalog [#how-the-override-combines-with-the-catalog] | Scenario | Trial length | |---|---| | The plan has a 7-day trial in the catalog, and you send `billingData.forceTrialPeriodDays: 30` | 30 days | | The plan has no trial, and you send `billingData.forceTrialPeriodDays: 30` | 30 days | | You do not send `billingData.forceTrialPeriodDays` | The catalog trial only | ### Validation [#validation] | Rule | Result | |---|---| | `forceTrialPeriodDays` is outside 1 to 730 | `400` | | `forceTrialPeriodDays` is combined with `hostedPageConfigId` (a hosted page) | `400` | | Nothing is due today and the acquirer and payment method pair does not support trials | An unsupported error when the session is created | ## Supported acquirers and payment methods [#supported-acquirers-and-payment-methods] A trial with nothing due today works with these pairs: | Acquirer | Payment methods | Collection mode | |---|---|---| | PagBrasil | `card`, `pix` | `SETUP` for card, `CONSENT` for Pix | | Adyen | `card` | `SETUP` | | Nuvei | `card` | `SETUP` | | Checkout.com | `card`, `applepay`, `kakaopay` | `SETUP` | | dLocal | `card`, `pix`, `upi` | `SETUP` for card, `CONSENT` for Pix and UPI | | Trustly | `openbanking` | `MANDATE` | Any other combination returns an unsupported error at session creation when the plan is in trial with nothing due today. ## What the shopper sees [#what-the-shopper-sees] - The order summary shows "Free until" with the trial end date, or an equivalent, when `amountDueNow` is zero. - Hosted checkout hides the payment methods that are not in the table above. - A PagBrasil Pix trial uses a consent-only flow. There is no charge today, and the first debit is scheduled from `trialEnd` (PagBrasil's `pix_rec_first_recurrence`). ## The trial object [#the-trial-object] Session and estimate responses include a `trial` object when the cart is in trial, whether the trial comes from the catalog or from `billingData.forceTrialPeriodDays`. | Field | Description | |---|---| | `inTrial` | Whether the cart is in a trial period | | `trialStart` | ISO 8601 instant when the trial starts | | `trialEnd` | ISO 8601 instant when the trial ends | | `amountDueNow` | Amount charged at signup, typically `0` for a pure trial | | `nextInvoiceDate` | Date of the first invoice after the trial | Pending payment responses from the acquirer may include `paymentCollectionMode` (`SETUP`, `CONSENT`, `MANDATE` or `CHARGE`) as a hint for your frontend. ## Trial with an amount due today [#trial-with-an-amount-due-today] If the estimate returns an `amountDueNow` greater than zero, for example a trial with a setup fee, a one-time charge or a discounted first period, Altruon runs a normal `CHARGE` flow for today's amount. The payment method is still stored for the renewal. ## When the trial ends [#when-the-trial-ends] At `trialEnd`, the billing platform activates the subscription and issues a payment-due invoice. Altruon collects it with the payment method stored at signup. If the collection fails, your retry rules apply. Altruon cancels the subscription only if you configured that as the end of the retries, never preemptively at trial end. See [Retries and dunning](/docs/optimize/retries-and-dunning). ## Test it [#test-it] 1. Use sandbox plans with a trial period configured on your billing platform, or send `billingData.forceTrialPeriodDays`. 2. Check that the estimate returns `trialEnd` before the payment: the session response carries the `trial` object. 3. Complete the checkout, then confirm that the subscription is in `trial` status in Altruon. 4. Confirm that the subscription becomes `active` once the trial end webhooks from your billing platform arrive. 5. Run a checkout without a trial and one with an amount due today, and confirm that both still charge as before. See [Testing](/docs/resources/testing) for sandbox test cards. ## Limits [#limits] - **Hosted pages.** `billingData.forceTrialPeriodDays` is not supported on hosted pages. A trial configured on the plan still works there. - **Days only.** The override is an integer number of days from 1 to 730. Convert months to days on your server. - **Plan level only.** The override applies to the plan. You cannot force a trial per add-on. - **Stripe trial offers.** Stripe Product trial offers (IDs that start with `to_`) are not supported. Use a paid recurring price ID. - **Unsupported pairs.** Acquirer and payment method pairs outside the [supported list](#supported-acquirers-and-payment-methods) are rejected at session creation when nothing is due today. ## Next steps [#next-steps] # Authentication (/docs/api/authentication) Every API request carries your secret key in the `x-secret-key` header. The API does not use an `Authorization: Bearer` header. ```http POST /api/session/v1/create HTTP/1.1 Host: {your-domain}.api.sandbox.altruon.io Content-Type: application/json x-secret-key: sk_sandbox_... ``` ```bash curl "https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/{transactionId}/details" \ -H "x-secret-key: $ALTRUON_SECRET_KEY" ``` ## Secret key and publishable key [#secret-key-and-publishable-key] Altruon gives you two keys. They are not interchangeable. | | Secret key | Publishable key | |---|---|---| | Sandbox format | `sk_sandbox_...` | `pk_sandbox_...` | | Where it runs | Your server only | The browser | | How you send it | `x-secret-key` header on every API request | First argument of `altruon.init()` in Altruon.js | | What it does | Creates sessions and reads transaction details | Initializes the embedded payment component for your domain | Which keys you need depends on your checkout: - **Hosted pages** need no key. You build them in the backoffice. - **Dynamic hosted checkout** needs the secret key, on your server, to [create the session](/docs/api/sessions/create). - **Altruon.js** needs both: the secret key on your server to create the session, and the publishable key in the browser. See [Altruon.js](/docs/sdk). ## Find your keys [#find-your-keys] Sign in to the backoffice and open **Settings > API Keys**. Both the secret key and the publishable key are listed there. ## Sandbox and production [#sandbox-and-production] Sandbox and production are separate environments with separate hosts. Send sandbox keys to the sandbox host, and build and test there before you go live. | Environment | API base URL | |---|---| | Sandbox | `https://{your-domain}.api.sandbox.altruon.io` | | Production | `https://{your-domain}.api.altruon.io` | ## Keep the secret key on your server [#keep-the-secret-key-on-your-server] Anyone who has it can create sessions and read transaction details for your account. The browser should only ever receive a `session_id` or a `checkout_url`. - Create sessions and fetch transaction details from your backend only. - Load the key from an environment variable. Do not hard-code it or commit it. - Do not log the key. - Use only the publishable key in the browser. ## Failed authentication [#failed-authentication] A request with a missing or invalid secret key is rejected with HTTP `401` and the error code `unauthorized`. Check that the header is named `x-secret-key` and that it holds the secret key, not the publishable key. See [Errors](/docs/api/errors). ## Webhook signing secrets [#webhook-signing-secrets] Webhooks do not use these keys. Each webhook endpoint has its own signing secret (`whsec_...`) that you use to check that a delivery came from Altruon. See [Verify signatures](/docs/api/webhooks/signatures). # Errors (/docs/api/errors) When a request fails, the API responds with a `4xx` or `5xx` HTTP status and a JSON body with one `error` object. Branch on `error.code`. Show or log `error.message`. ## Error response [#error-response] ```json { "error": { "code": "invalid_request", "message": "Missing required field: paymentData.currency", "details": {} } } ``` Present on every failed request. Machine-readable error code. One of the codes below. What went wrong, in plain English, for example `Missing required field: paymentData.currency`. Additional detail about the error. An empty object in the example above. ## Error codes [#error-codes] | Code | Meaning | What to do | |---|---|---| | `invalid_request` | A request parameter is missing or invalid. | Read `error.message`, then compare your body with the [request fields](/docs/api/sessions/create#request-body). | | `unauthorized` | The secret key is missing or invalid. | Send your secret key in the `x-secret-key` header. See [Authentication](/docs/api/authentication). | | `invalid_line_item` | A line item ID was not found or is not valid. | Check that every `billingData.lineItems[].id` exists on the billing platform behind `billingPlatformId`. | | `invalid_billing_platform` | The billing platform is not configured. | Connect the billing platform in the backoffice under **Settings > Billing Platforms** and send its ID in `billingData.billingPlatformId`. See [Billing platforms](/docs/connections/billing-platforms). | | `rate_limit_exceeded` | Too many requests. | Retry with a backoff: wait before each retry, and wait longer each time. | ## HTTP statuses [#http-statuses] | Status | When | Returned by | |---|---|---| | `200` | The request succeeded. | [Create a session](/docs/api/sessions/create) | | `400` | `billingData.forceTrialPeriodDays` is outside 1 to 730, or is combined with `hostedPageConfigId`. | Create a session | | `401` | The secret key is missing or invalid. | [Get transaction details](/docs/api/transactions/get-details) | | `404` | No transaction has the ID in the path. | Get transaction details | | Other `4xx`, `5xx` | The request failed. Read the `error` object. | Both endpoints | Tell errors apart by `error.code`, not by the status alone. ## Rejections at session creation [#rejections-at-session-creation] These requests are also rejected when you create a session: | Request | Result | What to do | |---|---|---| | A trial with nothing due today, on an acquirer and payment method that does not support trials | An unsupported error | Use a combination from the trial matrix in [Trials](/docs/subscriptions/trials), or leave `paymentMethod` out so hosted checkout shows only the methods that support trials. | | A key in `billingData.customerCustomFields` that does not start with `cf_` | The key is rejected | Prefix every key with `cf_`. | | A coupon in `billingData.couponCodes` that the billing platform does not know | The billing platform rejects it | Send coupon IDs or codes that exist on the billing platform. See [Coupons](/docs/subscriptions/coupons). | A `forceTrialPeriodDays` at the top level of the body is not an error. It is ignored, and no trial is forced. Nest it inside `billingData`. ## Payment failures are not API errors [#payment-failures-are-not-api-errors] A declined or failed payment does not produce an `error` object. You learn about it in other places: - In Altruon.js, the `onFailure` callback fires. See [Callbacks](/docs/sdk/callbacks). - [Get transaction details](/docs/api/transactions/get-details) returns the transaction with `status` set to `failed` and the reason in `errorMessage`. - Webhooks send `payment.failed`. See [Event types](/docs/api/webhooks/events). ## Handle errors in code [#handle-errors-in-code] ```js title="server.js" const response = await fetch(url, options); const data = await response.json(); if (!response.ok) { switch (data.error.code) { case 'rate_limit_exceeded': // Wait, then retry. break; case 'unauthorized': // Wrong or missing secret key. Fix the configuration. break; case 'invalid_request': case 'invalid_line_item': case 'invalid_billing_platform': default: // The request cannot succeed as sent. throw new Error(`${data.error.code}: ${data.error.message}`); } } ``` # API reference (/docs/api) Your server uses the Altruon API to create sessions and to read the result of a payment. Altruon reports changes back to your server with webhooks. Every call is authenticated with your secret key, so none of it runs in the browser. ## Base URLs [#base-urls] Each environment has its own host. Replace `{your-domain}` with your Altruon domain, for example `mycompany`. | Environment | API base URL | Hosted checkout | |---|---|---| | Sandbox | `https://{your-domain}.api.sandbox.altruon.io` | `https://{your-domain}.sandbox.altruon.io` | | Production | `https://{your-domain}.api.altruon.io` | `https://{your-domain}.altruon.io` | Hosted checkout pages live under the hosted checkout host: `/checkout/p/{id}` for hosted pages and `/checkout/s/{sessionId}` for dynamic hosted checkout. Sandbox and production are separate environments. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). ## Endpoints [#endpoints] | Method | Path | Reference | |---|---|---| | `POST` | `/api/session/v1/create` | [Create a session](/docs/api/sessions/create) | | `GET` | `/api/v1/transaction/{transactionId}/details` | [Get transaction details](/docs/api/transactions/get-details) | ## Conventions [#conventions] | Topic | Convention | |---|---| | Transport | HTTPS. Request bodies are JSON, sent with `Content-Type: application/json`. | | Authentication | Your secret key in the `x-secret-key` header, from your server only. See [Authentication](/docs/api/authentication). | | Success | A JSON body. Create a session returns `200 OK`. | | Errors | A `4xx` or `5xx` status with an `error` object that has a `code`, a `message` and `details`. See [Errors](/docs/api/errors). | | Field names | Request bodies use camelCase (`paymentData`, `billingPlatformId`). The create session response uses snake_case (`session_id`, `checkout_url`). The transaction details response uses camelCase (`idAtGateway`). | | Currencies | Three-letter ISO 4217 codes, for example `USD`, `EUR`, `BRL`. | | Countries | ISO 3166-1 alpha-2 codes, for example `BR`, `US`. | | Timestamps | ISO 8601 strings, for example `2026-06-21T12:15:00Z`. | | Amounts | Transaction details returns amounts as strings in minor units (`"12300"`), with the display value in `amountInMajorUnit` (`"123.00"`). | | Session lifetime | A session is single use and expires 15 minutes after it is created. | ## Webhooks [#webhooks] The API is for the calls you make. Webhooks are the calls Altruon makes to you: a signed HTTPS `POST` to your endpoint when a subscription, invoice, payment, refund, customer or session changes. Payloads are thin, so treat an event as a trigger and fetch the current state through the API. Your billing platform and your acquirers also send webhooks to Altruon. That is a separate setup: see [The two webhook directions](/docs/concepts/webhooks). ## Start here [#start-here] # Create a session (/docs/api/sessions/create) Creates a session: the currency, the cart and optional customer data for one checkout attempt. A session is single use and expires 15 minutes after you create it. **Authentication:** your secret key in the `x-secret-key` header. Call this endpoint from your server only. See [Authentication](/docs/api/authentication). One request shape serves two checkouts: | Checkout | Request | What you use from the response | |---|---|---| | [Altruon.js](/docs/checkout/altruon-js) (embedded) | `hostedCheckout` omitted or `false` | Pass `session_id` to the browser and call `altruon.setSession()` | | [Dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout) | `hostedCheckout: true` | Redirect the shopper to `checkout_url` | For how sessions behave, see [Sessions](/docs/concepts/sessions). ## Request body [#request-body] Send JSON with `Content-Type: application/json`. Payment settings for the session. Three-letter ISO 4217 currency code, for example `USD`, `EUR` or `BRL`. Set it here: it cannot be changed from the browser. Payment method to lock the session to, for example `card`, `pix` or `upi`. Other values used in these docs: `applepay`, `kakaopay`, `openbanking`. Omit it for discovery mode. On hosted checkout the shopper then sees every payment method routed for the session currency. On Altruon.js the component follows your routing entries: several entries for the currency render a drawer where the shopper picks a method, a single entry renders only the fields of that method. Pass it and only that method is shown, for the life of the session. See [Payment method pinning](#payment-method-pinning). The cart, and the billing platform that owns it. ID of your billing platform connection in Altruon. Find it in the backoffice under **Settings > Billing Platforms**. Set it here: it cannot be changed from the browser. Items to purchase. Put exactly one `plan` item first, then add-ons. Set them here: they cannot be changed from the browser. Kind of item. `plan` for the subscription plan, `charge` for a one-time charge. Add-ons have their own types. ID of the item on your billing platform, for example a Stripe Billing price ID such as `price_1SMtJj4hYau76GhIakR22BKu`. Number of units. The examples in these docs send both `1` and `"1"`. Billing frequency, for example `monthly`, `yearly` or `weekly`. Coupons to apply to the estimate and to the subscription. An empty array sends no coupon. The billing platform rejects unknown coupons. See [Coupons](/docs/subscriptions/coupons). Your own key and value pairs, both strings. At most 50 keys. A key has at most 40 characters, a value at most 500 characters. Altruon forwards them to the billing platform when the subscription is created: - Stripe Billing: subscription `metadata` - Chargebee: subscription `meta_data` - Frisbii: subscription `metadata` - Recurly: subscription `custom_fields`. The field names must already exist in Recurly. Chargebee only. Custom fields written on the Chargebee customer when it is created. Every key must start with `cf_`, for example `cf_field1`. Keys without that prefix are rejected. This map is separate from `metadata`, which is stored on the subscription. It is not returned to the shopper, and the hosted page cannot change it. Trial length in days, from 1 to 730. Starts a trial with nothing due today for the subscription and overrides any trial configured on the plan. Line items of type `charge` are still charged today. It must be nested inside `billingData`. At the top level of the body it is ignored. It cannot be used with hosted pages (`hostedPageConfigId`). See [Trials](/docs/subscriptions/trials). Where the shopper goes after a successful payment. A full URL including the protocol, for example `https://example.com/success`. After a redirect flow such as 3D Secure or a bank login, Altruon returns the shopper to this URL with `?trx_id=` and the transaction ID appended. Set it to `true` for [dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout). The response then includes `checkout_url`, and the session uses the full hosted checkout page with your site branding and the order summary. Do not combine it with `hostedPageConfigId`: the two are mutually exclusive. Asks for a network token on the card stored by this checkout. Read only when the network token strategy is **On request**. Ignored when the strategy is **Off** or **Always**. A [hosted page](/docs/checkout/hosted-pages) does not send it. See [Network tokens](/docs/optimize/network-tokens). Customer identity and addresses. Optional. On dynamic hosted checkout these values pre-fill the page. They are defaults: the shopper can edit them before paying. After a failed 3D Secure or card redirect, the session restores the values that were last saved on it. On Altruon.js you can pass the same fields from the browser instead. See [Customer data](/docs/checkout/altruon-js/customer-data). First name. Fills the main **First name** field on hosted checkout. Last name. Fills the main **Last name** field. Email address. Phone number, for example `+5511999999999`. Shown on hosted checkout only if the field is enabled under **Settings > Checkout > Fields**. IP address of the shopper. Used by some acquirers. Billing address. Address line 1. Address line 2: apartment, suite and so on. City. State or province. Zip or postal code. ISO 3166-1 alpha-2 country code, for example `BR` or `US`. If it is not on the session, Altruon.js can set it from the browser. First name for the billing address. Send it only if your checkout collects a name under **Billing address**, separate from the main name fields. It is not copied from `customerData.firstName`. Last name for the billing address. Same rule as `firstName`. Shipping address, with the same fields as `billingAddress`. Shown on hosted checkout only if shipping fields are enabled. Tax or identity document of the shopper, for example a CPF or CNPJ in Brazil. A top-level field, not part of `customerData`. Pre-fills the document field of the PagBrasil Pix and card forms. Language of hosted checkout and of the Altruon.js component. Supported: `en` and `pt_br`. `pt-BR`, `pt` and `en-US` are also accepted. Any other value falls back to `en`. Omit it and the checkout picks the language from the currency: Portuguese for `BRL`, English otherwise. Appearance of the embedded Altruon.js component. Hosted checkout ignores it and takes its appearance from **Settings > Checkout**. See [Style options](/docs/sdk/style-options). Background color. Hex, rgb or a named color. Color of buttons and interactive elements. Color of supporting elements. Color of highlights and focus states. Corner radius. Color of header text. Color of body text. Font family for all text. Whether elements have a drop shadow. ## Example requests [#example-requests] ### Minimal request [#minimal-request] ```json { "paymentData": { "currency": "USD" }, "redirectUrl": "https://example.com/success", "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ { "type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1 } ] } } ``` ```json { "hostedCheckout": true, "paymentData": { "currency": "BRL" }, "redirectUrl": "https://example.com/success", "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ { "type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1 } ] } } ``` ### Complete request [#complete-request] ```json { "paymentData": { "currency": "USD", "paymentMethod": "card" }, "redirectUrl": "https://example.com/success", "locale": "en", "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ { "type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1 } ], "frequency": "monthly", "couponCodes": ["SPRING25"], "metadata": { "user_id": "user_123", "platform": "web" } }, "customerData": { "email": "shopper@example.com", "billingAddress": { "country": "US" } }, "styleCustomization": { "backgroundColor": "#ffffff", "primaryColor": "#0066FF", "secondaryColor": "#6B7280", "accentColor": "#0066FF", "borderRadius": "12px", "headerTextColor": "#000000", "textColor": "#1F2937", "fontFamily": "Inter, system-ui, sans-serif", "dropShadow": true } } ``` ```json { "hostedCheckout": true, "paymentData": { "currency": "BRL" }, "redirectUrl": "https://example.com/success", "locale": "pt_br", "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ { "type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1 } ], "couponCodes": ["LAUNCH10"], "metadata": { "user_id": "user_456" }, "forceTrialPeriodDays": 30 }, "customerData": { "firstName": "João", "lastName": "Silva", "email": "joao@example.com", "phone": "+5511999999999", "billingAddress": { "street": "Av. Paulista", "number": "1000", "city": "São Paulo", "state": "SP", "zipCode": "01310-100", "country": "BR" } }, "document": "12345678909" } ``` ## Response [#response] A successful request returns `200 OK`. Unique ID of the session, a UUID. ISO 8601 timestamp of when the session expires: 15 minutes after creation. URL of the hosted checkout page for this session. Present when you sent `hostedCheckout: true`. Redirect the shopper to it. Checkout language of the session, for example `pt_br`. `true` if you sent `paymentData.paymentMethod`, `false` if you left it out. Always present. See [Payment method pinning](#payment-method-pinning). Payment methods routed for the session currency. Present in discovery mode, when the request had no `paymentMethod`. Payment method, for example `card` or `pix`. Acquirer that the method is routed to, for example `CHECKOUTCOM` or `PAGBRASIL`. UUID of the acquirer connection. The payment method you pinned. Present when the request had a `paymentMethod`. Acquirer selected for the pinned method. Present when the request had a `paymentMethod`. UUID of the acquirer connection. Present when the request had a `paymentMethod`. Present when the plan has a trial in your billing catalog, or when you sent `billingData.forceTrialPeriodDays`. Output only. See [Trials](/docs/subscriptions/trials). Whether the cart is in a trial period. ISO 8601 timestamp of when the trial starts. ISO 8601 timestamp of when the trial ends. Amount charged at signup. `"0"` for a trial with nothing else in the cart. With a one-time charge line item, it is the total of the charges. Date of the first invoice after the trial. ### Example responses [#example-responses] ```json { "session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "expires_at": "2026-06-21T12:15:00Z", "checkout_url": "https://{your-domain}.sandbox.altruon.io/checkout/s/a1b2c3d4-e5f6-7890-abcd-ef1234567890", "locale": "pt_br", "payment_method_pinned_at_create": false, "available_payment_methods": [ { "payment_method": "pix", "gateway": "PAGBRASIL", "gateway_connection_id": "550e8400-e29b-41d4-a716-446655440000" }, { "payment_method": "card", "gateway": "CHECKOUTCOM", "gateway_connection_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7" } ] } ``` ```json { "session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "expires_at": "2026-06-21T12:15:00Z", "checkout_url": "https://{your-domain}.sandbox.altruon.io/checkout/s/a1b2c3d4-e5f6-7890-abcd-ef1234567890", "payment_method_pinned_at_create": true, "payment_method": "card", "gateway": "CHECKOUTCOM", "gateway_connection_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7" } ``` ```json { "session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "expires_at": "2026-06-25T12:15:00Z", "checkout_url": "https://{your-domain}.sandbox.altruon.io/checkout/s/a1b2c3d4-e5f6-7890-abcd-ef1234567890", "payment_method_pinned_at_create": false, "available_payment_methods": [ { "payment_method": "card", "gateway": "CHECKOUTCOM", "gateway_connection_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7" } ], "trial": { "inTrial": true, "trialStart": "2026-06-25T12:00:00Z", "trialEnd": "2026-07-25T12:00:00Z", "amountDueNow": "0", "nextInvoiceDate": "2026-07-25T12:00:00Z" } } ``` `checkout_url` appears in these examples because the requests set `hostedCheckout: true`. ### Payment method pinning [#payment-method-pinning] `payment_method_pinned_at_create` records what you asked for when you created the session. It does not change when the shopper selects a payment method or retries with another one during checkout. | Value | You sent | Hosted checkout shows | |---|---|---| | `false` | No `paymentMethod` (discovery mode) | Every payment method routed for the session currency, for example Pix and card for `BRL`. After a failed payment all methods stay available, so the shopper can switch. | | `true` | A `paymentMethod` (pinned) | Only that method and its acquirer. It stays locked for the life of the session, including after a failed payment. | Use discovery mode when the shopper should choose. Pin the method when you already know it, for example a card-only upgrade flow or a link in your app that says "pay with Pix". Hosted checkout reads the field for you. You only need to branch on it if you build your own checkout UI. The same value is returned by `GET /api/session/v1/{sessionId}`. ## Errors [#errors] A failed request returns a `4xx` or `5xx` status with an `error` object: ```json { "error": { "code": "invalid_request", "message": "Missing required field: paymentData.currency", "details": {} } } ``` The codes this endpoint returns are `invalid_request`, `unauthorized`, `invalid_line_item`, `invalid_billing_platform` and `rate_limit_exceeded`. A trial with nothing due today on an acquirer and payment method that does not support trials is also rejected here. See [Errors](/docs/api/errors) for what each one means and what to do. ## Code samples [#code-samples] Each sample creates a session and reads `session_id`. Keep the secret key in an environment variable. ```bash curl -X POST "https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create" \ -H "Content-Type: application/json" \ -H "x-secret-key: $ALTRUON_SECRET_KEY" \ -d '{ "paymentData": { "currency": "USD", "paymentMethod": "card" }, "redirectUrl": "https://example.com/success", "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ { "type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1 } ] } }' ``` ```js const response = await fetch( 'https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-secret-key': process.env.ALTRUON_SECRET_KEY, }, body: JSON.stringify({ paymentData: { currency: 'USD', paymentMethod: 'card' }, redirectUrl: 'https://example.com/success', billingData: { billingPlatformId: '3287b8c7-ce43-41fd-9d58-f510e610b8f3', lineItems: [ { type: 'plan', id: 'price_1SMtJj4hYau76GhIakR22BKu', quantity: 1 }, ], }, }), }, ); const data = await response.json(); if (!response.ok) throw new Error(data.error.message); const sessionId = data.session_id; ``` ```python import os import requests response = requests.post( "https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create", headers={ "Content-Type": "application/json", "x-secret-key": os.environ["ALTRUON_SECRET_KEY"], }, json={ "paymentData": {"currency": "USD", "paymentMethod": "card"}, "redirectUrl": "https://example.com/success", "billingData": { "billingPlatformId": "3287b8c7-ce43-41fd-9d58-f510e610b8f3", "lineItems": [ {"type": "plan", "id": "price_1SMtJj4hYau76GhIakR22BKu", "quantity": 1} ], }, }, ) data = response.json() if not response.ok: raise RuntimeError(data["error"]["message"]) session_id = data["session_id"] ``` ```ruby require 'httparty' response = HTTParty.post( 'https://{your-domain}.api.sandbox.altruon.io/api/session/v1/create', headers: { 'Content-Type' => 'application/json', 'x-secret-key' => ENV['ALTRUON_SECRET_KEY'] }, body: { paymentData: { currency: 'USD', paymentMethod: 'card' }, redirectUrl: 'https://example.com/success', billingData: { billingPlatformId: '3287b8c7-ce43-41fd-9d58-f510e610b8f3', lineItems: [ { type: 'plan', id: 'price_1SMtJj4hYau76GhIakR22BKu', quantity: 1 } ] } }.to_json ) raise response['error']['message'] unless response.success? session_id = response['session_id'] ``` ```php true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'x-secret-key: ' . getenv('ALTRUON_SECRET_KEY'), ], CURLOPT_POSTFIELDS => json_encode([ 'paymentData' => ['currency' => 'USD', 'paymentMethod' => 'card'], 'redirectUrl' => 'https://example.com/success', 'billingData' => [ 'billingPlatformId' => '3287b8c7-ce43-41fd-9d58-f510e610b8f3', 'lineItems' => [ ['type' => 'plan', 'id' => 'price_1SMtJj4hYau76GhIakR22BKu', 'quantity' => 1], ], ], ]), ]); $data = json_decode(curl_exec($ch), true); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($status >= 400) { throw new Exception($data['error']['message']); } $sessionId = $data['session_id']; ``` ## Next steps [#next-steps] # Get transaction details (/docs/api/transactions/get-details) Returns one transaction together with the customer, invoice and subscription it belongs to on your billing platform, and a direct link to each record in the acquirer and billing dashboards. **Authentication:** your secret key in the `x-secret-key` header. Call this endpoint from your server only. See [Authentication](/docs/api/authentication). ## When to call it [#when-to-call-it] The browser only ever learns the transaction ID. Everything else comes from this endpoint. - **After the `onSuccess` callback.** Altruon.js passes `transactionId` and `message` to the callback, nothing more. Send the ID to your server and fetch the details there. See [Payment results](/docs/checkout/altruon-js/payment-results). - **After a redirect.** When a redirect flow such as 3D Secure returns the shopper to your `redirectUrl`, the transaction ID is in the `trx_id` query parameter. - **After a webhook.** [Webhook](/docs/api/webhooks) payloads are thin. Use the event as a trigger and read the current state here. Check the result on your server before you grant access: - `transaction.status` is `success`. - `transaction.amount` and `transaction.currency` match what you expected to charge. - `subscription.idAtBillingPlatform` is present. ## Path parameters [#path-parameters] The Altruon transaction ID: `transactionId` from the `onSuccess` callback, or `trx_id` from the redirect. The request has no body. ## Response [#response] The payment attempt. Altruon transaction ID. ID of the transaction at the acquirer. Direct link to the transaction in the acquirer dashboard. Kind of transaction, for example `initialPayment` or `recurringPayment`. Amount in minor units, as a string. `"500"` is 5.00 in `USD`. The number of decimals depends on the currency: 0 for `JPY`, 2 for `USD` and `EUR`, 3 for `KWD`. The same amount in major units, for example `"5.00"`. Computed from `amount` with the decimals of the currency. Use it for display. ISO 4217 currency code, for example `USD`, `EUR` or `BRL`. `success`, `failed` or `pending`. Name of the acquirer, for example `checkoutcom` or `stripe`. Error message if the transaction failed. `null` if it succeeded. The customer on the billing platform. Customer ID on the billing platform, for example a Stripe Billing customer ID. Direct link to the customer in the billing platform dashboard. Name of the billing platform, for example `stripe`, `chargebee` or `recurly`. The invoice this transaction pays. Invoice ID on the billing platform. Direct link to the invoice in the billing platform dashboard. Invoice amount in minor units, as a string. The number of decimals depends on the currency. The same amount in major units. Use it for display. ISO 4217 currency code. Name of the billing platform. The subscription on the billing platform. Subscription ID on the billing platform. Direct link to the subscription in the billing platform dashboard. ISO 8601 timestamp of the next billing date, for example `2025-10-31T15:11:19Z`. Name of the billing platform. ### Example response [#example-response] ```json { "transaction": { "id": "66a22937-a351-417e-81c1-9ac5164be9ab", "idAtGateway": "pay_wthwuqodnobedlulbexcjfylma", "urlAtGateway": "https://dashboard.sandbox.checkout.com/payments/all-payments/payment/pay_wthwuqodnobedlulbexcjfylma", "type": "initialPayment", "amount": "12300", "amountInMajorUnit": "123.00", "currency": "EUR", "status": "success", "gateway": "checkoutcom", "errorMessage": null }, "customer": { "idAtBillingPlatform": "cus_TM8zJeFCKE15oB", "urlAtBilling": "https://dashboard.stripe.com/customers/cus_TM8zJeFCKE15oB", "billingPlatform": "stripe" }, "invoice": { "idAtBillingPlatform": "in_1SPQhq4hYau76GhIbWx8zT8H", "urlAtBilling": "https://dashboard.stripe.com/invoices/in_1SPQhq4hYau76GhIbWx8zT8H", "amount": "12300", "amountInMajorUnit": "123.00", "currency": "EUR", "billingPlatform": "stripe" }, "subscription": { "idAtBillingPlatform": "sub_1SPQhq4hYau76GhIFvpT8HSx", "urlAtBilling": "https://dashboard.stripe.com/subscriptions/sub_1SPQhq4hYau76GhIFvpT8HSx", "nextBillingDate": "2025-12-03T16:34:10Z", "billingPlatform": "stripe" } } ``` ### What to store [#what-to-store] Keep the IDs and links so support and reconciliation can go from your records to the provider in one click. | Field | Use it to | |---|---| | `transaction.id`, `transaction.idAtGateway` | Track the payment in Altruon and at the acquirer | | `customer.idAtBillingPlatform` | Link the payment to the account in your system | | `subscription.idAtBillingPlatform`, `subscription.nextBillingDate` | Know which subscription is active and when it renews | | `invoice.idAtBillingPlatform` | Find the original invoice on the billing platform | | `urlAtGateway`, `urlAtBilling` | Open the transaction, customer, invoice or subscription in the provider dashboard | ## Errors [#errors] | Status | Meaning | What to do | |---|---|---| | `401` | The secret key is missing or invalid. | Check the `x-secret-key` header. | | `404` | No transaction with this ID. | Check the transaction ID. | A failed payment is not an API error: the transaction is returned with `status` set to `failed` and the reason in `errorMessage`. See [Errors](/docs/api/errors) for the error response shape. ## Code samples [#code-samples] ```bash curl "https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/{transactionId}/details" \ -H "x-secret-key: $ALTRUON_SECRET_KEY" ``` ```js const response = await fetch( `https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/${transactionId}/details`, { headers: { 'x-secret-key': process.env.ALTRUON_SECRET_KEY } }, ); if (!response.ok) throw new Error(`Altruon returned ${response.status}`); const details = await response.json(); const paid = details.transaction.status === 'success'; ``` ```python import os import requests url = "https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/" + transaction_id + "/details" response = requests.get( url, headers={"x-secret-key": os.environ["ALTRUON_SECRET_KEY"]}, ) response.raise_for_status() details = response.json() paid = details["transaction"]["status"] == "success" ``` ```ruby require 'httparty' response = HTTParty.get( "https://{your-domain}.api.sandbox.altruon.io/api/v1/transaction/#{transaction_id}/details", headers: { 'x-secret-key' => ENV['ALTRUON_SECRET_KEY'] } ) raise "Altruon returned #{response.code}" unless response.success? paid = response['transaction']['status'] == 'success' ``` ```php true, CURLOPT_HTTPHEADER => ['x-secret-key: ' . getenv('ALTRUON_SECRET_KEY')], ]); $details = json_decode(curl_exec($ch), true); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($status >= 400) { throw new Exception("Altruon returned {$status}"); } $paid = $details['transaction']['status'] === 'success'; ``` ## Related [#related] # Event types (/docs/api/webhooks/events) The `type` field of the [event payload](/docs/api/webhooks#event-payload) holds one of the values below. You choose which events an endpoint receives when you create it, and you can change the selection later on the **Events** tab of the endpoint. ## Subscription [#subscription] | Event | Sent when | |---|---| | `subscription.created` | A subscription is created, including trial signups | | `subscription.activated` | A subscription becomes active, for example at the end of a trial | | `subscription.paused` | A subscription is paused | | `subscription.resumed` | A paused subscription is resumed | | `subscription.cancelled` | A subscription is canceled | | `subscription.pre_debit_notification.sent` | A pre-debit notification was sent to the customer, for example for Pix Automático | ## Invoice [#invoice] | Event | Sent when | |---|---| | `invoice.created` | An invoice is generated by the billing platform | | `invoice.paid` | An invoice is fully paid | | `invoice.dunning_started` | Payment collection failed and retries (dunning) started | | `invoice.dunning_exhausted` | All dunning retries failed | | `invoice.refunded` | An invoice is refunded | ## Payment [#payment] | Event | Sent when | |---|---| | `payment.processing` | A payment is being processed by the acquirer | | `payment.succeeded` | A payment succeeded | | `payment.failed` | A payment failed | | `payment.retry_failed` | A retry of a recurring payment failed | | `payment.refunded` | A payment is refunded | ## Refund [#refund] | Event | Sent when | |---|---| | `refund.processing` | A refund is being processed | | `refund.succeeded` | A refund succeeded | | `refund.failed` | A refund failed | ## Customer [#customer] | Event | Sent when | |---|---| | `customer.created` | A customer is created | | `customer.updated` | A customer is updated | ## Checkout session [#checkout-session] | Event | Sent when | |---|---| | `checkout.session.completed` | A session completed successfully | | `checkout.session.expired` | A session expired without payment | ## System [#system] | Event | Sent when | |---|---| | `webhook.ping` | A test event is triggered from the backoffice | `webhook.ping` is sent by **Send test event** while you create an endpoint (unsigned) and by **Send Test** on the endpoint detail page (signed). Test events sent from the backoffice have `domain` set to `"test"`. ## Related [#related] # Webhooks (/docs/api/webhooks) Altruon webhooks notify your server when something happens on your account: a subscription is created, an invoice is paid, a payment fails, a session completes. Each webhook is an HTTPS `POST` with a JSON payload, signed with a secret that belongs to the endpoint. The webhooks you set up on your billing platform and your acquirers are events that Altruon receives. They are a different thing. See [The two webhook directions](/docs/concepts/webhooks). ## How it works [#how-it-works] 1. You register an endpoint, an HTTPS URL on your server, in the backoffice and choose which events it receives. 2. Altruon generates a signing secret for the endpoint. It is shown once. 3. When a subscribed event occurs, Altruon sends a signed JSON event to your URL. 4. Your server [verifies the signature](/docs/api/webhooks/signatures), responds with a `2xx` status and processes the event asynchronously. 5. Failed deliveries are retried with increasing delays. Every attempt is listed in the delivery log in the backoffice. Payloads are thin on purpose: they say what happened and to which resource. Fetch the current state from the API, for example with [Get transaction details](/docs/api/transactions/get-details), instead of relying on payload contents that may be stale by the time you process the event. ## Create an endpoint [#create-an-endpoint] You can have up to 2 active endpoints per site. Use the second one for a staging consumer or during a migration. ### Open the webhook settings [#open-the-webhook-settings] In the backoffice, go to **Settings > Webhooks** and click **Add endpoint**. ### Enter the endpoint details [#enter-the-endpoint-details] | Field | Required | Description | |---|---|---| | **Endpoint URL** | Yes | Your HTTPS URL, for example `https://api.example.com/webhooks/altruon`. Plain `http://`, credentials in the URL, and private or loopback addresses are rejected. | | **Description** | No | A label for your team, for example `Production billing sync`. | Click **Send test event** to check the URL before you save. Altruon sends an unsigned `webhook.ping` and expects a `2xx` response. It is unsigned because the endpoint has no secret yet. ### Select events [#select-events] Pick at least one event. Events are grouped by resource (`subscription`, `invoice`, `payment` and so on) and you can search them. See [Event types](/docs/api/webhooks/events) for the full list. ### Copy the signing secret [#copy-the-signing-secret] After you confirm, Altruon shows the signing secret of the endpoint. It starts with `whsec_`. Store it in your secret manager. Copy it now. Afterwards the backoffice only shows its last 4 characters. ## Event payload [#event-payload] Every event is delivered in the same JSON envelope. Unique event ID with the `evt_` prefix. Retries of the same event reuse the same ID, so use it to deduplicate. One of the [event types](/docs/api/webhooks/events), for example `payment.succeeded`. ISO 8601 timestamp of when the event occurred. Your tenant domain. `"test"` for test events sent from the backoffice. `true` for production events, `false` for sandbox and test events. What the event is about. The affected resource. One of `SUBSCRIPTION`, `PAYMENT`, `CUSTOMER`, `INVOICE`, `REFUND`, `ORDER`. Where the event came from. `gateway` in the example below. Reference to the resource at the provider. Name of the provider, for example `PAGBRASIL`. ID of the resource at the provider. UUID of the Altruon connection to that provider. A plain-text hint on how to fetch the resource. On update events, the fields that changed, with their previous values. `null` otherwise. `true` if the payload exceeded the 256 KB limit and was truncated. ```json { "id": "evt_7f3c2a1b-8d4e-4f6a-9b2c-1e5d7a8f9c0b", "type": "payment.succeeded", "created_at": "2026-07-14T13:07:00.000Z", "domain": "your-tenant.altruon.io", "livemode": false, "data": { "object": { "resourceType": "PAYMENT", "source": "gateway", "providerRef": { "provider": "PAGBRASIL", "resourceId": "ORD123456", "connectionId": "550e8400-e29b-41d4-a716-446655440000" }, "fetchHint": "Use providerRef.resourceId to query platform or Altruon" }, "previous_attributes": null, "truncated": false } } ``` ## Delivery and retries [#delivery-and-retries] | | | |---|---| | Method | `POST` with `Content-Type: application/json` | | User agent | `Altruon-Webhook/1.0` | | Signature | `Altruon-Signature` header. See [Verify signatures](/docs/api/webhooks/signatures). | | Timeout | 10 seconds. Respond within this window. | | Success | Any `2xx` response status | | Retries | Failed deliveries are retried with increasing delays, roughly 2 hours, 12 hours, then 24 hours after each failure. At most 4 attempts in total. | | Ordering | Deliveries to an endpoint are sent in order, but retries mean events can arrive out of order. | | Idempotency | Retries reuse the same event `id`. | **What is retried:** timeouts, connection errors, HTTP `5xx`, `429`, and a few transient `4xx` statuses such as `408` and `409`. Most other `4xx` responses, such as `400` and `401`, count as permanent failures and are not retried. **Automatic disabling:** Altruon disables an endpoint after 50 consecutive failures, or when its failure rate stays at 95% or more over 3 days. A disabled endpoint receives no deliveries until you enable it again in the backoffice. ## Manage and monitor endpoints [#manage-and-monitor-endpoints] The list under **Settings > Webhooks** shows for each endpoint its status (Active or Inactive), the number of subscribed events, the last delivery and the success rate, with aggregate analytics cards on top. You can enable or disable an endpoint from the list at any time. Click an endpoint to open its detail page: - **Deliveries**: every attempt with its event type, status, response code, duration and the full payload sent. You can resend a failed delivery manually. - **Events**: the events the endpoint is subscribed to. You can edit them at any time. - **Settings**: the URL, the description, the status and a preview of the signing secret (its last 4 characters). **Send Test** on the detail page sends a signed `webhook.ping`. Use it to check your signature verification end to end. ## Best practices [#best-practices] - **Verify every request.** Check the `Altruon-Signature` header and reject anything invalid with a `400`. - **Respond with a 2xx within 10 seconds.** Return `200` straight away and process the event on a queue or a worker. A slow handler hits the timeout and triggers a retry. - **Deduplicate on the event `id`.** You will occasionally receive the same event more than once. - **Treat events as triggers and fetch the state.** Read the current resource from the Altruon API instead of trusting the payload as a snapshot. - **Do not rely on ordering.** A retried `payment.succeeded` can arrive after a later `invoice.paid`. Compare `created_at`. - **Check `livemode`.** It keeps sandbox and production events from crossing environments. ## Next steps [#next-steps] # Verify signatures (/docs/api/webhooks/signatures) Altruon signs every webhook delivery with the signing secret of the endpoint, the `whsec_...` value shown once when you [create the endpoint](/docs/api/webhooks#create-an-endpoint). Verify the signature before you trust a payload. ## The Altruon-Signature header [#the-altruon-signature-header] ```http Altruon-Signature: t=1752498420,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd ``` Unix timestamp, in seconds, of when the delivery was signed. Hex-encoded HMAC-SHA256 of the string `{t}.{raw request body}`, keyed with the signing secret of the endpoint. While a secret rotation overlaps, the header can contain two `v1` entries. The signature is valid if any of them matches. ## Verify a delivery [#verify-a-delivery] 1. Parse `t` and every `v1` value from the header. 2. Reject the request if `t` is more than 5 minutes (300 seconds) away from the current time. This protects against replays. 3. Compute `HMAC-SHA256(secret, "{t}." + rawBody)` over the raw request body, before any JSON parsing. 4. Compare your hex digest with each `v1` value, using a constant-time comparison. 5. If none matches, respond with `400` and stop. If one matches, respond with a `2xx` and process the event. ## Code samples [#code-samples] ```js title="server.js" const crypto = require('crypto'); const express = require('express'); const app = express(); const TOLERANCE_SECONDS = 300; function verifyAltruonSignature(rawBody, signatureHeader, secret) { const elements = (signatureHeader || '').split(','); const timestamp = elements.find((e) => e.startsWith('t='))?.slice(2); const signatures = elements.filter((e) => e.startsWith('v1=')).map((e) => e.slice(3)); if (!timestamp || signatures.length === 0) return false; if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) return false; const expected = crypto .createHmac('sha256', secret) .update(`${timestamp}.${rawBody}`) .digest('hex'); return signatures.some((sig) => { try { return crypto.timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(sig, 'hex')); } catch { return false; } }); } // express.raw keeps the body as received. Do not use express.json on this route. app.post('/webhooks/altruon', express.raw({ type: 'application/json' }), (req, res) => { // [!code highlight] const rawBody = req.body.toString('utf8'); const valid = verifyAltruonSignature( rawBody, req.headers['altruon-signature'], process.env.ALTRUON_WEBHOOK_SECRET, ); if (!valid) return res.status(400).send('Invalid signature'); const event = JSON.parse(rawBody); // Queue the event for processing. Deduplicate on event.id. res.sendStatus(200); }); ``` ```python title="webhooks.py" import hashlib import hmac import time TOLERANCE_SECONDS = 300 def verify_altruon_signature(raw_body: bytes, signature_header: str, secret: str) -> bool: elements = (signature_header or "").split(",") timestamp = next((e[2:] for e in elements if e.startswith("t=")), None) signatures = [e[3:] for e in elements if e.startswith("v1=")] if not timestamp or not signatures: return False if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS: return False signed_payload = f"{timestamp}.".encode() + raw_body expected = hmac.new(secret.encode(), signed_payload, hashlib.sha256).hexdigest() return any(hmac.compare_digest(expected, sig) for sig in signatures) ``` Pass the request body as bytes, exactly as received, and the value of the `Altruon-Signature` header. ## Test your verification [#test-your-verification] Open the endpoint under **Settings > Webhooks** and click **Send Test**. Altruon sends a signed `webhook.ping`, so you can check your code end to end. The test ping sent by **Send test event** while you create an endpoint is unsigned, because the endpoint has no secret yet. Do not use it to test verification. ## Common mistakes [#common-mistakes] | Mistake | What happens | Fix | |---|---|---| | Hashing the parsed JSON instead of the raw body | Parsing and serialising again changes the bytes, so the digest never matches | Read the raw request body and verify before you parse it | | Using the secret of another endpoint | Each endpoint has its own `whsec_...` secret | Use the secret of the endpoint that receives the delivery | | Checking only the first `v1` value | Deliveries fail during a secret rotation | Accept the delivery if any `v1` matches | | Skipping the timestamp check | An old delivery can be replayed | Reject when `t` is more than 5 minutes from the current time | | Comparing digests with `==` | The comparison leaks timing information | Use a constant-time comparison such as `crypto.timingSafeEqual` or `hmac.compare_digest` | | Verifying the unsigned test ping from the create flow | It has no valid signature | Test with **Send Test** on the endpoint detail page | ## Related [#related] # Changelog (/docs/changelog) Changes to the Altruon platform that affect an integration, and to these docs. Dates are when the documentation was published. ## December 2026 [#december-2026] ### Analytics dashboard [#analytics-dashboard] Docs [Analytics](/docs/manage/analytics) now shows the backoffice home dashboard, card by card: payment metrics, the new subscription metrics (MRR, ARR, active subscriptions, due invoices and active vaulted cards), the charts and their drill-downs, integration health and recent activity. ### Audit trail [#audit-trail] Docs New page: [Audit trail](/docs/manage/audit-trail) explains the **Audit Logs** screen for admins: what is recorded, how to filter the list, how to read one event and its before and after diff, and what is never shown. ### Dynamic routing [#dynamic-routing] Docs [Routing](/docs/optimize/routing) now covers Dynamic routing under **Settings > Dynamic routing**, for accounts with the Altruon Vault: separate rules for subscription checkouts, one-time checkouts and renewals, splits, cascades to another acquirer, renewal retry, testing and publishing. The acquirer guides for Adyen, Stripe and Checkout.com now mention the **Raw card data** switch. ### Turning on the Altruon Vault and migrating cards [#turning-on-the-altruon-vault-and-migrating-cards] Docs [Altruon Vault](/docs/protect/vault) now explains how to turn the vault on, which features need it first, and how cards held by any acquirer, orchestrator or vault provider are migrated. Network tokens, account updater, 3D Secure run by Altruon, routing rules and second-acquirer retry now each say that the Altruon Vault must be turned on first. ### 3D Secure on the Altruon Vault [#3d-secure-on-the-altruon-vault] Docs [3D Secure](/docs/protect/3d-secure) now shows the difference between a challenge the acquirer runs and one Altruon runs before passing the result to the acquirer, and how to configure it under **Settings > Vault**. ### Network tokens and account updater [#network-tokens-and-account-updater] Docs [Network tokens](/docs/optimize/network-tokens) and [Account updater](/docs/optimize/account-updater) now explain what each one does, and how to turn it on under **Settings > Vault**. ### Support address [#support-address] Docs Sandbox access, onboarding and live support now go to [support@altruon.io](mailto:support@altruon.io). ### Raw card data with the Altruon Vault [#raw-card-data-with-the-altruon-vault] Docs Each card acquirer guide now says that the API credentials must be allowed to send raw card data when you use the [Altruon Vault](/docs/protect/vault). If you are not sure, confirm with your point of contact at the acquirer. ### Altruon Billing [#altruon-billing] New Altruon Billing is a billing platform that Altruon sets up and runs for you. Build your product catalog and coupons, and manage subscriptions, invoices and credit notes, in the Altruon backoffice. See [Altruon Billing](/docs/subscriptions/altruon-billing). ### SKILL.md refreshed [#skillmd-refreshed] Docs [`SKILL.md`](https://docs.altruon.io/SKILL.md) now covers Altruon Billing, the error codes, Altruon.js methods and callbacks, acquirers and payment methods, routing, retries and dunning, and the Altruon Vault. Its links point at the new pages. See [Build with AI](/docs/get-started/build-with-ai). ### New documentation site [#new-documentation-site] Docs - The docs are reorganized into five tabs: Guides, Connections, API reference, Altruon.js reference and Changelog. - New pages: [How Altruon works](/docs/get-started/how-altruon-works), [Sessions](/docs/concepts/sessions), [Payment lifecycle](/docs/concepts/payment-lifecycle), [Webhooks](/docs/concepts/webhooks), [Choose your checkout](/docs/checkout), [How billing sync works](/docs/subscriptions), [Go-live checklist](/docs/get-started/go-live), [Testing](/docs/resources/testing) and [Troubleshooting](/docs/resources/troubleshooting). - The Altruon.js pages are split into task guides and a lookup reference. - The webhook guide is split into setup, [event types](/docs/api/webhooks/events) and [signature verification](/docs/api/webhooks/signatures). - Old URLs redirect to their new location. ## November 2026 [#november-2026] ### Chargebee customer custom fields on dynamic hosted checkout [#chargebee-customer-custom-fields-on-dynamic-hosted-checkout] Checkout [Dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout) documents how to pass Chargebee customer custom fields when you create the session. ### Stripe as an acquirer [#stripe-as-an-acquirer] Connections [Stripe](/docs/connections/acquirers/stripe) can be connected as an acquirer for card payments. Its webhook is separate from the [Stripe Billing](/docs/connections/billing-platforms/stripe-billing) webhook. ## August 2026 [#august-2026] ### Adyen allowed origins [#adyen-allowed-origins] Connections The [Adyen guide](/docs/connections/acquirers/adyen) documents the tenant-specific allowed origin URLs. ## July 2026 [#july-2026] ### Altruon webhooks [#altruon-webhooks] New Altruon sends signed events to your server for subscriptions, invoices, payments, refunds, customers and checkout sessions. See [Webhooks](/docs/api/webhooks). ### Subscription trials [#subscription-trials] New Trials with nothing due today work across all four billing platforms. Override the trial length per checkout with `billingData.forceTrialPeriodDays`. See [Trials](/docs/subscriptions/trials). ### PagBrasil cards [#pagbrasil-cards] Connections [PagBrasil](/docs/connections/acquirers/pagbrasil) supports credit cards. Debit cards are not supported for now. ## June 2026 [#june-2026] ### Dynamic hosted checkout [#dynamic-hosted-checkout] New Create a session from your server with `hostedCheckout: true` and send the shopper to an Altruon-hosted page with the cart and the customer pre-filled. See [Dynamic hosted checkout](/docs/checkout/dynamic-hosted-checkout). ### Session and transaction API additions [#session-and-transaction-api-additions] API - [Create a session](/docs/api/sessions/create) returns `payment_method_pinned_at_create`. - [Get transaction details](/docs/api/transactions/get-details) returns `amountInMajorUnit` on transactions and invoices. ### Hosted pages and the merchant demo [#hosted-pages-and-the-merchant-demo] Checkout The get started guides were rewritten around [hosted pages](/docs/checkout/hosted-pages), and the Altruon.js guides were aligned with the open-source [merchant demo](https://github.com/Altruon-io/merchant-demo). ### Altruon.js CDN [#altruonjs-cdn] Altruon.js Altruon.js is served from `cdn.altruon.io` for both environments. References to `cdn.sandbox.altruon.io` were removed. ## April 2026 [#april-2026] ### Coupons [#coupons] New Pass coupon codes when you create a session, or let shoppers apply them at checkout. See [Coupons](/docs/subscriptions/coupons). ### Frisbii [#frisbii] Connections [Frisbii](/docs/connections/billing-platforms/frisbii) is available as a billing platform. ### New and updated acquirers [#new-and-updated-acquirers] Connections - [Nuvei](/docs/connections/acquirers/nuvei) and [Trustly](/docs/connections/acquirers/trustly) guides added. - [Checkout.com](/docs/connections/acquirers/checkout-com): Apple Pay and KakaoPay. - [dLocal](/docs/connections/acquirers/dlocal): cards. - [PagBrasil](/docs/connections/acquirers/pagbrasil): cards and OAuth credentials. ### SKILL.md for AI agents [#skillmd-for-ai-agents] Docs A guide written for AI coding assistants. See [Build with AI](/docs/get-started/build-with-ai). ## February 2026 [#february-2026] ### Line items in Create Session [#line-items-in-create-session] API [Create a session](/docs/api/sessions/create) takes the cart as `billingData.lineItems`. ### Altruon.js callbacks [#altruonjs-callbacks] Altruon.js The documented `onActionRequired` payloads were corrected to match the API. See [Callbacks](/docs/sdk/callbacks). ## November 2025 [#november-2025] ### First release of the docs [#first-release-of-the-docs] Docs Guides for Stripe Billing, Recurly, Checkout.com and Adyen, the Altruon.js developer guides, and the transaction details endpoint. # Adyen (/docs/connections/acquirers/adyen) Connect your Adyen account to take credit and debit card payments through Altruon, on your own Adyen contract. Cards (credit and debit) API key, client key and merchant account Manual. You create a standard webhook in Adyen with the `AUTHORISATION` and `CHARGEBACK` events. Cards. See [Trials](/docs/subscriptions/trials). Add your Altruon domain to the allowed origins of the client key. The URL differs between sandbox and production. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Your own account and contract, with access to **Developers > API Credentials** and **Developers > Webhooks**. With the [Altruon Vault](/docs/protect/vault), Altruon sends the card number in the request to Adyen. The API credentials you connect must be allowed to send raw card data. If you are not sure, confirm with your point of contact at Adyen. Once Adyen has confirmed it, turn on **Raw card data** on the connection, so [Dynamic routing](/docs/optimize/routing#dynamic-routing) can send cards there. You need it for the allowed origin, for example `acme` in `https://www.acme.sandbox.altruon.io`. ### Get your Adyen credentials [#get-your-adyen-credentials] Use the Adyen backoffice of the environment you are connecting: [test](https://ca-test.adyen.com) or [live](https://ca-live.adyen.com). Adyen shows the API key only until you save the credential. Copy it and paste it somewhere safe before you click **Save changes**. 1. Go to **Developers > API Credentials**. 2. Choose the webservice user you prefer, or create a new one for Altruon. 3. In **Server settings**, copy the **API key**. 4. In **Client settings**, under **Authentication**, copy the **Client key**. 5. In **Add allowed origins**, add your Altruon domain. Replace `{your-domain}` with your Altruon domain, for example `acme`. | Environment | Allowed origin | |---|---| | Sandbox | `https://www.{your-domain}.sandbox.altruon.io` | | Production | `https://www.{your-domain}.altruon.io` | 6. Click **Save changes**. ### Connect Adyen in Altruon [#connect-adyen-in-altruon] 1. Sign in to Altruon and go to **Settings > Payment Gateways**. 2. Click **+ Add Integration** and select **Adyen**. 3. Enter your API key, your client key and your Adyen merchant account. 4. Click **Add Integration**. If the connection succeeds, the Adyen integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Altruon needs a webhook from Adyen to stay in sync with payment events. 1. In Altruon, go to **Settings > Payment Gateways** and click **View Integration** on Adyen. 2. Copy the **Webhook Endpoint** URL. 3. In the Adyen backoffice, go to **Developers > Webhooks**. 4. Click **Create new webhook** and choose **Standard webhook**. 5. Fill in the configuration: | Field | Value | |---|---| | Name | `Altruon endpoint` | | Description | `Altruon endpoint` | | URL | The webhook endpoint URL you copied from Altruon | | Events | Select only `AUTHORISATION` and `CHARGEBACK` | 6. Click **Save configuration**. ### Add a routing entry [#add-a-routing-entry] A routing entry sends one payment method in one currency to Adyen. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select **Card** as the **Payment Method**, the **Currency**, and Adyen as the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for each currency you process with Adyen. ## Test the connection [#test-the-connection] 1. Open **Settings > Payment Gateways**. Adyen is listed as **Active**. 2. With a billing platform connected, take a card payment in sandbox. See [Testing](/docs/resources/testing). 3. Check the result: the transaction is recorded in Altruon with the Adyen transaction ID, the subscription exists on your billing platform, and its invoice is marked paid. ## Notes and limits [#notes-and-limits] - **Cards only.** Adyen processes credit and debit cards, collected with the Altruon.js card component. - **Allowed origins are per environment.** The sandbox and production origins are different URLs, and both contain your own Altruon domain. - **Test and live are separate.** Credentials from `ca-test.adyen.com` belong in the Altruon sandbox, credentials from `ca-live.adyen.com` in production. - **Trials.** A card trial saves the card with a zero-amount setup and charges it when the trial ends. ## Next steps [#next-steps] # Checkout.com (/docs/connections/acquirers/checkout-com) Connect your Checkout.com account to take card, Apple Pay and KakaoPay payments through Altruon, on your own Checkout.com contract. Cards (credit and debit), Apple Pay, KakaoPay (KRW) Public key, secret key and processing channel ID Manual. You create a webhook configuration in Checkout.com with five payment events and three dispute events. Cards, Apple Pay and KakaoPay. See [Trials](/docs/subscriptions/trials). Apple Pay must be enabled on your Checkout.com account. KakaoPay is for payments in KRW. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Your own account and contract, with access to **Developers > Keys** and **Developers > Webhooks**. With the [Altruon Vault](/docs/protect/vault), Altruon sends the card number in the request to Checkout.com. The API credentials you connect must be allowed to send raw card data. If you are not sure, confirm with your point of contact at Checkout.com. Once Checkout.com has confirmed it, turn on **Raw card data** on the connection, so [Dynamic routing](/docs/optimize/routing#dynamic-routing) can send cards there. Apple Pay is available once your Checkout.com account has it enabled. ### Get your Checkout.com credentials [#get-your-checkoutcom-credentials] Use the Checkout.com dashboard of the environment you are connecting: [sandbox](https://dashboard.sandbox.checkout.com) or [production](https://dashboard.checkout.com). 1. Go to **Developers > Keys**. The public key and the secret key are listed there. 2. Click the **Secret** key or the **Public** key to see its details. The processing channel ID is under **Selected processing channels**. ### Connect Checkout.com in Altruon [#connect-checkoutcom-in-altruon] 1. Sign in to Altruon and go to **Settings > Payment Gateways**. 2. Click **+ Add Integration** and select **Checkout.com**. 3. Enter your public key, your secret key and your processing channel ID. 4. Click **Add Integration**. If the connection succeeds, the Checkout.com integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Altruon needs a webhook from Checkout.com to stay in sync with payment events. 1. In Altruon, go to **Settings > Payment Gateways** and click **View Integration** on Checkout.com. 2. Copy the **Webhook Endpoint** URL. 3. In the Checkout.com dashboard, go to **Developers > Webhooks**. 4. Click **Create configuration**. 5. Fill in the configuration: | Field | Value | |---|---| | Name | `Altruon webhooks` | | Endpoint URL | The webhook endpoint URL you copied from Altruon | | Events, **Gateway** section | `Payment approved`, `Payment paid`, `Payment declined`, `Payment captured`, `Payment pending` | | Events, **Disputes** section | `Dispute initiated`, `Dispute won`, `Dispute lost` | | Entities and processing channels | The entity you want Altruon to manage, or all of them | 6. Click **Create webhook**. ### Add a routing entry [#add-a-routing-entry] A routing entry sends one payment method in one currency to Checkout.com. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select the **Payment Method** (card, Apple Pay or KakaoPay), the **Currency**, and Checkout.com as the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for each method and currency you process with Checkout.com. KakaoPay needs an entry in KRW. ## Test the connection [#test-the-connection] 1. Open **Settings > Payment Gateways**. Checkout.com is listed as **Active**. 2. With a billing platform connected, take a payment in sandbox with a method you routed. See [Testing](/docs/resources/testing). 3. Check the result: the transaction is recorded in Altruon with the Checkout.com transaction ID, the subscription exists on your billing platform, and its invoice is marked paid. ## Notes and limits [#notes-and-limits] - **Apple Pay.** Available through Checkout.com once your Checkout.com account has Apple Pay enabled. - **KakaoPay.** Supported for payments in KRW. - **Sandbox and production are separate.** Keys from `dashboard.sandbox.checkout.com` belong in the Altruon sandbox, keys from `dashboard.checkout.com` in production. - **Trials.** Cards, Apple Pay and KakaoPay all support trials. The payment method is saved with a zero-amount setup and charged when the trial ends. ## Next steps [#next-steps] # dLocal (/docs/connections/acquirers/dlocal) Connect your dLocal account to take card payments, UPI in India and Pix Automático in Brazil through Altruon, on your own dLocal contract. Cards (credit and debit), UPI (India), Pix Automático (Brazil) `XLogin`, `XTransKey`, `SecretKey` and `SmartfieldApiKey` No webhook step in this setup. Cards, Pix and UPI. See [Trials](/docs/subscriptions/trials). dLocal has separate sandbox and production credentials. Use the set that matches the Altruon environment. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Your own account and contract, with access to **Settings > Integration** in the dLocal backoffice. With the [Altruon Vault](/docs/protect/vault), Altruon sends the card number in the request to dLocal. The API credentials you connect must be allowed to send raw card data. This applies to card payments. If you are not sure, confirm with your point of contact at dLocal. dLocal has one set of credentials for each. Decide which Altruon environment you are connecting. ### Get your dLocal credentials [#get-your-dlocal-credentials] 1. In the dLocal backoffice, go to **Settings > Integration**. 2. Open **Sandbox credentials** or **Production credentials**, depending on the environment you are connecting. 3. Copy the four values. | In dLocal | In Altruon | |---|---| | `x_login` | **XLogin** | | `x_trans_key` | **XTransKey** | | Secret key | **SecretKey** | | Smartfields API Key | **SmartfieldApiKey** | ### Connect dLocal in Altruon [#connect-dlocal-in-altruon] 1. Sign in to Altruon and go to **Settings > Payment Gateways**. 2. Click **+ Add Integration** and select **dLocal**. 3. Enter **XLogin**, **XTransKey**, **SecretKey** and **SmartfieldApiKey**. 4. Click **Add Integration**. If the connection succeeds, you see a confirmation message. ### Add a routing entry [#add-a-routing-entry] A routing entry sends one payment method in one currency to dLocal. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select the **Payment Method** (card, UPI or Pix Automático), the **Currency**, and dLocal as the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for each method and currency you process with dLocal. ## Test the connection [#test-the-connection] 1. Open **Settings > Payment Gateways**. dLocal is listed as **Active**. 2. With a billing platform connected, take a payment in sandbox with a method you routed. See [Testing](/docs/resources/testing). 3. Check the result: the transaction is recorded in Altruon with the dLocal transaction ID, the subscription exists on your billing platform, and its invoice is marked paid. ## Notes and limits [#notes-and-limits] - **UPI.** For India. Recurring UPI mandates are supported. - **Pix Automático.** For Brazil. The routing table lists it as `pix`, and UPI as `upi`. - **Pre-debit notices.** A pre-debit notice is sent before each Pix Automático and UPI debit. - **Trials.** A card trial saves the card with a zero-amount setup. A Pix or UPI trial collects the shopper's consent. Nothing is charged until the trial ends. - **Webhook.** This setup has no webhook step in the dLocal backoffice. ## Next steps [#next-steps] # Acquirers (/docs/connections/acquirers) You bring your own acquirer account and your own contract. Altruon connects to it with your credentials and sends each payment to the acquirer your routing table names. Altruon never holds or settles funds: your acquirer settles to you. Your billing platform stays the source of truth for subscriptions and invoices. The acquirer only moves the money. With the [Altruon Vault](/docs/protect/vault), Altruon sends the card number in the request to the acquirer. The API credentials you connect for a card acquirer must be allowed to send raw card data. If you are not sure, confirm with your point of contact at that acquirer. ## Compare acquirers [#compare-acquirers] | Acquirer | Payment methods | Currencies and markets | Webhook setup | Trials | |---|---|---|---|---| | [Adyen](/docs/connections/acquirers/adyen) | Cards (credit and debit) | The currencies your account supports | Manual: a standard webhook with 2 events | Cards | | [Checkout.com](/docs/connections/acquirers/checkout-com) | Cards (credit and debit), Apple Pay, KakaoPay | KakaoPay in KRW | Manual: a webhook configuration with 8 events | Cards, Apple Pay, KakaoPay | | [dLocal](/docs/connections/acquirers/dlocal) | Cards (credit and debit), UPI, Pix Automático | UPI in India, Pix Automático in Brazil | No webhook step in the setup | Cards, Pix, UPI | | [Nuvei](/docs/connections/acquirers/nuvei) | Cards (credit and debit) | The currencies your account supports | Manual: a DMN URL. By your Nuvei contact if you already have a primary DMN endpoint | Cards | | [PagBrasil](/docs/connections/acquirers/pagbrasil) | Pix Automático, credit cards | Brazil | Manual: the IPN URL field | Credit cards, Pix | | [Stripe](/docs/connections/acquirers/stripe) | Cards (credit and debit) | The currencies your account supports | Manual: an event destination with 18 events | Not in the supported trial pairs | | [Trustly](/docs/connections/acquirers/trustly) | SEPA Direct Debit, Bacs, Autogiro | EUR, GBP, SEK | Automatic: sent with each transaction request | Direct debit, with a mandate | The **Trials** column lists the methods that can start a trial with nothing due today on that acquirer. Any other pair returns an unsupported error when the session is created. See [Trials](/docs/subscriptions/trials). New acquirers are connected on request. ## Route a method and a currency to an acquirer [#route-a-method-and-a-currency-to-an-acquirer] A connected acquirer takes no payments until a routing entry points to it. A routing entry maps one payment method and one currency to one acquirer. Checkout then offers that method for sessions in that currency, and Altruon sends the payment to that acquirer. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select the **Payment Method**, the **Currency** and the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for every method and currency you sell in. If a payment method does not show in checkout, check first that a routing entry exists for that method and that currency. Before you add an entry, make sure that your acquirer account can process the method in that currency, to avoid failed transactions. Check with your acquirer if you are unsure. With the Altruon Vault, [Dynamic routing](/docs/optimize/routing#dynamic-routing) goes further for card payments: rules on the card, the amount, the currency and the customer, percentage splits, and cascades of a declined card to another acquirer. Today it can send cards to Adyen, Stripe and Checkout.com, once **Raw card data** is turned on for the connection. ## Webhooks from the acquirer [#webhooks-from-the-acquirer] Altruon learns the final result of a payment from the acquirer's webhook: an authorization that completes later, a refund, a dispute. Each guide says how the webhook is set up for that acquirer. | Setup | What you do | Acquirers | |---|---|---| | Manual | Copy the URL under **View Integration** in Altruon and add it in the acquirer's dashboard with the listed events. | Adyen, Checkout.com, Nuvei, PagBrasil, Stripe | | Automatic | Nothing. Altruon sends the endpoint with each transaction request. | Trustly | | By your acquirer contact | Share the Altruon endpoint with your contact, who adds it next to your existing endpoint. | Nuvei, when you already use a primary DMN endpoint | The dLocal setup has no webhook step. ## Next steps [#next-steps] # Nuvei (/docs/connections/acquirers/nuvei) Connect your Nuvei account to take credit and debit card payments through Altruon, on your own Nuvei contract. Cards (credit and debit) `merchant_id`, `merchant_site_id` and `secret_key` Manual. Altruon gives you a DMN endpoint that you set in Nuvei. If you already use a primary DMN endpoint, your Nuvei contact adds it as a secondary one. Cards. See [Trials](/docs/subscriptions/trials). Nuvei is enabled for card payments only. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Your own account and contract, with access to the Nuvei backoffice: [sandbox](https://sandbox.nuvei.com/login) or [production](https://cpanel.nuvei.com/). With the [Altruon Vault](/docs/protect/vault), Altruon sends the card number in the request to Nuvei. The API credentials you connect must be allowed to send raw card data. If you are not sure, confirm with your point of contact at Nuvei. Confirm that your Nuvei account is enabled for DMN (notification) callbacks. ### Get your Nuvei credentials [#get-your-nuvei-credentials] You get the three credentials from your Nuvei account, from your Nuvei point of contact, or both, depending on how your account is set up. | Credential | In Nuvei | In Altruon | |---|---|---| | `merchant_id` | Merchant ID | **MerchantId** | | `merchant_site_id` | Site ID | **MerchantSiteId** | | `secret_key` | Secret Key | **SecretKey** | ### Connect Nuvei in Altruon [#connect-nuvei-in-altruon] 1. Sign in to Altruon and go to **Settings > Payment Gateways**. 2. Click **+ Add Integration** and select **Nuvei**. 3. Enter your `merchant_id`, `merchant_site_id` and `secret_key`. 4. Click **Add Integration**. If the connection succeeds, the Nuvei integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Nuvei sends payment notifications as DMNs. Altruon provides a dedicated DMN endpoint for your Nuvei integration, which you copy from Altruon and configure in Nuvei. 1. In Altruon, go to **Settings > Payment Gateways**, click **View Integration** on Nuvei and copy the **Webhook Endpoint** URL. 2. In Nuvei, set that URL as the **DMN URL** in **DMN Settings**. Share the Altruon DMN endpoint with your Nuvei technical contact, so that they add it as a **secondary DMN endpoint**. ### Add a routing entry [#add-a-routing-entry] A routing entry sends card payments in one currency to Nuvei. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select `Card` as the **Payment Method**, the **Currency**, and `Nuvei` as the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for each currency you want to process with Nuvei. ## Test the connection [#test-the-connection] 1. Open **Settings > Payment Gateways**. Nuvei is listed as **Active**. 2. With a billing platform connected, take a card payment in sandbox. See [Testing](/docs/resources/testing). 3. Check that the status changes of the payment are reflected in Altruon. That confirms the DMN endpoint works. 4. Check the result: the transaction is recorded in Altruon with the Nuvei transaction ID, the subscription exists on your billing platform, and its invoice is marked paid. ## Notes and limits [#notes-and-limits] - **Cards only.** Nuvei is currently enabled for card payments only in Altruon. - **Secondary DMN endpoint.** A Nuvei account that already has a primary DMN endpoint keeps it. Your Nuvei technical contact adds the Altruon endpoint as a secondary one. - **Sandbox and production are separate.** Credentials from `sandbox.nuvei.com` belong in the Altruon sandbox, credentials from `cpanel.nuvei.com` in production. - **Trials.** A card trial saves the card with a zero-amount setup and charges it when the trial ends. - **Nuvei documentation.** See [docs.nuvei.com](https://docs.nuvei.com/). ## Next steps [#next-steps] # PagBrasil (/docs/connections/acquirers/pagbrasil) Connect your PagBrasil account to take Pix Automático and credit card payments in Brazil through Altruon, on your own PagBrasil contract. Pix Automático and credit cards, in Brazil Secret phrase, token, OAuth client ID and OAuth client secret Manual. You paste the Altruon webhook URL into the **IPN URL** field in PagBrasil. Credit cards and Pix. See [Trials](/docs/subscriptions/trials). Your PagBrasil point of contact provides the OAuth client ID and secret. PagBrasil enforces the OAuth flow, so both are required. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Your own account and contract, with access to **Account > Settings** in the PagBrasil backoffice. With the [Altruon Vault](/docs/protect/vault), Altruon sends the card number in the request to PagBrasil. The API credentials you connect must be allowed to send raw card data. This applies to credit card payments. If you are not sure, confirm with your point of contact at PagBrasil. Ask your PagBrasil point of contact for the `OauthClientId` and the `OauthClientSecret`. ### Get your PagBrasil credentials [#get-your-pagbrasil-credentials] You need four values, from two places. | Credential | Where you get it | |---|---| | `Secret` (the secret phrase) | PagBrasil backoffice, **Account > Settings** | | `Token` | PagBrasil backoffice, **Account > Settings** | | `OauthClientId` | Your PagBrasil point of contact | | `OauthClientSecret` | Your PagBrasil point of contact | PagBrasil enforces an OAuth flow, so the two OAuth values are required. ### Connect PagBrasil in Altruon [#connect-pagbrasil-in-altruon] 1. Sign in to Altruon and go to **Settings > Payment Gateways**. 2. Click **+ Add Integration** and select **PagBrasil**. 3. Enter **Secret** (the secret phrase), **Token**, **OauthClientId** and **OauthClientSecret**. 4. Click **Add Integration**. If the connection succeeds, the PagBrasil integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Altruon needs a webhook from PagBrasil to receive payment updates. PagBrasil calls it an IPN. 1. In Altruon, go to **Settings > Payment Gateways** and click **View Integration** on PagBrasil. 2. Copy the **Webhook Endpoint** URL. 3. In the PagBrasil backoffice, go to **Account > Settings**. 4. Paste the URL into the **IPN URL** field. 5. Click **Update**. ### Add a routing entry [#add-a-routing-entry] A routing entry sends one payment method in one currency to PagBrasil. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select the **Payment Method** (card or Pix), the **Currency**, and PagBrasil as the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for each method you process with PagBrasil. ## Test the connection [#test-the-connection] 1. Open **Settings > Payment Gateways**. PagBrasil is listed as **Active**. 2. With a billing platform connected, take a payment in sandbox with a method you routed. See [Testing](/docs/resources/testing). 3. Check the result: the transaction is recorded in Altruon with the PagBrasil transaction ID, the subscription exists on your billing platform, and its invoice is marked paid. ## Notes and limits [#notes-and-limits] - **Brazil only.** PagBrasil processes Pix Automático and credit cards in Brazil. - **Credit cards.** The card connection covers credit cards. - **Pix trials are consent only.** In a trial, the shopper gives the Pix consent at checkout and nothing is charged that day. The first debit is scheduled from the end of the trial. - **Card trials.** A card trial saves the card with a zero-amount setup and charges it when the trial ends. - **Pre-debit notices and retries.** A pre-debit notice is sent before each Pix Automático debit. Pix retries follow a fixed schedule: see [Retries and dunning](/docs/optimize/retries-and-dunning). ## Next steps [#next-steps] # Stripe (/docs/connections/acquirers/stripe) Connect your Stripe account as an acquirer to take credit and debit card payments through Altruon, while your billing platform stays the source of truth for subscriptions and invoices. This connection is separate from [Stripe Billing](/docs/connections/billing-platforms/stripe-billing). Use this page when Stripe should charge the card. Use Stripe Billing when Stripe should own the subscription and the invoice. Cards (credit and debit) One secret key (`sk_...`) or restricted key (`rk_...`) Manual. You add an event destination in Stripe with 18 payment, setup, refund and dispute events. Stripe is not in the list of supported trial pairs. See [Trials](/docs/subscriptions/trials). Card payments only. The webhook and the key must be in the same Stripe mode. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Your own account, with access to **Developers > API keys** and **Developers > Webhooks** in the Stripe Dashboard. With the [Altruon Vault](/docs/protect/vault), Altruon sends the card number in the request to Stripe. The API credentials you connect must be allowed to send raw card data. If you are not sure, confirm with your point of contact at Stripe. Once Stripe has confirmed it, turn on **Raw card data** on the connection, so [Dynamic routing](/docs/optimize/routing#dynamic-routing) can send cards there. If you use a restricted key, it must read and write **Customers**, **PaymentIntents**, **SetupIntents** and **Refunds**. ### Get your Stripe secret key [#get-your-stripe-secret-key] 1. Open the API keys page of the Stripe Dashboard: [sandbox API keys](https://dashboard.stripe.com/test/apikeys) or [live API keys](https://dashboard.stripe.com/apikeys). In the Dashboard, the page is under **Developers > API keys**. 2. Copy the **Secret key**. The key must start with `sk_` or `rk_`. | Key | Looks like | Requirement | |---|---|---| | Secret key | `sk_test_...` in a sandbox, `sk_live_...` in live mode | None | | Restricted key | `rk_test_...` or `rk_live_...` | Must be allowed to read and write **Customers**, **PaymentIntents**, **SetupIntents** and **Refunds** | Use a test key with the sandbox Dashboard, and a live key with the live Dashboard. The webhook you create later has to be in the same mode as the key. Stripe shows a secret key in full only when it is created. Copy it before you leave the page. ### Connect Stripe in Altruon [#connect-stripe-in-altruon] 1. Sign in to Altruon and go to **Settings > Payment Gateways**. 2. Click **+ Add Integration** and select **Stripe**. 3. Enter your secret key. 4. Click **Add Integration**. Altruon checks the key by listing one PaymentIntent. If the connection succeeds, the Stripe integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Altruon needs a webhook from Stripe so that card payments, saved cards and refunds stay in sync. This is not the Stripe Billing webhook: billing events and payment events go to different Altruon endpoints. 1. In Altruon, go to **Settings > Payment Gateways** and click **View Integration** on Stripe. 2. Copy the **Webhook Endpoint** URL. Paste the URL from Altruon, do not build it yourself. It looks like this: | Environment | Webhook URL | |---|---| | Sandbox | `https://{your-domain}.webhook.sandbox.altruon.io/webhooks/gateways/stripe/{connectionId}` | | Production | `https://{your-domain}.webhook.altruon.io/webhooks/gateways/stripe/{connectionId}` | 3. Sign in to the [Stripe Dashboard](https://dashboard.stripe.com) in the same mode as the secret key. 4. Go to **Developers > Webhooks**. 5. Click **+ Add destination**. 6. Under **Events from**, choose **Your account**. 7. Select these events: | Group | Events | |---|---| | Payments | `payment_intent.succeeded`, `payment_intent.payment_failed`, `payment_intent.canceled`, `payment_intent.processing`, `payment_intent.requires_action` | | Setup (saving a card, including a trial or an added payment method) | `setup_intent.succeeded`, `setup_intent.setup_failed`, `setup_intent.canceled`, `setup_intent.requires_action` | | Refunds | `refund.created`, `refund.updated`, `refund.failed`, `charge.refund.updated` | | Disputes | `charge.dispute.created`, `charge.dispute.updated`, `charge.dispute.closed`, `charge.dispute.funds_withdrawn`, `charge.dispute.funds_reinstated` | 8. Click **Continue**. 9. Set the **Destination type** to **Webhook endpoint** and click **Continue**. 10. Paste the Altruon webhook URL into **Endpoint URL**. 11. Name the destination `Altruon payments`. 12. Click **Create destination**. Do not add these payment events to the Stripe Billing destination, and do not point this destination at the billing webhook URL. `invoice.*` and `customer.subscription.*` belong on [Stripe Billing](/docs/connections/billing-platforms/stripe-billing). The events above belong on this endpoint. ### Add a routing entry [#add-a-routing-entry] A routing entry sends card payments in one currency to Stripe. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select **Card** as the **Payment Method**, the **Currency**, and Stripe as the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for each currency you process with Stripe. ## Test the connection [#test-the-connection] 1. Open **Settings > Payment Gateways**. Stripe is listed as **Active**. 2. With a billing platform connected, take a card payment in sandbox. See [Testing](/docs/resources/testing). 3. Check the result: the transaction is recorded in Altruon with the Stripe transaction ID, the subscription exists on your billing platform, and its invoice is marked paid. ## Notes and limits [#notes-and-limits] - **Cards only.** Stripe is currently enabled for card payments only in Altruon. - **Two Stripe connections, two webhooks.** Stripe as an acquirer and Stripe Billing are separate connections. Each has its own Altruon webhook URL and its own event list. - **The webhook URL is yours alone.** It contains your Altruon domain and the ID of this connection, and it differs between sandbox and production. - **Same mode everywhere.** A test key goes with a webhook destination in the Stripe sandbox, a live key with a destination in live mode. - **Trials.** Stripe is not in the list of supported acquirer and payment method pairs for trials. A trial with nothing due today on an unsupported pair returns an error when the session is created. ## Next steps [#next-steps] # Trustly (/docs/connections/acquirers/trustly) Connect your Trustly (SlimPay) account to take direct debit payments through Altruon: SEPA Direct Debit in EUR, Bacs in GBP and Autogiro in SEK. SEPA Direct Debit (EUR), Bacs (GBP), Autogiro (SEK) Username, password and private key (PEM), all from your Trustly/SlimPay point of contact Automatic. Altruon sends the notification endpoint with each transaction request. Supported, with a mandate. See [Trials](/docs/subscriptions/trials). In the routing table, all three methods are one payment method: `Open Banking`. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). Your own account and contract. The username, the password and the private key are provided and managed by your point of contact. You cannot generate them in the merchant backoffice. Confirm with your Trustly/SlimPay point of contact that your account is enabled for event notifications. ### Get your Trustly credentials [#get-your-trustly-credentials] Ask your Trustly/SlimPay point of contact for the three credentials: - Username - Password - Private key, in PEM format Your Trustly private key is sensitive. Store it securely and never expose it in client-side code. ### Connect Trustly in Altruon [#connect-trustly-in-altruon] 1. Sign in to Altruon and go to **Settings > Payment Gateways**. 2. Click **+ Add Integration** and select **Trustly**. 3. Enter **Username**, **Password** and **PrivateKey** (the PEM private key). 4. Click **Add Integration**. If the connection succeeds, the Trustly integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] There is nothing to set up by hand. Altruon sends the Trustly notification endpoint automatically with each transaction request, so you do not copy a webhook URL into Trustly or SlimPay. Altruon also acknowledges Trustly notifications automatically, with the signed response format that Trustly requires. Your account does need event notifications enabled: confirm it with your Trustly/SlimPay point of contact. ### Add a routing entry [#add-a-routing-entry] A routing entry sends direct debit payments in one currency to Trustly. 1. Go to **Settings > Payment Gateways** and open the **Routing** tab. 2. Click **+ Add entry**. 3. Select `Open Banking` as the **Payment Method**, `EUR`, `GBP` or `SEK` as the **Currency**, and `Trustly` as the **Payment Gateway**. 4. Click **Add Entry**. Add one entry for each currency you process with Trustly. ## Test the connection [#test-the-connection] 1. Open **Settings > Payment Gateways**. Trustly is listed as **Active**. 2. With a billing platform connected, take a direct debit payment in sandbox. See [Testing](/docs/resources/testing). 3. Check that your integration receives the lifecycle updates from Trustly, such as `account`, `pending`, `credit`, `payoutconfirmation`, `debit` and `cancel`. 4. Check the result: the transaction is recorded in Altruon with the Trustly transaction ID, the subscription exists on your billing platform, and its invoice is marked paid. ## Notes and limits [#notes-and-limits] - **One method per currency.** `EUR` is SEPA Direct Debit, `GBP` is Bacs and `SEK` is Autogiro (Bankgiro). All three are routed as `Open Banking`. - **No manual webhook.** The notification endpoint travels with each transaction request, and Altruon signs the acknowledgement. - **Trials.** A trial sets up the mandate without a charge. The first debit follows when the trial ends. - **Reversals.** Direct debit reversals from Trustly are recorded as chargebacks on your billing platform. - **Provider documentation.** [Trustly docs](https://docs.trustly.com/), [Trustly event notifications](https://amer.developers.trustly.com/payments/docs/handle-event-notifications), [SlimPay developer center](https://dev.slimpay.com/), [SlimPay webhook configuration](https://dev.slimpay.com/hapi/guide/webhook/configuration). ## Next steps [#next-steps] # Chargebee (/docs/connections/billing-platforms/chargebee) Connect Chargebee so that Altruon creates subscriptions there, collects every invoice through the acquirers you route to, and keeps subscriptions, invoices and credit notes in sync. Subscriptions, invoices (first and recurring) and credit notes A full-access API key (the API token) and your Chargebee site URL Manual. You add a webhook in Chargebee with seven invoice, credit note and subscription events. Your sandbox site and your production site have different URLs. Altruon records each payment on the Chargebee invoice. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). You can open **Settings > Configure Chargebee** in the Chargebee backoffice, with its **API Keys** and **Webhooks** pages. Altruon collects Chargebee invoices through an acquirer you connect. See [Acquirers](/docs/connections/acquirers). ### Get your Chargebee credentials [#get-your-chargebee-credentials] 1. In the Chargebee backoffice, go to **Settings > Configure Chargebee > API Keys**. 2. Copy a full-access API key. This is the API token. 3. Note your Chargebee site URL. Replace `{your-site}` with the name of your site. | Environment | Site URL | |---|---| | Sandbox | `https://{your-site}-test.chargebee.com` | | Production | `https://{your-site}.chargebee.com` | ### Connect Chargebee in Altruon [#connect-chargebee-in-altruon] 1. Sign in to Altruon and go to **Settings > Billing Platforms**. 2. Click **+ Add Integration** and select **Chargebee**. 3. Enter the API token in **Token** and the site URL in **URL**. 4. Click **Add Integration**. Once connected, the Chargebee integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Altruon needs a webhook from Chargebee to stay in sync with your billing events. 1. In Altruon, go to **Settings > Billing Platforms** and click **View Integration** on Chargebee. 2. Copy the **Webhook Endpoint** URL. 3. In the Chargebee backoffice, go to **Settings > Configure Chargebee > Webhooks**. 4. Click **+ Add Webhook**. 5. Paste the URL into the **Webhook URL** field. 6. Under **Events to Send**, select: - `Invoice Generated` - `Credit Note Created` - `Subscription Created` - `Subscription Cancelled` - `Subscription Reactivated` - `Subscription Deleted` - `Subscription Paused` 7. Click **Create**. ## Test the connection [#test-the-connection] 1. Open **Settings > Billing Platforms**. Chargebee is listed as **Active**. 2. With an acquirer connected and a routing entry in place, take a test payment in sandbox for a Chargebee plan. See [Testing](/docs/resources/testing). 3. Check the result in Chargebee: the subscription exists, and the payment is recorded on its first invoice with a reference made of the acquirer, the payment method and the acquirer's transaction ID. ## Notes and limits [#notes-and-limits] - **Subscriptions.** Altruon creates the subscription in Chargebee after the first successful payment or trial setup, with any supported acquirer and payment method. - **Invoices.** First and recurring invoices are synchronized and collected automatically. - **Credit notes.** Credit notes are synchronized, and the refund is made automatically on any supported acquirer and payment method. - **Site URLs.** The sandbox site ends in `-test.chargebee.com`. Connect it in the Altruon sandbox, and the production site in production. - **Trials.** The trial length comes from your catalog, for example the trial on the Chargebee item. See [Trials](/docs/subscriptions/trials). ## Next steps [#next-steps] # Frisbii (/docs/connections/billing-platforms/frisbii) Connect Frisbii so that it stays your subscription source of truth while Altruon collects each payment through the acquirers you route to and settles the invoice in Frisbii. Subscriptions with plans and add-ons, the subscription lifecycle, and invoices with their settlement A Frisbii API key, created as a global API key Manual. You add a webhook endpoint in Frisbii with 15 invoice and subscription events. After a successful payment, Altruon settles the invoice in Frisbii with `manual_settle` and an Altruon reference. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). You can open **Configurations > Integration and tools** in the Frisbii backoffice at [app.frisbii.com](https://app.frisbii.com/). Altruon collects Frisbii invoices through an acquirer you connect. See [Acquirers](/docs/connections/acquirers). ### Get your Frisbii API key [#get-your-frisbii-api-key] 1. Sign in to the Frisbii backoffice at [app.frisbii.com](https://app.frisbii.com/). 2. Go to **Configurations > Integration and tools > API credentials**. 3. Create an API key, or open an existing one. Make sure the **Global API key** option is ticked. 4. Copy the key. Altruon uses this key with Basic Auth against the Frisbii APIs. ### Connect Frisbii in Altruon [#connect-frisbii-in-altruon] 1. Sign in to Altruon and go to **Settings > Billing Platforms**. 2. Click **+ Add Integration** and choose **Frisbii**. 3. Paste the API key into **ApiKey**. 4. Click **Add Integration**. Once connected, Frisbii appears as **Active** in your list of billing platforms. ### Set up the webhook [#set-up-the-webhook] Altruon relies on Frisbii webhook events to keep subscriptions and invoices synchronized. 1. In Altruon, open **Settings > Billing Platforms**, then **View Integration** on Frisbii. 2. Copy the webhook URL that Altruon shows. 3. In the Frisbii backoffice, go to **Configurations > Integration and tools > Webhooks**. 4. Create a webhook endpoint: paste the Altruon URL under **Add URL** and click **Add**. 5. Subscribe to these event types: | Invoice events | Subscription events | |---|---| | `invoice_created` | `subscription_created` | | `invoice_settled` | `subscription_cancelled` | | `invoice_cancelled` | `subscription_expired` | | `invoice_failed` | `subscription_expired_dunning` | | `invoice_refund` | `subscription_on_hold` | | | `subscription_on_hold_dunning` | | | `subscription_reactivated` | | | `subscription_renewal` | | | `subscription_changed` | | | `subscription_uncancelled` | 6. Save and enable the endpoint, with the **Save** button and the **Status** toggle at the top of the page. ## Test the connection [#test-the-connection] Run a test subscription from end to end and check four things: 1. The subscription is created in Frisbii. 2. The invoice is created and synced into Altruon. 3. The successful payment triggers the settlement of the invoice in Frisbii (`manual_settle`). 4. The deep links in the Altruon backoffice open the right Frisbii records: invoice, subscription, customer and transaction context. You need a connected acquirer and a routing entry for the test payment. See [Testing](/docs/resources/testing). ## Notes and limits [#notes-and-limits] - **Subscriptions.** Altruon creates subscriptions with plans and add-ons after the first successful payment or trial setup, and collects the payment through any supported acquirer. - **Lifecycle.** These subscription states are synchronized: created, changed, on hold, reactivated, canceled and expired. - **Invoices.** Invoices are synchronized. After a successful payment at the acquirer, Altruon settles the invoice manually in Frisbii. - **Estimates.** The subscription estimate is tax inclusive and comes from the Frisbii preview subscription endpoint. - **Global API key.** The key must have the **Global API key** option ticked. - **Trials.** The trial length comes from your Frisbii catalog. See [Trials](/docs/subscriptions/trials). ## Next steps [#next-steps] # Billing platforms (/docs/connections/billing-platforms) Connect the billing platform you already run. It stays the source of truth for plans, subscriptions and invoices. Altruon collects each invoice through the acquirer you route to and writes the result back. ## What Altruon does with a billing platform [#what-altruon-does-with-a-billing-platform] - **Prices the checkout.** Before the payment, the estimate comes from your billing platform: price, tax, coupons, trial and the amount due now. - **Creates the subscription.** After the first successful payment, or after the payment method is saved for a trial, Altruon creates the subscription on the billing platform. Metadata passes through. - **Records the first payment.** The first invoice is marked paid with a reference made of the acquirer, the payment method and the acquirer's transaction ID. - **Collects renewals.** A renewal starts from the billing platform's invoice webhook. Altruon charges the stored payment method and records the payment on the invoice. - **Syncs the lifecycle.** Altruon follows each subscription through active, trial, paused and canceled. - **Links both ways.** Every subscription, invoice and transaction in the Altruon backoffice has a deep link to the record on the billing platform and at the acquirer. For the full picture, see [How billing sync works](/docs/subscriptions). ## Compare billing platforms [#compare-billing-platforms] | | Stripe Billing | Chargebee | Recurly | Frisbii | |---|---|---|---|---| | **Credentials** | Secret key | API token (a full-access API key) and site URL | Private API key and domain URL | API key, created as a global API key | | **Webhook setup** | Manual: an event destination with 8 event types | Manual: a webhook with 7 events | Manual: an endpoint in JSON format with 10 notifications | Manual: a webhook endpoint with 15 event types | | **Recorded on the invoice** | Invoice marked paid out of band | Payment recorded on the invoice | Transaction recorded on the invoice | Invoice settled with an Altruon reference (`manual_settle`) | | **What syncs** | Subscriptions, invoices, credit notes | Subscriptions, invoices, credit notes | Subscriptions, invoices, credit notes | Subscriptions with plans and add-ons, lifecycle, invoices | | **Notable** | Stripe never charges its own payment methods. Its webhook is separate from the one for Stripe as an acquirer. | The sandbox site URL ends in `-test.chargebee.com`. | EU sites use an `.eu.recurly.com` domain URL. | Tax-inclusive estimates come from the Frisbii preview subscription endpoint. | All four support [trials](/docs/subscriptions/trials). ## Webhooks from the billing platform [#webhooks-from-the-billing-platform] Every billing platform needs one webhook that points to Altruon. That webhook is how Altruon learns that an invoice is due or that a subscription was paused or canceled. Renewals start from it, so a billing platform without the webhook is not fully connected. You copy the URL from **Settings > Billing Platforms**, under **View Integration**, and add it on the billing platform with the event list from its guide. ## Altruon Billing [#altruon-billing] Altruon Billing is a billing platform that Altruon sets up and runs for you, for merchants who do not run one yet. It appears here as **Managed by Altruon**, with no credentials or webhook to manage. See [Altruon Billing](/docs/subscriptions/altruon-billing). ## Next steps [#next-steps] # Recurly (/docs/connections/billing-platforms/recurly) Connect Recurly so that Altruon creates subscriptions there, collects every invoice through the acquirers you route to, and keeps subscriptions, invoices and credit notes in sync. Subscriptions, invoices (first and recurring) and credit notes Your Recurly domain URL and a private API key Manual. You add an endpoint in Recurly, in JSON format, with ten invoice and subscription notifications. EU sites and non-EU sites use different domain URLs. Altruon records each payment as a transaction on the Recurly invoice. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). You can open **Integrations > API Credentials** and **Integrations > Webhooks** in the Recurly backoffice. Altruon collects Recurly invoices through an acquirer you connect. See [Acquirers](/docs/connections/acquirers). ### Get your Recurly credentials [#get-your-recurly-credentials] 1. Note your Recurly domain URL. Replace `{your-subdomain}` with the subdomain of your site. | Merchant | Domain URL | |---|---| | EU | `https://{your-subdomain}.eu.recurly.com` | | Non-EU | `https://{your-subdomain}.recurly.com` | 2. In the Recurly backoffice, go to **Integrations > API Credentials**. 3. Copy your **Private API Key**. Recurly explains API keys in [its documentation](https://docs.recurly.com/recurly-subscriptions/docs/api-keys#what-is-an-api). ### Connect Recurly in Altruon [#connect-recurly-in-altruon] 1. Sign in to Altruon and go to **Settings > Billing Platforms**. 2. Click **+ Add Integration** and select **Recurly**. 3. Enter your **Domain URL** and your **Private API Key**. 4. Click **Add Integration**. Once connected, the Recurly integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Altruon needs a webhook from Recurly to stay in sync with your billing events. 1. In Altruon, go to **Settings > Billing Platforms** and click **View Integration** on Recurly. 2. Copy the **Webhook Endpoint** URL. 3. In the Recurly backoffice, go to **Integrations > Webhooks > Manage Endpoints**. 4. Click **New Endpoint**. 5. Paste the copied URL into the **Endpoint URL** field. 6. Set the **Format** to **JSON**. 7. Under **Notifications**, select: - `invoice.created` - `charge_invoice.created` - `credit_invoice.created` - `subscription.created` - `subscription.canceled` - `subscription.paused` - `subscription.pause.canceled` - `subscription.reactivated` - `subscription.resumed` - `subscription.updated` 8. Click **Save Changes**. ## Test the connection [#test-the-connection] 1. Open **Settings > Billing Platforms**. Recurly is listed as **Active**. 2. With an acquirer connected and a routing entry in place, take a test payment in sandbox for a Recurly plan. See [Testing](/docs/resources/testing). 3. Check the result in Recurly: the subscription exists, and the transaction is recorded on its first invoice with a reference made of the acquirer, the payment method and the acquirer's transaction ID. ## Notes and limits [#notes-and-limits] - **Subscriptions.** Altruon creates the subscription in Recurly after the first successful payment or trial setup, with any supported acquirer and payment method. - **Invoices.** First and recurring invoices are synchronized and collected automatically. - **Credit notes.** Credit notes are synchronized, and the refund is made automatically on any supported acquirer and payment method. - **EU and non-EU domains.** An EU site has `.eu.` in its domain URL. Enter the URL that matches your site. - **JSON only.** Set the webhook format to JSON, not XML. - **Trials.** The trial length comes from your Recurly catalog. See [Trials](/docs/subscriptions/trials). ## Next steps [#next-steps] # Stripe Billing (/docs/connections/billing-platforms/stripe-billing) Connect Stripe Billing so that Altruon creates subscriptions there, collects every invoice through the acquirers you route to, and keeps subscriptions, invoices and credit notes in sync. Subscriptions, invoices (first and recurring) and credit notes A Stripe secret key (`sk_test_...` or `sk_live_...`) Manual. You add an event destination in Stripe with eight invoice and subscription events. Stripe never charges its own payment methods: Altruon collects the payment and marks the invoice paid out of band. ## Before you start [#before-you-start] You can sign in to the environment you are connecting. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). You can open **Developers > API Keys** and **Developers > Webhooks** in the [Stripe Dashboard](https://dashboard.stripe.com). Altruon collects Stripe Billing invoices through an acquirer you connect. See [Acquirers](/docs/connections/acquirers). ### Get your Stripe secret key [#get-your-stripe-secret-key] 1. Sign in to the [Stripe Dashboard](https://dashboard.stripe.com). 2. Go to **Developers > API Keys**, in the bottom left section. 3. Copy the **Secret Key**. It looks like `sk_test_...` in test mode and `sk_live_...` in live mode. You need the secret key only. ### Connect Stripe Billing in Altruon [#connect-stripe-billing-in-altruon] 1. Sign in to Altruon and go to **Settings > Billing Platforms**. 2. Click **+ Add Integration** and select **Stripe Billing**. 3. Enter your secret key. 4. Click **Add Integration**. Once connected, the Stripe Billing integration is marked **Active**. ### Set up the webhook [#set-up-the-webhook] Altruon needs a webhook from Stripe to stay in sync with your billing events. This destination is only for Stripe Billing. Card payments collected through Stripe as an acquirer use a different endpoint and a different event list: see [Stripe](/docs/connections/acquirers/stripe). 1. In Altruon, go to **Settings > Billing Platforms** and click **View Integration** on Stripe Billing. 2. Copy the **Webhook Endpoint** URL that Altruon generated. 3. Sign in to the [Stripe Dashboard](https://dashboard.stripe.com) and go to **Developers > Webhooks**. 4. Click **+ Add destination**. 5. Select these event types: - `invoice.created` - `invoice.finalized` - `invoice.paid` - `customer.subscription.created` - `customer.subscription.deleted` - `customer.subscription.updated` - `customer.subscription.paused` - `customer.subscription.resumed` 6. Click **Continue**. 7. Set the **Destination type** to **Webhook endpoint** and click **Continue**. 8. Paste the Altruon webhook URL into the **Endpoint URL** field. 9. Give the destination a descriptive name, for example "Altruon webhook". 10. Click **Create destination**. ## Test the connection [#test-the-connection] 1. Open **Settings > Billing Platforms**. Stripe Billing is listed as **Active**. 2. With an acquirer connected and a routing entry in place, take a test payment in sandbox for a Stripe Billing price. See [Testing](/docs/resources/testing). 3. Check the result in Stripe: the subscription exists, and its first invoice is marked paid with a reference made of the acquirer, the payment method and the acquirer's transaction ID. ## Notes and limits [#notes-and-limits] - **Subscriptions.** Altruon creates the subscription in Stripe Billing after the first successful payment or trial setup, with any supported acquirer and payment method. - **Invoices.** First and recurring invoices are synchronized and collected automatically. - **Credit notes.** Credit notes are synchronized, and the refund is made automatically on any supported acquirer and payment method. - **Paid out of band.** Stripe never charges its own payment methods for these invoices. Altruon charges through your acquirer and marks the invoice paid out of band. - **Two Stripe connections.** Stripe Billing and Stripe as an acquirer are separate connections with separate webhooks. Keep `invoice.*` and `customer.subscription.*` events on this destination only. - **Trials.** The trial length comes from your catalog, for example `trial_period_days` on the Stripe Price. See [Trials](/docs/subscriptions/trials). ## Next steps [#next-steps] # Connections (/docs/connections) A connection links Altruon to an account you already have at a provider. You give Altruon the provider's credentials once, in the backoffice. From then on Altruon acts on that account for you: it reads plans and writes payments on your billing platform, and it charges through your acquirer. ## The two kinds of connection [#the-two-kinds-of-connection] | | Billing platform | Acquirer | |---|---|---| | **What it is** | The system that owns your plans, subscriptions and invoices | The account that charges the shopper and settles to you | | **What Altruon does with it** | Creates the subscription after the first payment, records each payment on the invoice, follows the lifecycle | Sends each payment for a method and a currency to the acquirer you chose | | **Where you connect it** | **Settings > Billing Platforms** | **Settings > Payment Gateways** | | **Supported** | Stripe Billing, Chargebee, Recurly, Frisbii | Adyen, Checkout.com, dLocal, Nuvei, PagBrasil, Stripe, Trustly | | **Guides** | [Billing platforms](/docs/connections/billing-platforms) | [Acquirers](/docs/connections/acquirers) | The backoffice calls acquirers **Payment Gateways**. Both words mean the same connection. ## Set up in this order [#set-up-in-this-order] ### Connect an acquirer [#connect-an-acquirer] Go to **Settings > Payment Gateways**, click **+ Add Integration** and follow the guide for your [acquirer](/docs/connections/acquirers). ### Add a routing entry [#add-a-routing-entry] On the **Routing** tab, click **+ Add entry** and select a payment method, a currency and the acquirer. Without an entry, the acquirer takes no payments. See [Routing](/docs/optimize/routing). ### Connect your billing platform [#connect-your-billing-platform] Go to **Settings > Billing Platforms**, click **+ Add Integration** and follow the guide for your [billing platform](/docs/connections/billing-platforms). ### Choose your checkout [#choose-your-checkout] With both sides connected, decide how shoppers reach the checkout. See [Choose your checkout](/docs/checkout). The [Quickstart](/docs/get-started/quickstart) walks through the same order with a test payment at the end. ## How Altruon handles your credentials [#how-altruon-handles-your-credentials] - **Encrypted before they leave your browser.** The backoffice encrypts the credentials in the browser before it sends them. - **Validated live.** Altruon checks the credentials against the provider when you add the integration. A valid connection is marked **Active**. - **Health-checked about every hour.** Each connection is healthy, degraded or down. - **You hear about a down connection.** Altruon sends an email alert and shows a prompt to fix the connection in the dashboard. Sandbox and production are separate environments. Connect each provider in both, with its test credentials in the sandbox and its live credentials in production. See [Sandbox and environments](/docs/get-started/sandbox-and-environments). ## Provider webhooks into Altruon [#provider-webhooks-into-altruon] Many payment and subscription states arrive later than the API response: a payment that completes after a redirect, a renewal invoice that falls due, a trial that turns active, a dispute. Altruon relies on the provider's webhook to finalize and reconcile those states. A connection without its webhook is not complete. There are two families: - **Billing platform webhooks** tell Altruon that an invoice is due or that a subscription changed. Renewals start from them. - **Acquirer webhooks** tell Altruon the final result of a payment, a refund or a dispute. The setup differs per provider, so follow the provider's guide: | Setup | What you do | |---|---| | Manual | Open **View Integration** in Altruon, copy the **Webhook Endpoint** URL and add it in the provider's dashboard with the events the guide lists. Most providers work this way. | | Automatic | Nothing. Altruon sends the endpoint with each request. Trustly works this way. | | By the provider's support | Share the Altruon endpoint with your contact at the provider. Nuvei works this way when you already use a primary DMN endpoint: Altruon becomes the secondary one. | Always copy the URL from Altruon. It is specific to your domain, the environment and the connection. This page is about webhooks from providers to Altruon. The events Altruon sends to your own server are a different direction: see [Webhooks](/docs/concepts/webhooks). ## Billing platforms [#billing-platforms] ## Acquirers [#acquirers] New acquirers are connected on request: write to [support@altruon.io](mailto:support@altruon.io). ## Next steps [#next-steps] # Callbacks (/docs/sdk/callbacks) Altruon.js reports the outcome of `processPaymentAndSubscription()` through four callbacks. Register them with [`on()`](/docs/sdk/methods#on), once, before you call `renderComponent()`. ```js altruon .init('pk_sandbox_...', 'your-domain') .on('onSuccess', (data) => {}) .on('onFailure', (error) => {}) .on('onDataRequired', (info) => {}) .on('onActionRequired', (action) => {}); ``` | Callback | Fires when | Payload | |---|---|---| | [`onSuccess`](#onsuccess) | The payment and the subscription completed | `transactionId`, `message` | | [`onFailure`](#onfailure) | The payment failed | `status`, `message` | | [`onDataRequired`](#ondatarequired) | Required data is missing | `message`, `details`, `requiredFields` | | [`onActionRequired`](#onactionrequired) | The shopper has to complete an extra step | `actionType`, `message`, `redirectUrl` or `qrData` | For what to do in each callback, see [Handle payment results](/docs/checkout/altruon-js/payment-results). ## onSuccess [#onsuccess] Fires when a payment and its subscription finalize successfully: - The payment was processed. - The subscription was created or updated. - All required validations passed. The Altruon transaction ID. This is the only identifier in the payload. To read the subscription, customer and invoice, call [Get transaction details](/docs/api/transactions/get-details) from your server. A success message, for example `Payment completed successfully`. ```json { "transactionId": "b9b6a88e-82a7-43d6-acd3-18421d78f594", "message": "Payment completed successfully" } ``` ```js altruon.on('onSuccess', (data) => { window.location.href = `/success?trx_id=${data.transactionId}`; }); ``` ## onFailure [#onfailure] Fires when a payment and subscription fail. Causes include: - The acquirer declined the payment. - Card validation failed. - The card has insufficient funds. - A network or processing error occurred. - Any other payment-related failure. The failure status. See [status values](#status-values). A human-readable message you can show to the shopper. ```json { "status": "declined", "message": "Your card was declined. Please try a different payment method." } ``` ```js altruon.on('onFailure', (error) => { document.getElementById('error-message').textContent = error.message; }); ``` ### Status values [#status-values] Common values of `status`: | Status | Meaning | Suggested action | |---|---|---| | `declined` | The issuer declined the card | Ask the shopper to try a different card | | `failed` | General payment failure | Show the message and offer a retry | | `invalid_card` | The card details are invalid | Ask the shopper to check the card details | | `insufficient_funds` | Not enough funds | Suggest a different payment method | | `expired_card` | The card has expired | Ask for an updated card | | `processing_error` | A processing error occurred | Retry the payment or contact support | A retry needs a new session. See [Recover from a failed payment](/docs/checkout/altruon-js/payment-results#recover-from-a-failed-payment). ## onDataRequired [#ondatarequired] Fires when a payment cannot complete because required data is missing: - Required customer information is missing. - Additional verification data is needed. - The billing or shipping address is incomplete. - The payment method needs extra details. What is needed. Additional context or instructions. A comma-separated list of the missing field names, for example `billingAddress.zipCode,phone,document`. See [required fields](#required-fields). ```json { "message": "Additional information required to complete payment", "details": "Please provide the missing billing information", "requiredFields": "billingAddress.zipCode,phone,document" } ``` ```js altruon.on('onDataRequired', (info) => { const fields = info.requiredFields.split(',').map((field) => field.trim()); // Collect the fields, call the setters, then call processPaymentAndSubscription() again. }); ``` ### Required fields [#required-fields] Common names in `requiredFields`, and the method that sets each one: | Field name | Meaning | Set it with | |---|---|---| | `billingAddress.street` | Street address | [`setAddresses()`](/docs/sdk/methods#setaddresses) | | `billingAddress.city` | City | `setAddresses()` | | `billingAddress.state` | State or province | `setAddresses()` | | `billingAddress.zipCode` | Postal or ZIP code | `setAddresses()` | | `billingAddress.country` | Country code | `setAddresses()` | | `firstName` | First name | [`setCustomer()`](/docs/sdk/methods#setcustomer) | | `lastName` | Last name | `setCustomer()` | | `email` | Email address | `setCustomer()` | | `phone` | Phone number | `setCustomer()` | | `document` | Tax ID or document number, such as a CPF or CNPJ | [`setPaymentExtra()`](/docs/sdk/methods#setpaymentextra) | ## onActionRequired [#onactionrequired] Fires when a payment submission needs an extra action to finish: - 3D Secure (3DS) authentication is required. - The shopper has to be redirected to an external page. - A QR code has to be displayed. - Additional verification steps are needed. The action to take: `REDIRECT` or `QR_CODE`. A description of the action, or an instruction to show to the shopper. The URL to send the shopper to. Present when `actionType` is `REDIRECT`. The QR code as a base64-encoded PNG image in a data URI. Present when `actionType` is `QR_CODE`. ### REDIRECT [#redirect] The shopper has to leave your page to complete the payment, for example for 3D Secure authentication or bank authorization. ```json { "actionType": "REDIRECT", "message": "Payment initiated, redirecting you to complete the process...", "redirectUrl": "https://sandbox.dlocal.com/playground-ui/enrollment/N-013b1069-622a-44e7-a319-81da2dcea4c7?trxId=..." } ``` ```js altruon.on('onActionRequired', (action) => { if (action.actionType === 'REDIRECT') { window.location.href = action.redirectUrl; } }); ``` After the redirect flow, Altruon returns the shopper to the session's `redirectUrl` with `?trx_id=` and the transaction ID appended. ### QR_CODE [#qr_code] The shopper pays by scanning a code, for example with Pix in Brazil or UPI in India. ```json { "actionType": "QR_CODE", "message": "Scan the QR code to complete payment.", "qrData": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA..." } ``` ```js altruon.on('onActionRequired', (action) => { if (action.actionType === 'QR_CODE') { document.getElementById('qr-message').textContent = action.message; document.getElementById('qr-image').src = action.qrData; } }); ``` ## Related [#related] # Altruon.js reference (/docs/sdk) Altruon.js is the browser library that mounts the Altruon payment component in your own page. The component is an iframe that Altruon.js adds to a container element you choose. Your server creates the session and keeps the secret key. This tab is for lookup. For a walkthrough, start with the [Altruon.js quickstart](/docs/checkout/altruon-js). ## Install [#install] ```html ``` The CDN script is the recommended way to load Altruon.js. It defines the global `altruon` object. ```bash npm install @altruon/altruon-js ``` ```js import Altruon from '@altruon/altruon-js'; ``` ## Keys [#keys] An integration uses two keys. Both are in the backoffice under **Settings > API Keys**. | Key | Looks like | Where it runs | Used for | |---|---|---|---| | Publishable key | `pk_sandbox_...` | Browser | The first argument of [`init()`](/docs/sdk/methods#init) | | Secret key | `sk_sandbox_test_...` | Your server only | The `x-secret-key` header on [Create a session](/docs/api/sessions/create) and [Get transaction details](/docs/api/transactions/get-details) | Create sessions and read transactions from your server. The browser only needs the publishable key and the `session_id`. See [Authentication](/docs/api/authentication) for the header format and [Sandbox and environments](/docs/get-started/sandbox-and-environments) for the URLs of each environment. ## Lifecycle [#lifecycle] Call the methods in this order. | Order | Call | What it does | |---|---|---| | 1 | [`init(publicKey, siteName)`](/docs/sdk/methods#init) | Initializes Altruon.js. Call it once per page | | 2 | [`on(eventName, callback)`](/docs/sdk/methods#on) | Registers a callback. Register all four before you render | | 3 | [`setSession(sessionId)`](/docs/sdk/methods#setsession) | Binds Altruon.js to the session your server created | | 4 | [`setCustomer()`](/docs/sdk/methods#setcustomer), [`setAddresses()`](/docs/sdk/methods#setaddresses), [`setBilling()`](/docs/sdk/methods#setbilling), [`setPaymentExtra()`](/docs/sdk/methods#setpaymentextra) | Pass the shopper's data to the session. Optional, and allowed before or after step 5 | | 5 | [`renderComponent(selector)`](/docs/sdk/methods#rendercomponent) | Mounts the payment component in your container | | 6 | [`processPaymentAndSubscription()`](/docs/sdk/methods#processpaymentandsubscription) | Starts the payment and creates the subscription. Altruon.js never calls it for you | | 7 | [`onSuccess`](/docs/sdk/callbacks#onsuccess), [`onFailure`](/docs/sdk/callbacks#onfailure), [`onDataRequired`](/docs/sdk/callbacks#ondatarequired), [`onActionRequired`](/docs/sdk/callbacks#onactionrequired) | One of your callbacks receives the outcome | ```js altruon .init('pk_sandbox_...', 'your-domain') // 1 .on('onSuccess', handleSuccess) // 2 .on('onFailure', handleFailure) .on('onDataRequired', handleDataRequired) .on('onActionRequired', handleActionRequired); altruon.setSession(sessionId); // 3 altruon.setCustomer({ email: 'jane.smith@example.com' }); // 4 altruon.setAddresses({ billing: { country: 'US' } }); await altruon.renderComponent('#altruon-payment-container'); // 5 payButton.addEventListener('click', () => { altruon.processPaymentAndSubscription(); // 6 }); ``` A session is single use and expires 15 minutes after it is created. After a failed payment, create a new session and repeat from step 3. Do not call `init()` again. ## Reference pages [#reference-pages] # Methods (/docs/sdk/methods) All methods are called on the `altruon` object. For the order to call them in, see the [lifecycle](/docs/sdk#lifecycle). | Group | Method | Purpose | |---|---|---| | Initialization | [`init(publicKey, siteName)`](#init) | Initialize Altruon.js | | | [`on(eventName, callback)`](#on) | Register a callback | | Session | [`setSession(sessionId)`](#setsession) | Bind the session your server created | | Customer data | [`setCustomer(customer)`](#setcustomer) | Set the shopper's name and contact details | | | [`setAddresses(addresses)`](#setaddresses) | Set the billing and shipping addresses | | | [`setBilling(billing)`](#setbilling) | Set billing platform data | | | [`setPaymentExtra(extra)`](#setpaymentextra) | Set a tax document, card type or wallet username | | Component | [`renderComponent(selector)`](#rendercomponent) | Mount the payment component | | Payment | [`processPaymentAndSubscription()`](#processpaymentandsubscription) | Start the payment and create the subscription | `init()` and `on()` return the Altruon instance, so you can chain them. `renderComponent()` can be awaited. Do not rely on a return value from the other methods: results arrive through the [callbacks](/docs/sdk/callbacks). ## Initialization [#initialization] ### init [#init] ```ts altruon.init(publicKey: string, siteName: string): Altruon ``` Initializes Altruon.js. Call it once per page: a second call makes callbacks fire more than once. Your publishable key, for example `pk_sandbox_...`. Find it in the backoffice under **Settings > API Keys**. Your Altruon domain or site name, for example `mycompany`. **Returns** the Altruon instance, so you can chain `.on()`. ```js altruon.init('pk_sandbox_...', 'your-domain'); ``` ### on [#on] ```ts altruon.on(eventName: string, callback: (payload: object) => void): Altruon ``` Registers a callback for a payment event. Register your callbacks before you call `renderComponent()`. One of `onSuccess`, `onFailure`, `onDataRequired` or `onActionRequired`. Called with the payload of the event. See [Callbacks](/docs/sdk/callbacks) for each payload. **Returns** the Altruon instance, so you can chain further `.on()` calls. ```js altruon .init('pk_sandbox_...', 'your-domain') .on('onSuccess', (data) => console.log(data.transactionId)) .on('onFailure', (error) => console.error(error.message)) .on('onActionRequired', (action) => console.log(action.actionType)) .on('onDataRequired', (info) => console.warn(info.requiredFields)); ``` You can also call it on its own after `init()`: ```js altruon.on('onSuccess', (data) => console.log(data.transactionId)); ``` ## Session [#session] ### setSession [#setsession] ```ts altruon.setSession(sessionId: string) ``` Binds Altruon.js to a session. The session must be created by your server with [Create a session](/docs/api/sessions/create). The `session_id` from the Create Session response. A session is single use and expires 15 minutes after it is created. After a failed payment, create a new session, call `setSession()` with the new ID and render the component again. ```js altruon.setSession(sessionId); ``` ## Customer data [#customer-data] These methods pass data from your form to the session. Call them before `processPaymentAndSubscription()`. `currency`, `lineItems` and `billingPlatformId` must be set when your server creates the session and cannot be changed from the browser. Of the required values, only the billing address country can be set here. Every other customer field is optional. [Customer data](/docs/checkout/altruon-js/customer-data) has the walkthrough. ### setCustomer [#setcustomer] ```ts altruon.setCustomer(customer: object) ``` The shopper's details. First name. Last name. Email address. Phone number, for example `+1234567890`. The shopper's IP address. Some acquirers use it. ```js altruon.setCustomer({ firstName: 'Jane', lastName: 'Smith', email: 'jane.smith@example.com', phone: '+1234567890', ip: '127.0.0.1', }); ``` ### setAddresses [#setaddresses] ```ts altruon.setAddresses(addresses: object) ``` The billing address and, optionally, the shipping address. The billing address. Street address. Apartment, suite or unit number. City. State or province code. Postal or ZIP code. ISO 3166-1 alpha-2 country code, for example `US`. Required unless the session already has a billing address country from Create Session. The shipping address, if it differs from the billing address. Same properties as `billing`. ```js altruon.setAddresses({ billing: { street: '123 Main St', number: 'Apt 4B', city: 'New York', state: 'NY', zipCode: '10001', country: 'US', }, shipping: { street: '456 Oak Ave', city: 'Brooklyn', state: 'NY', zipCode: '11201', country: 'US', }, }); ``` ### setBilling [#setbilling] ```ts altruon.setBilling(billing: object) ``` Sets billing platform data. `lineItems` and `platformId` must already be set through the Create Session API and cannot be changed from the browser. Billing platform data. The items to purchase. Each item has a `type` (for example `plan`), an `id` and a `quantity`. See [Create a session](/docs/api/sessions/create) for the rules on line items. The ID of your billing platform connection in Altruon. The Create Session API calls it `billingData.billingPlatformId`. The name of the billing platform, for example `stripe` or `chargebee`. The billing frequency, for example `monthly` or `yearly`. ```js altruon.setBilling({ lineItems: [{ type: 'plan', id: '{plan-id}', quantity: 1 }], platformId: '{billing-platform-id}', platformName: 'stripe', }); ``` ### setPaymentExtra [#setpaymentextra] ```ts altruon.setPaymentExtra(extra: object) ``` Sets data that some payment methods need on the payment itself. Extra payment data. Tax document number, for example a CPF or CNPJ for Brazilian payment methods. Card brand or type hint, for example `visa`. Wallet or UPI identifier, for example `user@upi`. ```js altruon.setPaymentExtra({ document: '12345678909', cardType: 'visa', walletUsername: 'user@upi', }); ``` ## Component [#component] ### renderComponent [#rendercomponent] ```ts altruon.renderComponent(selector: string) ``` Mounts the payment component inside the element that matches `selector`. Call it after `setSession()`. A CSS selector for the container, for example `#id`, `.class` or `[data-attr]`. **Returns**: the call can be awaited, as the merchant demo does before it continues. Container requirements: - The element must exist in the DOM before you call `renderComponent()`. - The element should be empty. Do not keep your own content in it. - Altruon.js appends an iframe to the container. Before you render again, for example after a retry with a new session, clear the container first. What the component shows depends on the session: | Session | Component | |---|---| | `paymentMethod` was set at creation | The fields for that payment method | | No `paymentMethod`, several routing entries match the currency | A drawer where the shopper selects a payment method | | No `paymentMethod`, one routing entry matches the currency | Only the required fields for that method, with no drawer. For cards: card number, expiry date, CVV and, for some acquirers, the cardholder name | ```js altruon.setSession(sessionId); await altruon.renderComponent('#altruon-payment-container'); ``` ## Payment [#payment] ### processPaymentAndSubscription [#processpaymentandsubscription] ```ts altruon.processPaymentAndSubscription() ``` Starts the payment and creates the subscription. It takes no parameters. Altruon.js does not start the payment by itself. Call this method from your own button once the shopper has filled in the component and you have passed all data with the setter methods. The outcome arrives through the [callbacks](/docs/sdk/callbacks). ```js document.getElementById('pay-button').addEventListener('click', () => { altruon.setCustomer({ firstName, lastName, email }); altruon.setAddresses({ billing: { country } }); altruon.processPaymentAndSubscription(); }); ``` # Style options (/docs/sdk/style-options) `styleCustomization` is an optional object in the body of [Create a session](/docs/api/sessions/create). It styles the Altruon.js component for that session. You set it on your server: there is no style configuration in the browser, and the styles apply to every payment method in the component. It applies to Altruon.js only. Hosted pages and dynamic hosted checkout take their appearance from **Settings > Checkout**. ```ts { styleCustomization: { backgroundColor: string; primaryColor: string; secondaryColor: string; accentColor: string; borderRadius: string; headerTextColor: string; fontFamily: string; textColor: string; dropShadow: boolean; } } ``` For a walkthrough and recipes, see [Style the component](/docs/checkout/altruon-js/styling). ## Properties [#properties] Every property is optional. A property you leave out uses its default. The background color of the component. The color of primary interactive elements. In the annotated example below it colors the payment method header bar and the input borders. The color of secondary and supporting elements. In the annotated example below it colors the panel behind the form fields. The accent color for focus states, active elements and highlights, such as the marker of the selected payment method. The corner radius of all elements, as a CSS length in pixels. For example `5px`, `12px` or `0px` for square corners. The color of header text and titles. The font family for all text in the component, as a CSS font list. For example `"Inter", system-ui, sans-serif`. The color of body text, labels and placeholders. Whether the component shows drop shadows. ## Color formats [#color-formats] Color properties accept these formats. Hex is recommended for consistency. | Format | Example | |---|---| | Hex | `#3B82F6` | | RGB | `rgb(229, 231, 235)` | | RGBA, with transparency | `rgba(59, 130, 246, 0.8)` | | Named color | `black`, `darkslategray` | ## Complete example [#complete-example] ```json { "styleCustomization": { "backgroundColor": "#3a3a3a", "primaryColor": "#4B5563", "secondaryColor": "#3a3a3a", "accentColor": "#5B7FFF", "borderRadius": "5px", "headerTextColor": "#ffffff", "fontFamily": "Verdana, cursive", "textColor": "#ffffff", "dropShadow": false } } ``` ## Example themes [#example-themes] Each theme is a complete `styleCustomization` object you can paste into the Create Session request. For a dark mode interface. ```js styleCustomization: { backgroundColor: '#1F2937', primaryColor: '#3B82F6', secondaryColor: '#374151', accentColor: '#60A5FA', borderRadius: '8px', headerTextColor: '#F9FAFB', fontFamily: 'Inter, system-ui, sans-serif', textColor: '#E5E7EB', dropShadow: true, } ``` Black on white with square corners and no shadow. ```js styleCustomization: { backgroundColor: '#FFFFFF', primaryColor: '#000000', secondaryColor: '#E5E5E5', accentColor: '#000000', borderRadius: '0px', headerTextColor: '#000000', fontFamily: 'Arial, sans-serif', textColor: '#333333', dropShadow: false, } ``` A brand-led design with a strong color and large radius. ```js styleCustomization: { backgroundColor: '#FFF5F7', primaryColor: '#EC4899', secondaryColor: '#FBE2EB', accentColor: '#F472B6', borderRadius: '16px', headerTextColor: '#BE185D', fontFamily: '"Poppins", sans-serif', textColor: '#831843', dropShadow: true, } ``` A restrained look for business software. ```js styleCustomization: { backgroundColor: '#F8F9FA', primaryColor: '#0056B3', secondaryColor: '#6C757D', accentColor: '#007BFF', borderRadius: '4px', headerTextColor: '#212529', fontFamily: '"Roboto", sans-serif', textColor: '#495057', dropShadow: true, } ``` Built for accessibility, with high contrast between text and background. ```js styleCustomization: { backgroundColor: '#FFFFFF', primaryColor: '#D97706', secondaryColor: '#92400E', accentColor: '#F59E0B', borderRadius: '12px', headerTextColor: '#78350F', fontFamily: 'system-ui, sans-serif', textColor: '#1C1917', dropShadow: true, } ``` ```js styleCustomization: { backgroundColor: '#FFFFFF', primaryColor: '#10B981', secondaryColor: '#D1FAE5', accentColor: '#059669', borderRadius: '8px', headerTextColor: '#065F46', fontFamily: '"Open Sans", sans-serif', textColor: '#1F2937', dropShadow: true, } ``` ```js styleCustomization: { backgroundColor: '#F8FAFC', primaryColor: '#6366F1', secondaryColor: '#C7D2FE', accentColor: '#818CF8', borderRadius: '10px', headerTextColor: '#312E81', fontFamily: '"Inter", sans-serif', textColor: '#1E293B', dropShadow: true, } ``` ```js styleCustomization: { backgroundColor: '#FFFFFF', primaryColor: '#1E3A8A', secondaryColor: '#BFDBFE', accentColor: '#3B82F6', borderRadius: '4px', headerTextColor: '#1E40AF', fontFamily: '"Roboto", sans-serif', textColor: '#1F2937', dropShadow: true, } ``` Three themes to choose from at runtime, one per plan. See [Different styles per plan](/docs/checkout/altruon-js/styling#different-styles-per-plan). ```js const themes = { basic: { backgroundColor: '#F9FAFB', primaryColor: '#6B7280', secondaryColor: '#D1D5DB', accentColor: '#9CA3AF', borderRadius: '4px', headerTextColor: '#1F2937', fontFamily: 'system-ui, sans-serif', textColor: '#374151', dropShadow: false, }, premium: { backgroundColor: '#FFFFFF', primaryColor: '#3B82F6', secondaryColor: '#BFDBFE', accentColor: '#60A5FA', borderRadius: '8px', headerTextColor: '#1E40AF', fontFamily: '"Inter", sans-serif', textColor: '#1F2937', dropShadow: true, }, enterprise: { backgroundColor: '#1F2937', primaryColor: '#F59E0B', secondaryColor: '#374151', accentColor: '#FBBF24', borderRadius: '12px', headerTextColor: '#FCD34D', fontFamily: '"Roboto", sans-serif', textColor: '#F3F4F6', dropShadow: true, }, }; ``` ## Related [#related]