Credit conditions
Credit conditions are a big part of promoting seQura products, Promotional components gives shops the tools to display a specific set of widgets and pop-ups but your shop may want to create or promote products in different situations that promotional components do not cover.
SeQura Javascript library exposes a method to get credit agreement conditions for a given amount for the different products that seQura offer.
1. Loading seQura Javascript library
In order to load seQura Javascript library you need to include in your page header template the following script
passing the required configuration:
<script>
var sequraConfigParams = {
merchant: "YOUR_MERCHANT", // Your merchant reference given by SeQura.
assetKey: "YOUR_ASSET_KEY", // Your asset key given by SeQura.
products: ["i1", "pp3"], // List of seQura products that you want to include components.
scriptUri: "SCRIPT_URI", // seQura Javascript library uri for production or sandbox.
decimalSeparator: ",", // Decimal separator used in currencies formatting. Optional, default `,`.
thousandSeparator: ".", // Thousand separator used in currencies formatting. Optional, default `.`.
locale: "es-ES", // Language and country codes separated by hyphen -. Optional, default `es-ES`.
currency: "EUR", // Currency code available for chosen locale. Optional, default `EUR`.
};
(function(i, s, o, g, r, a, m) {i["SequraConfiguration"] = g;i["SequraOnLoad"] = [];i[r] = {};i[r][a] = function(callback) {i["SequraOnLoad"].push(callback);};(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);a.async = 1;a.src = g.scriptUri;m.parentNode.insertBefore(a, m);})(window, document, "script", sequraConfigParams, "Sequra", "onLoad");
</script>
Configuration parameters
Key | Mandatory | Default | Description |
---|---|---|---|
merchant | Yes | Your merchant reference given by SeQura. | |
assetKey | Yes | Your asset key given by SeQura. | |
products | Yes | List of products for the components that you want to include in the page. | |
scriptUri | Yes | seQura Javascript library uri for production or sandbox. Sandbox: https://sandbox.sequracdn.com/assets/sequra-checkout.min.js. Production: https://live.sequracdn.com/assets/sequra-checkout.min.js. | |
decimalSeparator | No | , | Decimal separator used in all number formating included in the components. |
thousandSeparator | No | . | Thousand separator used in all number formating included in the components. |
locale | No | es-ES | Locale configuration used for display format settings. |
currency | No | EUR | Currency code used for currency format, this should be available for the chosen locale configuration. |
2. Getting credit agreement conditions
SeQura’s Javascript Library exposes a simple method that returns the available credit agreements for a given amount. The method is Sequra.computeCreditAgreements
, which you can use like this:
var creditAgreements = Sequra.computeCreditAgreements({
amount: "15000",
product: "pp3",
instalmentCount: 3
});
Note that the recommended way to load SeQura’s Javascript library is asynchronously, so if you want to statically call
computeCreditAgreement
you must wrap it overSequra.onLoad
callback.
Sequra.onLoad(function() {
Sequra.computeCreditAgreements({
amount: "15000",
product: "pp3",
instalmentCount: 3
});
});
Parameters
Key | Mandatory | Description |
---|---|---|
amount | Yes | Amount of the purchase or product. Must be in cents, for instance 15,00 € is represented as 1500. |
product | No | Product of the credit agreements returned. If not given all products will be returned. |
campaign | No | Campaign of the credit agreements returned. If not given all campaign will be returned. Mandatory for pp5 product |
instalmentCount | No | Instalment count of the credit agreements returned. If not given all instalment counts options will be returned. |
The creditAgreements
variable above is a list of the requested financing products as keys and corresponding credit agreements as values. (the example has been reformatted for easier reading)
Each credit agreement contains specific fields to the financing product. Many of them include a numerical value together with a formatted string, which is ready to show.
{
"pp3": [{
"apr": { "value": 6498, "string": "64,98 %" },
"cost_of_credit_pct": { "value": 420, "string": "4,20 %" },
"cost_of_credit": { "value": 6300, "string": "63,00 €" },
"default": false,
"down_payment_amount": { "value": 50000, "string": "500,00 €" },
"down_payment_fees": { "value": 2100, "string": "21,00 €" },
"down_payment_total": { "value": 52100, "string": "521,00 €" },
"drawdown_payment_amount": { "value": 100000, "string": "1000,00 €" },
"grand_total": { "value": 156300, "string": "1563,00 €" },
"instalment_amount": { "value": 50000, "string": "500,00 €" },
"instalment_count": 3,
"instalment_fee": { "value": 2100, "string": "21,00 €" },
"instalment_total": { "value": 52100, "string": "521,00 €" },
"interest": { "value": 0, "string": "0,00 %" },
"max_amount": { "value": 300000, "string": "3000,00 €" },
"max_credit": { "value": 300000, "string": "3000,00 €" },
"max_financed_amount": { "value": 300000, "string": "3000,00 €" },
"min_amount": { "value": 5000, "string": "50,00 €" },
"min_credit": { "value": 5000, "string": "50,00 €" },
"over_max_financed_amount": { "value": 0, "string": "0,00 €" },
"over_max": { "value": 0, "string": "0,00 €" },
"setup_fee": { "value": 0, "string": "0,00 €" },
"total_with_tax": { "value": 150000, "string": "1500,00 €" },
"product": "pp3",
"available": true
}, {
"instalment_count": 6,
"product" : "pp3"
... // analogous details as above, but for 6 months credits
}, {
"instalment_count": 12,
"product" : "pp3"
... // analogous details as above, but for 12 months credits
}],
"pp5": [{
"agreed_amount": { "value": 150000, "string": "1500,00 €" },
"apr": { "value": 240, "string": "2,40 %" },
"campaign": "mayo2017",
"cost_of_credit_pct": { "value": 60, "string": "0,60 %" },
"cost_of_credit": { "value": 895, "string": "8,95 €" },
"down_payment_amount": { "value": 0, "string": "0,00 €" },
"down_payment_fees": { "value": 895, "string": "8,95 €" },
"down_payment_total": { "value": 895, "string": "8,95 €" },
"drawdown_payment_amount": { "value": 150000, "string": "1500,00 €" },
"due_date": { "value": "2018-07-10", "string": "10 de julio" },
"end_date": { "value": "2018-05-29", "string": "29 de mayo" },
"first_date": { "value": "2018-01-16", "string": "16 de enero" },
"grand_total": { "value": 150895, "string": "1508,95 €" },
"instalment_count": 1,
"instalment_fee": { "value": 0, "string": "0,00 €" },
"interest": { "value": 0, "string": "0,00 %" },
"last_date": { "value": "2018-05-29", "string": "29 de mayo" },
"max_credit": { "value": 160000, "string": "1600,00 €" },
"max_financed_amount": { "value": 160000, "string": "1600,00 €" },
"min_amount": { "value": 10000, "string": "100,00 €" },
"min_credit": { "value": 10000, "string": "100,00 €" },
"over_max_financed_amount": { "value": 0, "string": "0,00 €" },
"product": "pp5",
"setup_fee": { "value": 895, "string": "8,95 €" },
"start_date": { "value": "2018-01-16", "string": "16 de enero" },
"total_with_tax": { "value": 150000, "string": "1500,00 €" }
}],
}
Updated 5 days ago