1. 4. Hosted page API
Mozarto - The Payments Orchestration Platform
  • 1. Introduction
  • 2. Authentication
  • 3. Redirect API
    • Pay-In Flow
    • Pay-Out Flow
    • Webhook Setup
    • Country Codes
    • Errors
    • Payment Providers (PSPs)
      • Overview
      • Brite
      • CashLib
      • Cleo
      • Contiant
      • emerchantpay
      • Flexepin
      • ForumPay
      • Gigadat
      • Neosurf
      • OFApay
      • PawaPay
      • PayModum
      • PayOne
      • Trust Payments
      • Worldpay
    • Sample requests
      • Overview
      • Pay-In
        • Brite
        • CashLib
        • Cleo
        • Contiant
        • emerchantpay
        • Flexepin
        • Forumpay
        • Gigadat
        • Neosurf
        • OFApay
        • PawaPay
        • Paymodum
        • PayOne
        • Trust Payments
        • WorldPay
      • Pay-Out
        • Cleo
        • Forumpay
        • Gigadat withdraw ACH
        • Gigadat withdraw ETO
        • OFApay
        • PawaPay
        • PayOne
        • Trust Payments
      • Webhook
        • PayOne status webhook
        • ForumPay status webhook
  • 4. Hosted page API
    • Pay-In Flow
    • Webhook Setup
    • Country Codes
    • Errors
    • Payment Providers (PSPs)
      • emerchantpay
      • Worldpay
      • Overview
    • Sample requests
      • Overview
  • Schemas
    • TransactionData
  1. 4. Hosted page API

Pay-In Flow

The Hosted page API lets your platform accept Pay-Ins through a payment page hosted by Mozarto. Your backend creates a checkout session, and the shopper completes payment on the Mozarto page, either after a redirect or inside an iframe on your site.
Unlike the Redirect API, your platform does not choose the payment provider per request. The page offers every method configured for your brand and the shopper's country. Mozarto collects the payment details, runs 3D Secure, and talks to the provider.

How it works#

1.
Create the session from your backend.
2.
Display the page with a redirect or an iframe.
3.
Handle the outcome in your UI, and confirm the payment from the webhook.

Session lifecycle#

RuleBehaviour
LifetimeA session expires 30 minutes after creation. An expired session cannot be opened or paid.
Single useThe first payment attempt consumes the session. A declined or failed payment also consumes it.
RetryCreate a new session for every new attempt. Do not reuse checkoutUrl.
StatusA session is either created or consumed. It is not exposed to your platform.

User token requirements#

Create the session with the same user context headers as the Redirect API (see Authentication). The hosted page reads the shopper's identity from that token, not from the browser.
ClaimRequiredPurpose
userIdYesLinks the transaction and saved cards to your shopper
emailYesRequired to pay
firstNameCard paymentsemerchantpay rejects card payments without the billing name
lastNameCard paymentsSame as firstName
Missing claims fail after the session is consumed. The session is created without checking these claims. If userId or email is missing, the payment attempt fails and the session cannot be reused. Validate the token on your side before creating the session.
Mozarto decodes the token from x-user-token or x-user-authorization without calling your User Auth URL, so the token must be a JWT that carries these claims.

Saved cards#

When the user token carries a userId, the shopper can tick Remember card on a card payment (unchecked by default). Saved cards appear on later sessions for the same brand, userId, and provider account. Without a userId, no cards are saved or shown.

Create the session#

Create a checkout session from your backend, then send the shopper to the returned checkoutUrl.
The request carries only the payment details. Everything else - the payment methods, provider accounts, page content, and webhook URLs - comes from your back office configuration (Payment Pages and Payments Module).

Endpoint#

POST /v1/api/mozarto/checkout/session
EnvironmentBase URL
Sandboxhttps://checkout-api.stg-app.mozarto.io
Productionhttps://checkout-api.app.mozarto.io
Authorization: Bearer <brand-jwt>
x-user-token: Bearer <user-jwt>
Content-Type: application/json
Use a brand JWT. A company JWT returns 403 Checkout sessions require a brand API key. See Authentication and the user token requirements.
A 404 Not Found means the Hosted page API is not enabled in that environment. Contact Mozarto to enable it.

Request fields#

Fields marked with * are required.
FieldTypeDescription
country *stringShopper's country - ISO 3166-1 alpha-2 recommended (e.g. "GB"). Selects the Payment Page and provider account. See Country Codes
baseamount *numberAmount in major units (e.g. 55 or 25.50). Must be a JSON number - a string such as "55" is rejected
currency *stringThree-letter ISO 4217 code (e.g. "EUR")
merchantReferencestringOptional. Your own reference for the payment, such as an order ID. Stored on the transaction and returned as merchantReference in the webhook. Defaults to an empty string
returnUrlsobjectWhere to send the shopper when they close the page. Keys: success, failure, cancel, pending. Each must be https (http only for localhost). See Return URLs

Example#

Response#

{
  "status": "success",
  "message": "Session created",
  "isSuccess": true,
  "data": {
    "sessionToken": "9b2f6c1e-4a7d-4f0e-8c3b-2d5e1a6f7b90",
    "checkoutUrl": "https://<checkout-host>/checkout/9b2f6c1e-4a7d-4f0e-8c3b-2d5e1a6f7b90",
    "expiresAt": "2026-10-29T12:30:00.000Z"
  }
}
FieldDescription
data.sessionTokenSession identifier. Single use
data.checkoutUrlThe hosted page. Redirect the shopper to it or load it in an iframe. Use the value as returned - do not build it yourself
data.expiresAtISO 8601 expiry, 30 minutes after creation

Errors#

Validation errors return HTTP 400 with { "status": "error", "message": "...", "isSuccess": false } and no errorCode. See Errors for every message and its fix.
For more requests and responses, see Sample requests.

Display the page#

Show the hosted page in one of two ways. The same checkoutUrl works for both - you do not configure the display mode in the request.
RedirectIframe
How to openNavigate the browser to checkoutUrlLoad checkoutUrl in an <iframe> on your page
SetupNoneYour page's origin must be configured for your brand
OutcomeReturn URLsBrowser events
3D SecureRuns first-party - most reliableRuns inside the frame - can be affected by third-party cookie blocking in Safari and Firefox
Use redirect when you can. It avoids browser restrictions on embedded 3D Secure pages.

Redirect#

Iframe#

RequirementDetail
Allowed originYour page's origin must be in the brand's allowed origins. See Allowed origins
ReferrerThe page identifies your origin from the Referer header. Do not set Referrer-Policy: no-referrer on the embedding page, or browser events are not sent
SizeAt least 390 x 400 CSS pixels for 3D Secure challenges, ideally 500 x 600 or larger
sandboxDo not set it. If you must, include allow-scripts allow-same-origin allow-forms allow-popups - card and 3D Secure pages need forms and scripts
Content Security PolicyYour frame-src must allow the checkout origin and issuer 3D Secure pages (https:), or omit frame-src

Allowed origins#

Mozarto configures the list of origins that may embed the page for your brand. Each entry is https://host (or http://localhost:port for development), with no path. Contact Mozarto to change the list.
Every session for your brand allows all origins on that list. Without a configured list, the page still loads but sends no browser events to your page - use redirect instead.

Browser events#

In an iframe, the page sends postMessage events to your page. Events go only to an origin confirmed against the session's allowed origins. Always check event.origin before reading the data.
typePayloadWhen
MOZARTO_HPP_READYsessionId, mode, supportedMethodsThe page has loaded the session
MOZARTO_HPP_RESIZEheightThe content height changed - resize the iframe
MOZARTO_HPP_REDIRECTINGtarget ("iframe" or "top"), pspType, transactionIdThe page is navigating to a provider or 3D Secure page
MOZARTO_HPP_FINAL_STATUStransactionId, finalStatusThe payment reached a result. See Payment outcome
MOZARTO_HPP_CLOSEtransactionId, finalStatus, autoCloseThe shopper clicked Close. Remove the iframe
Treat browser events as UI signals. They come from the shopper's browser and are not proof of payment. See Confirming a payment.

3D Secure#

3D Secure runs inside the hosted page for every method. The issuer's challenge returns to the hosted page, not to your returnUrls. Your platform does not need to handle 3D Secure redirects.

Payment outcome#

The hosted page shows the result to the shopper and reports it to your page. How your page receives it depends on how you display the page:
Iframe: MOZARTO_HPP_FINAL_STATUS when the payment reaches a result, then MOZARTO_HPP_CLOSE when the shopper clicks Close.
Redirect: the shopper is sent to one of your returnUrls when they click Close.

finalStatus values#

Match on these exact strings in MOZARTO_HPP_FINAL_STATUS and MOZARTO_HPP_CLOSE.
finalStatusMeaningFinal
Payment successfulThe payment was approvedYes
Payment failedThe payment was declined or failedYes
Card verification failed3D Secure authentication failedYes
Payment is still being processedThe provider has not confirmed the result yetNo
Card verification incomplete3D Secure did not completeNo
Session expiredThe session expired or was already used. Sent on MOZARTO_HPP_CLOSE only, with an empty transactionIdYes
The session is consumed in every case. Create a new session to let the shopper try again.

Return URLs#

When the page is not inside a confirmed iframe, Close sends the top window to one of your returnUrls:
ResultReturn URL used
Payment successfulsuccess
Payment failed or Card verification failedcancel
Payment is still being processed or Card verification incompletepending
Session expiredfailure
The shopper is not sent back automatically. The return URL is used only when they click Close.
Mozarto opens the URL exactly as you sent it and appends no query parameters. Put your own order reference in the URL if you need it (for example https://shop.example.com/checkout/result?order=ord_123).
If the matching URL is not set, Close closes the window (popups) or returns the browser to the previous page.

Confirming a payment#

Browser events and return URLs come from the shopper's browser. Use them to update your UI, not to credit an account or ship an order.
Mozarto sends the final transaction_status to your webhook URL. Credit the account or fulfil the order only after the webhook arrives. See Webhook Setup.
Modified at 2026-11-03 08:09:12
Previous
4. Hosted page API
Next
Webhook Setup
Built with