How to integrate the pedagogic pop-in?
Last update: April 12, 2024
Getting started
These parameters can be added to the ‘options’ object above and will be displayed exactly as passed in.
Add a script tag linking to the loader javascript file found at: “loader.min.js“ (187 bytes) in the page where the Simulation Popin is to be displayed. Remove the "-staging" part of the URL for Production environment.
Example:
<script type="text/javascript" src="https://assets-staging.oney.io/build/loader.min.js"></script>
In your javascript create a function that will be called on click of the button to load the Simulation popin. For this example, this is called
showOneyWidgetbut can be changed to any desired name.Set the
onclickfunction for the button that loads the Oney Pedagogic Popin to theshowOneyWidgetfunction created in step 2 above.In the
showOneyWidgetfunction created in step 2, create a variable namedoptions, with the following mandatory fields:
| Field name | Mandatory - Optional | Description | 
|---|---|---|
country | M | Merchant Country code in ISO 3166-1 alpha-2 format | 
language | M | Merchant Language code in ISO 3166-1 alpha-2 format | 
merchant_guid | M | Merchant global unique identifier given by Oney to the partner | 
payment_amount | M | Amount of asked payment | 
let options = {        
  country: "IT",
  language: "IT",
  merchant_guid: "678e2eaa-b73d-4dd6-aa4f-7b712d9566e4",
  payment_amount: 560.00
};
In the
showOneyWidgetfunction created in step 2, include the following call to theloadOneyWidgetfunction which is found in the “loader.min.js“ file included in step 1 above:loadOneyWidget(function () { oneyMerchantApp.loadPedagogicPopin({ options }); });The
showOneyWidgetfunction should look like the following sample:function showOneyWidget() { let options = { country: "IT", language: "IT", merchant_guid: "678e2eaa-b73d-4dd6-aa4f-7b712d9566e4", payment_amount: 560.00 }; loadOneyWidget(function () { oneyMerchantApp.loadPedagogicPopin({ options }); }); }Make sure the function names are input exactly.
If no filter is provided, all paid business transactions are mentioned in the legal text.
The ‘options’ variable is mandatory, and the fields in the above sample are all mandatory.
You can now click on the button to show the Oney Pedagogic Popin (step 3 above) and the layer should display.
Country-specific parameters
These parameters can be added to the ‘options’ object above and will be displayed exactly as passed in.
Note: The following parameters are mandatory so that the short legal notice displayed is compliant. Information will be shown as blank in the text if not passed in, making it not compliant.
 
If you provide 5x12x Oney to your customers, you need to provide the following specific information linked to an Orias registration . Registration is valid until 28th February of the following year and must be renewed each year by the 31st of January the latest. Our teams remain at your disposal to guide you.
| Field name | Mandatory - Optional | Description | 
|---|---|---|
merchant_name | M | The name of the merchant, to be displayed in the legal text. | 
merchant_orias_number | M | The Orias number of the merchant, to be displayed in the legal text. | 
merchant_address  | M | The merchant head office address, to be displayed in the legal text. | 
Advanced configuration
The ‘options’ object created above can be expanded to filter for specific business transaction in one of two ways:
Filtering by Business Transaction Codes
The parameter ‘filter_by’ is added to the ‘options’ object with the value "business_transaction_codes”.
The ‘business_transaction_codes’ parameter is added to the ‘options’ object with a list of strings each representing a unique business transaction code given by Oney.
The showOneyWidget function should look like the below sample:
function showOneyWidget() {
    let options = {        
    country: "IT",
    language: "IT",
    merchant_guid: "678e2eaa-b73d-4dd6-aa4f-7b712d9566e4",
    payment_amount: 560.99,
    filter_by: "business_transaction_codes",
    business_transaction_codes: [
        "3x005"
    ]
    };
    loadOneyWidget(function () {
    oneyMerchantApp.loadPedagogicPopin({ options });
    });
}
Filtering by using Filters
The parameter ‘filter_by’ is added to the ‘options’ object with the value "filters”.
The parameter ‘filters’ is added to the ‘options’ object with a list of objects each representing a unique business transaction.
Each object have different fields depending on your country.
The showOneyWidget function should look like the below sample:
function showOneyWidget() {
    let options = {        
        country: "IT",
        language: "IT",
        merchant_guid: "678e2eaa-b73d-4dd6-aa4f-7b712d9566e4",
        payment_amount: 560.99,
        filter_by: "filters",
        filters: [
            {
    "payment_method":"bnpl",
                "payment_method_type":"split",
                "payment_mode":"10x",
                "with_down_payment":"true",
                "is_free":true
  }
        ]
    };
    loadOneyWidget(function () {
        oneyMerchantApp.loadPedagogicPopin({ options });
    });
}
payment_method
- If empty, default value = 
bnpl bnpl
- If empty, default value = 
 payment_method_type
- If empty, default value =  
splitif payment_method =bnpl splitif payment_method =bnpl
- If empty, default value =  
 payment_mode
Value =3xwith_down_payment
Value =trueis_free
Value =trueif free of charge otherwise value =false
Error Callback
The errorCallback parameter is not mandatory.
The options object can be expanded to receive a response that can be handled by the developer when something goes wrong.
This will be especially useful when setting up, or to have the possibility to log errors.
The correct value to pass in is a function accepting two parameters:
status
An integer with the HTTP status code of the responseresponse
A string (which can be a stringified JSON object) with the details of the response
The errorCallback function will look something like the following example:
...
options.errorCallback = function (status, response) {
    console.log(status + " - " + response);
}
loadOneyWidget(function () {
    oneyMerchantApp.loadPedagogicPopin({ options });
});
In this case, the only action being performed is outputting the error to the console, but this can be changed to fit your needs
If no filter is given for a specific business transaction and both ‘free’ and ‘charged’ options are available, the ‘charged’ transaction will be returned.
Full example
<html>
    <head></head>
    <body>
      <h2>Merchant Website</h2>
      <button onclick="showOneyWidget()">
        Load simulation popin
      </button>
      <script type="text/javascript" src="https://dsstgintmkthub.z6.web.core.windows.net/build/loader.min.js"></script>
      <script>
        function showOneyWidget () {
          let options = {        
            country: "ES",
            language: "ES",
            merchant_guid: "177637a4-917f-4010-b259-736b33dfa75f",
            payment_amount: 560.00
          };
          loadOneyWidget(function () {
            oneyMerchantApp.loadPedagogicPopin({ options });
          });
        }
      </script>
    </body>
</html>