Credit conditions
Credit conditions are key to promoting seQura products. While promotional components offer widgets and pop-ups, your shop may need to promote products in situations they don't cover.
seQura's JavaScript library exposes a method to get credit agreement conditions for a given amount across different products.
1. Loading seQura JavaScript library
Include this script in your page header with 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 Sequra.computeCreditAgreements, which returns available credit agreements for a given amount:
var creditAgreements = Sequra.computeCreditAgreements({
amount: "15000",
product: "pp3",
instalmentCount: 3
});Since seQura's JavaScript library loads asynchronously, wrap static calls to
computeCreditAgreementinSequra.onLoad:
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 is an object with financing products as keys and credit agreements as values. (Example reformatted for readability.)
Each credit agreement contains product-specific fields. Many include both a numerical value and a formatted string ready for display.
{
"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 20 days ago