In this guide you will find snippets for Node.js, Java, PHP and Python server langages.
1. Introduction
This API integration guide will walk you through the process of setting up your environments so you can later consume scalexpert APIs into your application or platform.
By integrating these APIs, you'll be able to initiate and manage e-financing subscriptions on behalf of your customers or dynamically propose warranty extensions for some items on their basket prior checkout.
2. API Overview
The APIs allow for seamless interaction with our platform, enabling you to initiate and manage financing or insurance proposals seamlessly pro-grammatically . Here are some key aspects of the APIs:
RESTful architecture: Utilize standard HTTP methods (GET, POST, PUT, DELETE) to interact with the API.
JSON-based data format: Send and receive data in JSON format, ensuring compatibility and ease of integration across different programming languages.
oAuth2 client credentials authentication flow (server to server).
For more details refer to:
Authentication and Authorization
To access these APIs, you'll need to authenticate your requests by obtaining an oAuth2 access token. API Keys are obtained from the developer portal, which serves as your access credential. They are used to authenticate your service using oAuth 2.0 client credentials flow. Upon authorization for the claimed scopes the issued token will be used to identify each subsequent request.
Refer to authentication API reference for more details:
Obtain an oAuth2 access token
Node.js native
var https = require('follow-redirects').https;
var fs = require('fs');
var qs = require('querystring');
var options = {
'method': 'POST',
'hostname': 'api.e-commerce.societegenerale.com',
'path': '/baas/prod/auth-server/api/v1/oauth2/token',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic ZmU3ZmVmYjktNmEyZ...zdqQW89'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = qs.stringify({
'grant_type': 'client_credentials',
'scope': 'e-financing:rw'
});
req.write(postData);
req.end();
The API provides various endpoints for managing subscriptions or retrieving relevant data. Each endpoint supports specific actions and requires specific parameters. Requests should include appropriate headers, and responses are returned in JSON format.
Refer to the API reference section for detailed information on each endpoint, including request/response examples and required parameters.
3. Getting Started
Prerequisites for Integration
Before starting the integration process, make sure you have complete the prerequisites. Refer to "Before you start" pages for more details
Also have a look at "Security best practices" pages. For instance, make attention that API must be implemented at server side and not at front side.
API Access Credentials and Keys
Refer to "Before you start/API key" section for instructions:
Testing Environment Setup
Set up a testing environment to ensure smooth integration and testing of the E-Financing API:
User Acceptance Test for customer (UATC) environment that will simulates the production environment. Use this environment for development, integration, and testing purposes.
API Documentation: Familiarize yourself with the API documentation, including endpoint details, request/response examples, and any available snippets that can expedite the integration process.
4. API Integration Steps
Now let's dive into the steps involved in integrating the E-Financing API into your application or platform:
Step 1: Check Eligible E-Financing Solutions
To determine the eligible e-financing solutions available for a specific purchase, follow these steps:
Collect Purchase Information: Gather relevant purchase details, such as the total amount and country of the buyer end user (or by default country of your site).
Make a GET Request: Utilize the API endpoint responsible for checking eligibility, passing the necessary purchase information.
Handle Response: Capture and process the response, which will indicate the available e-financing solutions and their associated merchant communication kit informations.
According the response render the solution to end users for instance on product page by showcasing the solutions (see next step).
By "showcasing solutions" we mean rendering the solutions at product or checkout pages (see more details here). This will be possible with the response of GET /eligible-solutions and object "communicationKit" and its attributes that contains texts with HTML, logos, images ...
Response GET /eligible-solutions
{"solutions": [ {"solutionCode":"SCFRLT-TXNO","familyCode":"SC","marketCode":"FR","conditions":"PS","communicationKit": {"solutionCode":"SCFRLT-TXNO","visualTitle":"<div class=scalexpert_title>Etalez votre paiment avec un crรฉdit</div>","visualDescription":"Un crรฉdit vous engage et doit รชtre remboursรฉ. Vรฉrifiez vos capacitรฉs de remboursement avant de vous engager.","visualInformationIcon":"https://scalexpert.societegenerale.com/app/merchantKit/visual_information_icon.svg", "visualAdditionalInformation": "<div class=scalexpert_subtitle>Comment รงa marche ?</div><ol> <li>Ajoutez le produit ร votre panier et finalisez votre achat. Validez votre panier</li> <li>Au moment du paiement, choisissez d'รฉtaler votre paiement avec un crรฉdit.</li> <li>Renseignez les informations demandรฉes, munissez-vous de votre piรจce d'identitรฉ et signez รฉlectroniquement votre contrat de financement. Obtenez une rรฉponse immรฉdiate de notre partenaire FRANFINANCE. <br>C'est terminรฉ! </li></ol>",
"visualLegalText": "<div class=scalexpert_subtitle>Mentions lรฉgales</div><p>Un crรฉdit vous engage et doit รชtre remboursรฉ. Vรฉrifiez vos capacitรฉs de remboursement avant de vous engager. Offre valable toute lโannรฉe, ร partir de 1000 euros de crรฉdit et sous rรฉserve dโacceptation du crรฉdit affectรฉ par FRANFINANCE (SA au capital de 31.357.776,00 euros - 719 807 406 RCS Nanterre - 53 rue du Port, CS 90201, 92724 Nanterre Cedex - France -, Intermรฉdiaire en assurance inscrit lโORIAS Nยฐ 07 008 346 - www.orias.fr). Vous disposez dโun dรฉlai de rรฉtractation de 14 jours ร compter de la date de signature du contrat de crรฉdit. Le vendeur est intermรฉdiaire de crรฉdit non exclusif de FRANFINANCE, immatriculรฉ ร lโORIAS sous le numรฉro XXXXX (www.orias.fr).</p>",
"visualTableImage":null,"visualLogo":"https://scalexpert.societegenerale.com/app/merchantKit/e_financing_visual_logo_FR.svg","visualInformationNoticeURL":null,"visualProductTermsURL":null } },```
Rendering of communication KIT (ex long term credit):
<!-- create css classes scalexpert_title and scalexpert_subtitle and standard html tags according your graphical layout standards--><divclass=scalexpert_title>Etalez votre paiment avec un crรฉdit</div><divclass=scalexpert_subtitle>Comment รงa marche ?</div><ol> <li>Ajoutez le produit ร votre panier et finalisez votre achat. Validez votre panier</li> <li>Au moment du paiement, choisissez d'รฉtaler votre paiement avec un crรฉdit.</li> <li>Renseignez les informations demandรฉes, munissez-vous de votre piรจce d'identitรฉ et signez รฉlectroniquement votre contrat de financement. Obtenez une rรฉponse immรฉdiate de notre partenaire FRANFINANCE. <br>C'est terminรฉ! </li></ol><divclass=scalexpert_subtitle>Mentions lรฉgales</div><p>Un crรฉdit vous engage et doit รชtre remboursรฉ. Vรฉrifiez vos capacitรฉs de remboursement avant de vous engager. Offre valable toute lโannรฉe, ร partir de 1000 euros de crรฉdit et sous rรฉserve dโacceptation du crรฉdit affectรฉ par FRANFINANCE (SA au capital de 31.357.776,00 euros - 719 807 406 RCS Nanterre - 53 rue du Port, CS 90201, 92724 Nanterre Cedex - France -, Intermรฉdiaire en assurance inscrit lโORIAS Nยฐ 07 008 346 - www.orias.fr). Vous disposez dโun dรฉlai de rรฉtractation de 14 jours ร compter de la date de signature du contrat de crรฉdit. Le vendeur est intermรฉdiaire de crรฉdit non exclusif de FRANFINANCE, immatriculรฉ ร lโORIAS sous le numรฉro XXXXX (www.orias.fr).</p>
To retrieve the details of a specific e-financing subscription, follow these steps:
Get Subscription ID: Obtain the unique subscription ID associated with the e-financing subscription you want to retrieve details for.
Make a GET Request: Use the appropriate API endpoint, providing the unique subscription ID, to retrieve the subscription details.
Handle Response: Capture and process the response, which will contain comprehensive information about the requested subscription, including payment schedule, repayment amounts, and status.
Node.Js - Native
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': 'api.e-commerce.hml.societegenerale.com',
'path': '/baas/uat/e-financing/api/v1/subscriptions/eb6adb12-5c1d-4b30-9b24-7854d755cd55',
'headers': {
'Authorization': 'Bearer eyJlbmMiOiJBMjU2Q0JDLUhTNTE...Uj6m2ZXbgRPYXZ_8wKIRfI'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();