User Interface Initialisation
To perform a transaction using the IP.Frame UI, it first needs to be initialised via a server to sever API call. The purpose of this message is to transfer the necessary information about this transaction to the platform, such as the amount and customer details etc. The Payen Platform will in turn respond in successful scenarios with a requestKey, required for the next stage in processing.
The UI can be initialised for a card transaction or a card validation, as described below.
Card Transaction Initialisation Request Example
Initialise the UI in preparation to authorise and capture funds.
- JSON
- XML
{
"requestType": "initialisationRequest",
"version": 2,
"merchant": {
"merchantId": 10000001,
"accountId": 20000001
},
"customer": {
"customerId": 1,
"email": "[email protected]",
"firstName": "Test",
"surname": "Client",
"dateOfBirth": "03042000",
"address": {
"addressLine1": "123 Street",
"addressLine2": "",
"city": "Guildford",
"province": "Surrey",
"postcode": "GU2 2YG",
"country": "GBR",
"locale": ""
},
"mobileNumber": "01234123123"
},
"transaction": {
"amount": 1000,
"currency": "USD",
"merchantRef": "Fh8F9fEpeK8qUFMHt0Vl",
"transactionType": ""
},
"url": {
"responseUrl": "https://www.url.com/ipframe/ipframeresponse.jsp",
"notificationUrl": "https://www.url.com/ipframe/notification.jsp",
"thirdPartySuccessUrl": "http://www.url.com/paypalsuccess",
"thirdPartyCancelUrl": "http://www.url.com/paypalcancel"
},
"paymentInfo": {
"country": "GBR"
}
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<initialisationRequest>
<version>2</version>
<merchant>
<merchantId>10000001</merchantId>
<accountId>20000001</accountId>
</merchant>
<customer>
<customerId>1</customerId>
<email>[email protected]</email>
<firstName>Test</firstName>
<surname>Client</surname>
<dateOfBirth>03042000</dateOfBirth>
<address>
<addressLine1>123 Street</addressLine1>
<addressLine2></addressLine2>
<city>Guildford</city>
<province>Surrey</province>
<postcode>GU2 2YG</postcode>
<country>GBR</country>
<locale></locale>
</address>
<mobileNumber>01234123123</mobileNumber>
</customer>
<transaction>
<amount>1000</amount>
<currency>USD</currency>
<merchantRef>Fh8F9fEpeK8qUFMHt0Vl</merchantRef>
<transactionType></transactionType>
</transaction>
<url>
<responseUrl>https://www.url.com/ipframe/ipframeresponse.jsp</responseUrl>
<notificationUrl>https://www.url.com/ipframe/notification.jsp</notificationUrl>
<thirdPartySuccessUrl>http://www.url.com/paypalsuccess</thirdPartySuccessUrl>
<thirdPartyCancelUrl>http://www.url.com/paypalcancel</thirdPartyCancelUrl>
</url>
<paymentInfo>
<country>GBR</country>
</paymentInfo>
</initialisationRequest>
For details of the message elements see Initialisation Request
Card Validation Initialisation Request Example
Initialise the UI in preparation to validate a card and cardholder as a standalone request.
- The cardholder will be required to complete a 3D Secure challenge process.
- No funds will be taken from the cardholder. The amount must be 0. The currency should be valid for the card and merchant account.
- This request applies to ECommerce transactions only (i.e. not MOTO).
- No further operations can be processed on these transactions e.g. they cannot be CAPTURED, REVERSED or REFUNDED.
- These transactions can be referred to when performing a Merchant Initiated Authorisation
- JSON
- XML
{
"requestType": "cardValidationInitialisationRequest",
"version": 2,
"merchant": {
"merchantId": "1000002",
"accountId": "2000053"
},
"customer": {
"customerId": 20566,
"email": "[email protected]",
"firstName": "Shopper",
"surname": "Client",
"dateOfBirth": "03041970",
"address": {
"houseNameNumber": "5",
"addressLine1": "The street",
"addressLine2": "AddressL2",
"city": "city",
"province": "CA-ON",
"postcode": "XXXX XXX",
"country": "CAN"
},
"mobileNumber": "35485962346"
},
"transaction": {
"merchantRef": "HBIRYY7zEhjfLt1QUh6a",
"amount": 0,
"currency": "CAD"
},
"url": {
"responseUrl": "https://localhost:8443/PoSSimulator/return/fromMerchant/10",
"notificationUrl": "https://localhost:8443/PoSSimulator/notification/fromPlatform/10",
"thirdPartySuccessUrl": "https://localhost:8443/PoSSimulator/return/fromThirdParty/success/10",
"thirdPartyCancelUrl": "https://localhost:8443/PoSSimulator/return/fromThirdParty/cancel/10"
},
"paymentInfo": {
"country": "CAN",
"ipAddress": "100.200.11.22"
}
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cardValidationInitialisationRequest>
<version>2</version>
<merchant>
<merchantId>1000002</merchantId>
<accountId>2000053</accountId>
</merchant>
<customer>
<customerId>20566</customerId>
<email>[email protected]</email>
<firstName>Shopper</firstName>
<surname>Client</surname>
<dateOfBirth>03041970</dateOfBirth>
<address>
<houseNameNumber>5</houseNameNumber>
<addressLine1>The street</addressLine1>
<addressLine2>AddressL2</addressLine2>
<city>city</city>
<province>CA-ON</province>
<postcode>XXXX XXX</postcode>
<country>CAN</country>
</address>
<mobileNumber>35485962346</mobileNumber>
</customer>
<transaction>
<merchantRef>HBIRYY7zEhjfLt1QUh6a</merchantRef>
<amount>0</amount>
<currency>CAD</currency>
</transaction>
<url>
<responseUrl>https://localhost:8443/PoSSimulator/return/fromMerchant/10</responseUrl>
<notificationUrl>https://localhost:8443/PoSSimulator/notification/fromPlatform/10</notificationUrl>
<thirdPartySuccessUrl>https://localhost:8443/PoSSimulator/return/fromThirdParty/success/10</thirdPartySuccessUrl>
<thirdPartyCancelUrl>https://localhost:8443/PoSSimulator/return/fromThirdParty/cancel/10</thirdPartyCancelUrl>
</url>
<paymentInfo>
<country>CAN</country>
<ipAddress>100.200.11.22</ipAddress>
</paymentInfo>
</cardValidationInitialisationRequest>
For details of the message elements see Card Validation Initialisation Request
Initialisation Response Message
The initialisation response from the Payen Platform provides the requestKey for the transaction that has just be initialised. Once you have a valid requestKey, it can be used to start up the IP.Frame UI in the browser.
An example of such a message is shown below:
- JSON
- XML
{
"version": 2,
"merchant": {
"merchantId": 10000001,
"accountId": 20000001
},
"transaction": {
"merchantRef": "Fh8F9fEpeK8qUFMHt0Vl",
"gatewayRef": "G78GYft76HGJ98IOifT"
},
"status": {
"code": "SUCCESS",
"timestamp": "2012-06-21T16:56:39.154+01:00"
},
"requestKey": "3b5bee9ffa8a446e8f30161516af1527"
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<initialisationResponse>
<version>2</version>
<merchant>
<merchantId>10000001</merchantId>
<accountId>20000001</accountId>
</merchant>
<transaction>
<merchantRef>Fh8F9fEpeK8qUFMHt0Vl</merchantRef>
<gatewayRef>G78GYft76HGJ98IOifT</gatewayRef>
</transaction>
<status>
<code>SUCCESS</code>
<timestamp>2012-06-21T16:56:39.154+01:00</timestamp>
</status>
<requestKey>3b5bee9ffa8a446e8f30161516af1527</requestKey>
</initialisationResponse>
For details see Initialisation Response
UI Integration
The IP.Frame payment experience is delivered through a secure HTML <iframe> that sits on top of the merchant’s website via a custom web component called <fusion-element>.
This element will create the secure <iframe> and launch the IP.Frame modal within it, in a PCI-DSS compliant manner.
Using this element supports consistent behavior across desktop, tablet, and mobile devices.
CSS and JavaScript assets are provided via script links that must be included on the merchant’s webpage. These assets are responsible for rendering and controlling the IP.Frame experience. Please contact your integration manager to obtain the production URLs and access credentials.
Required Assets
<link rel="stylesheet" href="https://pripframev2.ilixium.com/fusion/ui/fusion.css" />
<script type="text/javascript" src="https://pripframev2.ilixium.com/fusion/ui/fusion.min.js"></script>
Launching the UI
In addition to including the required assets the merchant’s webpage must also include the <fusion-element> tag.
This custom web component acts as the container for the IP.Frame experience.
It should be placed within the HTML where the payment interface should appear.
There are two supported approaches:
- Declarative (HTML-based) Integration
- Non-Declarative (Script-based) Integration
Add the <fusion-element> directly to your HTML where the iframe should appear.
<fusion-element></fusion-element>
Alternatively, you can dynamically inject the <fusion-element> into the page via JavaScript before dispatching the
(openFusion) event. This approach is useful if you prefer to render Fusion dynamically or conditionally
at runtime:
<script type="text/javascript">
const fusionElement = document.createElement('fusion-element');
document.body.appendChild(fusionElement); // Or insert at a specific container
// Then dispatch the custom (openFusion) event
</script>
This element must exist in the DOM before the (openFusion) event is dispatched.
If the element is missing, the UI will not start.
In either approach the web component will now validate the parameters, sanitize the base URL, and automatically
render the iframe inside the <fusion-element> tag.
Once the initialisation request has been processed and a transaction request key obtained,
the merchant must trigger the UI by dispatching a JavaScript event (openFusion) with the appropriate
transaction parameters.
- baseUrl - The environment specific URL for the UI
- merchantId - The same merchantId used during initialisation
- requestKey - The requestKey from the initialisation response
- digest - The digest value calculated using this merchantId and requestKey. see Browser to Server Digest Calculation
<script type="text/javascript">
document.dispatchEvent(new CustomEvent('openFusion', {
detail: {
baseUrl: 'https://pripframev2.ilixium.com/fusion/ui',
merchantId: '{merchantId}',
requestKey: '{requestKey}',
digest: '{digest}'
}
}));
</script>
If parameters are invalid/missing the iframe will fail to launch, then no request will be made to the Payen platform.
Additionally, JavaScript must be enabled in the browser; otherwise, the UI will not load.
You may wish to warn your users when their javascript is currently disabled by implementing a <noscript> block.
An example of a noscript block for cases of disabled javascript:
<noscript>
<div class="your-styles">
Resources on this page require javascript. Please enable it.
</div>
</noscript>
Closing the UI
When the processing of the transaction is complete, a response will be sent to the URL provided in the initialise request message based on the outcome (response url). This response will be in the form of a POST message and will contain the following parameters:
| Parameter | Description | Data Type | Required |
|---|---|---|---|
| merchantId | The merchant identifier as given in the original initialisation request. | Alphanumeric 4-20 Chars | Yes |
| responseKey | The response key provided by the Platform required for sending the final status message. | Alphanumeric 32 Chars | Yes |
| digest | The Base64 encoded SHA-512 message digest of the merchant id and response key concatenated with the merchant’s password. For more information please see the digest calculation section. | Alphanumeric 1-255 Chars | Yes |
Once this response has been received, you can dispatch a close event to the <fusion-element> in order to remove it from the DOM.
For example:
<script>
document.querySelector('fusion-element').dispatchEvent(new Event('close'));
</script>
Once the <fusion-element> receives the close event, it cleans up any associated resources and becomes ready to handle the next (openFusion) event.