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
- Create a session.
POSTtoinit-iframewithentryset tohostedand yourredirectUrl. - Open the cashier. Send the customer's browser to
iframeEntrypointfrom the response. That URL already includes the token. - Customer pays on the hosted page.
- Customer returns. The browser is sent to
redirectUrl. That only means the session ended. - Confirm the payment. Your server receives a callback on
returnUrlorerrorUrl. Then call Payment Status with thevalidationKeyfrom this request. Credit the customer only when that status is successful.
Do not treat the redirect to
redirectUrlas a payment result.returnUrlanderrorUrlare 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 sees | A full MiFinity page | The cashier inside your site |
| How you open it | Redirect the browser to iframeEntrypoint | showPaymentIframe with sgpg.js |
| How the session ends | Browser redirect to redirectUrl | JavaScript complete, success, and fail callbacks |
| What proves the payment | Payment Status | Payment 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
| Parameter | Type | Description |
|---|---|---|
| Content-Type | String | application/json |
| Accept | String | application/json |
| x-api-version | String | 1 |
| Key | String | Your API key |
Fields for the hosted page
These two fields select the hosted cashier. Every other field matches iFrame Initialization.
| Name | Type | Required | Description |
|---|---|---|---|
| entry | String | Yes | hosted for this flow. Use embedded only when you render the in-page widget. |
| redirectUrl | URL | Yes | Page the customer's browser returns to when the hosted session ends. This is not the payment callback. |
All request parameters
| Name | Type | Required | Description |
|---|---|---|---|
| returnUrl | URL | Yes | Server 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. |
| errorUrl | URL | No | Server callback for a failed transfer. Receives a JSON ApiSGPGErrorResponse. Sent asynchronously, and it can arrive after the cashier closes. |
| validationKey | String | Yes | Secret you generate, unique per request. Used to validate the callback and to call Payment Status. 48–255 characters. |
| client | SGPGPlatformUser | Yes | Client details. Every field except emailAddress can be edited in the cashier. |
| clientReference | String | Yes | Your identifier for this client. Max 48 characters. |
| address | SGPGAddress | Yes | Client address. Editable in the cashier. |
| traceId | String | Yes | Your identifier for this call. Max 48 characters. |
| money | Money | Yes | Transfer amount and currency. |
| description | String | Yes | Transfer description. Max 255 characters. Sofort and Klarna deposits are limited to 27 characters. |
| destinationAccountNumber | String | Yes | Your MiFinity account number that collects the payment. |
| iframeId | EntityId | No | Set this when you have more than one iFrame type. |
| brandId | String | Yes | 3-digit brand ID from MiFinity. |
| languagePreference | String | No | 2–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. |
| logoUrl | URL | No | Logo shown under the cashier header, centered. The container is at most 45px high and keeps the image aspect ratio. Use a small image. |
| paymentMethod | String | No | Payment method to open with. Required for Split Gateway. |
| entry | String | Yes | hosted or embedded. Use hosted for this page. |
| redirectUrl | URL | Yes | Browser URL for the end of a hosted session. |
Nested objects
SGPGPlatformUser
| Name | Type | Required | Description |
|---|---|---|---|
| dob | LocalDate | Yes | Date of birth. Format: YYYY-MM-DD |
| firstName | String | Yes | First name. 1–20 characters. |
| lastName | String | Yes | Last name. 1–20 characters. |
| phone | String | Yes | Phone number. |
| dialingCode | String | Yes | International dialing code. |
| nationality | String | Yes | ISO 3166-1 alpha-2 country code. |
| emailAddress | String | Yes | Email address. Max 50 characters. |
SGPGAddress
| Name | Type | Required | Description |
|---|---|---|---|
| addressLine1 | String | Yes | Building name or number. Max 200 characters. |
| addressLine2 | String | No | Street name. Max 60 characters. |
| countryCode | String | Yes | ISO 3166-1 alpha-2 country code (2 characters). |
| postalCode | String | No | Postal code. Max 50 characters. |
| state | String | No | State code. Max 2 characters. |
| city | String | Yes | City name. Max 30 characters. |
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.
| Name | Type | Description |
|---|---|---|
| traceId | String | The trace ID from the request. |
| initializationToken | String | Encoded token for this session. |
| client | SGPGPlatformUser | Client details echoed from the request. |
| address | SGPGAddress | Address echoed from the request. |
| iframeEntrypoint | String | Full 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:
- Receive the callback on
returnUrl(success) orerrorUrl(failure). See Payment Status Callback. - Match
traceIdandvalidationKeyto the values you sent ininit-iframe. - Call Payment Status with that
validationKey. - Update the customer's balance only when the status is successful.
Updated about 23 hours ago