Alternative Hosted iFrame 2.0

Open the cashier as a full page. Same init token as the widget, no sgpg.js. The customer returns to your redirectUrl.

The hosted page allows you to open the MiFinity payment cashier in a separate window via a provided unique URL. Rather than loading the Javascript widget to open the page after retrieving the token, in the hosted page we will simply return the URL which you will need to open on your end. When the customer finishes, their browser returns to the redirectUrl you send in the request.

💡

Use this page when the customer should leave your site, pay on a MiFinity page, and come back to a URL you control.

Use the iFrame JavaScript widget when the cashier should stay inside your own page.

How it works

  1. Create a session. POST to init-iframe with entry set to hosted and your redirectUrl.
  2. Open the cashier. Send the customer's browser to iframeEntrypoint from the response. That URL already includes the token.
  3. Customer pays on the hosted page.
  4. Customer returns. The browser is sent to redirectUrl. That only means the session ended.
  5. Confirm the payment. Your server receives a callback on returnUrl or errorUrl. Then call Payment Status with the validationKey from this request. Credit the customer only when that status is successful.
❗️

Do not treat the redirect to redirectUrl as a payment result. returnUrl and errorUrl are server callbacks and can arrive after the customer has already left the cashier.

⏱️

The initialization token expires after 30 minutes. Request a new token if it has expired.

Hosted and embedded

Hosted (this page)Embedded widget
What the customer seesA full MiFinity pageThe cashier inside your site
How you open itRedirect the browser to iframeEntrypointshowPaymentIframe with sgpg.js
How the session endsBrowser redirect to redirectUrlJavaScript complete, success, and fail callbacks
What proves the paymentPayment StatusPayment Status

returnUrl and errorUrl work the same in both flows. They are where MiFinity posts the payment result. redirectUrl is only the page the customer's browser comes back to.

Initialize the session

🔗

POST https://demo.mifinity.com/api/gateway/init-iframe/

This call creates the session. It does not open the cashier.

The response includes iframeEntrypoint. Send the customer's browser there. On demo that host is demo.mifinity.com. In production, use the iframeEntrypoint from the response (secure.mifinity.com). Do not POST to the cashier URL.

Headers
ParameterTypeDescription
Content-TypeStringapplication/json
AcceptStringapplication/json
x-api-versionString1
KeyStringYour API key

Fields for the hosted page

These two fields select the hosted cashier. Every other field matches iFrame Initialization.

NameTypeRequiredDescription
entryStringYeshosted for this flow. Use embedded only when you render the in-page widget.
redirectUrlURLYesPage the customer's browser returns to when the hosted session ends. This is not the payment callback.
All request parameters
NameTypeRequiredDescription
returnUrlURLYesServer callback for a successful transfer. Receives a JSON ApiSGPGPaymentResponse. Sent asynchronously when the processor executes the transfer, which can be after the cashier closes. Timing varies by processor.
errorUrlURLNoServer callback for a failed transfer. Receives a JSON ApiSGPGErrorResponse. Sent asynchronously, and it can arrive after the cashier closes.
validationKeyStringYesSecret you generate, unique per request. Used to validate the callback and to call Payment Status. 48–255 characters.
clientSGPGPlatformUserYesClient details. Every field except emailAddress can be edited in the cashier.
clientReferenceStringYesYour identifier for this client. Max 48 characters.
addressSGPGAddressYesClient address. Editable in the cashier.
traceIdStringYesYour identifier for this call. Max 48 characters.
moneyMoneyYesTransfer amount and currency.
descriptionStringYesTransfer description. Max 255 characters. Sofort and Klarna deposits are limited to 27 characters.
destinationAccountNumberStringYesYour MiFinity account number that collects the payment.
iframeIdEntityIdNoSet this when you have more than one iFrame type.
brandIdStringYes3-digit brand ID from MiFinity.
languagePreferenceStringNo2–5 character language code for the iFrame. Defaults to English (EN). Supported values: BR, PT_BR, CN, ZH_CN, DE, DK, DA, DA_DK, EN, ES, FI, FR, GR, EL, EL_GR, HR, IT, JP, JA, JA_JP, LA, ES_LA, NL, NO, PL, PT, RU, SV, SE, SV_SE, ZH, TW, ZH_TW.
logoUrlURLNoLogo shown under the cashier header, centered. The container is at most 45px high and keeps the image aspect ratio. Use a small image.
paymentMethodStringNoPayment method to open with. Required for Split Gateway.
entryStringYeshosted or embedded. Use hosted for this page.
redirectUrlURLYesBrowser URL for the end of a hosted session.

Nested objects

SGPGPlatformUser

NameTypeRequiredDescription
dobLocalDateYesDate of birth. Format: YYYY-MM-DD
firstNameStringYesFirst name. 1–20 characters.
lastNameStringYesLast name. 1–20 characters.
phoneStringYesPhone number.
dialingCodeStringYesInternational dialing code.
nationalityStringYesISO 3166-1 alpha-2 country code.
emailAddressStringYesEmail address. Max 50 characters.
SGPGAddress

NameTypeRequiredDescription
addressLine1StringYesBuilding name or number. Max 200 characters.
addressLine2StringNoStreet name. Max 60 characters.
countryCodeStringYesISO 3166-1 alpha-2 country code (2 characters).
postalCodeStringNoPostal code. Max 50 characters.
stateStringNoState code. Max 2 characters.
cityStringYesCity name. Max 30 characters.
Money

NameTypeRequiredDescription
amountBigDecimalYesTransfer amount.
currencyStringYesCurrency code in ISO 4217 format.

Request example

entry and redirectUrl are the hosted-page fields.

{
  "traceId": "50764c56-7b7f-4424-906d-1ddc5d1c4ae1",
  "money": {
    "amount": 20,
    "currency": "EUR"
  },
  "description": "Deposit to Test Merchant",
  "validationKey": "validation_keyc6d2a2d4-e00a-4c0f-82d8-8f9e8a103157",
  "returnUrl": "https://merchant.example.com/payments/callback",
  "errorUrl": "https://merchant.example.com/payments/callback",
  "destinationAccountNumber": "5001000000000001",
  "brandId": "001",
  "address": {
    "addressLine1": "Swords Enterprise Park",
    "addressLine2": "",
    "countryCode": "DE",
    "postalCode": "123456",
    "city": "Dublin"
  },
  "client": {
    "dob": "1990-12-01",
    "firstName": "Sherlock",
    "lastName": "Holmes",
    "nationality": "DE",
    "emailAddress": "[email protected]",
    "phone": "871234567",
    "dialingCode": "353"
  },
  "clientReference": "client-1001",
  "entry": "hosted",
  "redirectUrl": "https://merchant.example.com/cashier/return"
}

Response

The field to use in the browser is iframeEntrypoint. initializationToken is the same token the embedded widget would use. You do not need to build the cashier URL yourself.

NameTypeDescription
traceIdStringThe trace ID from the request.
initializationTokenStringEncoded token for this session.
clientSGPGPlatformUserClient details echoed from the request.
addressSGPGAddressAddress echoed from the request.
iframeEntrypointStringFull URL of the hosted cashier. Redirect the customer's browser here.
{
  "payload": [
    {
      "traceId": "50764c56-7b7f-4424-906d-1ddc5d1c4ae1",
      "initializationToken": "2_sg8fuVRHS34FkdVTHgxRC905pj_P5y7aQCEyNAj83R_…DRmZ8vyc=",
      "client": {
        "dob": "1990-12-01",
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "dialingCode": "353",
        "phone": "871234567",
        "nationality": "DE",
        "emailAddress": "[email protected]"
      },
      "address": {
        "addressLine1": "C1 Swords Enterprise Park",
        "addressLine2": "",
        "countryCode": "DE",
        "postalCode": "123456",
        "city": "Dublin"
      },
      "iframeEntrypoint": "https://demo.mifinity.com/iframe2#initToken=2_sg8fuVRHS34FkdVTHgxRC905pj_P5y7aQCEyNAj83R_…DRmZ8vyc="
    }
  ]
}

The live initializationToken and iframeEntrypoint are long. The example above is shortened.

Redirect the browser to iframeEntrypoint. After the customer finishes, MiFinity sends that browser to redirectUrl.

After the customer returns

Show a waiting or return page on redirectUrl. Then settle the payment on your server:

  1. Receive the callback on returnUrl (success) or errorUrl (failure). See Payment Status Callback.
  2. Match traceId and validationKey to the values you sent in init-iframe.
  3. Call Payment Status with that validationKey.
  4. Update the customer's balance only when the status is successful.

What’s Next

Generate JavaScript html code for your clients.

Did this page help you?