Integration guide (expert mode)
1. Initiating a request for cardholder authentication
Appelez le Web Service PCI/Charge/Authenticate en utilisant les champs ci-dessous :
name | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
amount | Integer| Longueur : 1-12 |requis Montant de la transaction exprimé dans la plus petite fraction de la devise (par exemple : 30050 pour 30050 XPF). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
currency | String| Longueur : 3 |requis Code de la devise selon la norme ISO 4217 alpha-3 (par exemple : "XPF" pour le franc CFP). Possible values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
productType | énumération|optionnel Product type for which the transaction is made. Possible values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
transactionCategory | énumération|requis Catégorie de la transaction. Doit être valorisé à PAYMENT . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
transactionInitiator | énumération|optionnel Initiateur de la transaction. Doit être valorisé à CUSTOMER . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
paymentSource | énumération|optionnel Initiateur de la transaction. Doit être valorisé à EC . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customer | objet JSON|recommandé Objet contenant les informations sur l'acheteur. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
device | objet JSON|requis Objet contenant les informations sur le navigateur. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
paymentForm | objet JSON|requis Object containing the card data. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
protocolRequest | objet JSON|requis Objet contenant les informations sur le protocole d'authentification. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchant | objet JSON|requis Object containing information about the contract. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
recurring | objet JSON|optionnel Objet contenant les informations sur l'abonnement. Détails de l'objet
|
Retrouvez la description des champs dans notre playground : PCI/Charge/Authenticate.
Sample query
{ "amount": 1230, "currency": "XPF", "transactionCategory": "PAYMENT", "productType": "GOODS_OR_SERVICE_PURCHASE", "merchant": { "mid": "1234567" }, "paymentForm":{ "pan": "4970110000000013", "expiryMonth": "02", "expiryYear": "24", "networkPreference": "VISA" }, "device": { "deviceType": "BROWSER", "acceptHeader": "application/json", "ip": "89.249.65.28", "javaEnabled": true, "language": "en", "colorDepth": "1", "screenHeight": 1024, "screenWidth": 768, "timeZoneOffset": 0, "userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" }, "protocolRequest": { "name": "THREEDS", "version": "2", "challengePreference": "NO_PREFERENCE" } }
/** * I initialize the PHP SDK */ require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/keys.php'; require_once __DIR__ . '/helpers.php'; /** * Initialize the SDK * see keys.php */ $client = new Lyra\Client(); /** * I create a formToken */ $store = array("amount" => 250, "currency" => "EUR", "orderId" => uniqid("MyOrderId"), "customer" => array( "email" => "sample@example.com" )); $response = $client->post("V4/Charge/CreatePayment", $store); /* I check if there are some errors */ if ($response['status'] != 'SUCCESS') { /* an error occurs, I throw an exception */ display_error($response); $error = $response['answer']; throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] ); } /* everything is fine, I extract the formToken */ $formToken = $response["answer"]["formToken"]; ?>
Example of a response
La suite du processus dépend de l'objet contenu dans la réponse : AuthenticationResponseData :
- Objet
AuthenticationResult
:
- Procédez directement à la demande d'autorisation (pas d'authentification du porteur)
- Exemple, avec une demande de FRICTIONLESS :
{ "webService":"PCI/Charge/Authenticate", "version":"V4", "applicationVersion":"5.23.0", "serverDate":"2021-05-05T09:33:32+00:00", "ticket":"3b68064f80f346919828dee761bd22b5", "applicationProvider":"", "metadata":null, "status":"SUCCESS", "mode":"TEST", "serverUrl":"https://api.secure.osb.pf", "_type":"V4/WebService/Response", "answer":{ "id":"1fec4a93-3208-4602-be55-803261bdbccc", "protocol":{ "name":"THREEDS", "version":"2.1.0", "network":"VISA", "challengePreference":"NO_PREFERENCE", "simulation":true, "_type":"V4/Charge/Authenticate/Protocol" } ,"value":{ "authenticationType":"FRICTIONLESS", "authenticationId":{ "authenticationIdType":"dsTransId", "value":"cd85dd04-4bd8-47e4-b42a-708ded17b3cf", "_type":"V4/Charge/Authenticate/AuthenticationId" }, "authenticationValue":{ "authenticationValueType":"CAVV", "value":"udjlTuaT4fHRNwKRifj1t+Zn/6k=", "_type":"V4/Charge/Authenticate/AuthenticationValue" }, "status":"SUCCESS", "commerceIndicator":"05", "extension":{ "authenticationType":"THREEDS_V2", "threeDSServerTransID":"1fec4a93-3208-4602-be55-803261bdbccc", "dsTransID":"cd85dd04-4bd8-47e4-b42a-708ded17b3cf", "acsTransID":"a11081a6-268f-42bc-8356-0aacf74d2565", "_type":"V4/Charge/Authenticate/AuthenticationResultExtensionThreedsV2" }, "reason":{ "_type":"V4/Charge/Authenticate/AuthenticationResultReason" }, "_type":"V4/Charge/Authenticate/AuthenticationResult" }, "_type":"V4/AuthenticationResponseData" } }
- Objet
AuthenticationInstruction
:
- Procédez à l'authentification du porteur (voir étape 2: Traitement des instructions).
- Exemple, avec une instruction
FINGERPRINT
(3DS Method).
{ "webService":"PCI/Charge/Authenticate", "version":"V4", "applicationVersion":"5.22.0", "serverDate":"2021-05-03T15:02:56+00:00", "ticket":"c295ad67f65341529c1db6760df400fd", "applicationProvider":"", "metadata":null, "status":"SUCCESS", "mode":"TEST", "serverUrl":"https://api.secure.osb.pf", "_type":"V4/WebService/Response", "answer":{ "id":"b5bdf588-df35-4d56-8852-a68bd9c20147", "protocol":{ "name":"THREEDS"," version":"2.1.0", "network":"VISA", "challengePreference":"NO_PREFERENCE", "simulation":true, "_type":"V4/Charge/Authenticate/Protocol" }, "value":{ "instructionType":"FORM", "name":"FINGERPRINT", "timeout":10, "target":{ "element":"IFRAME", "visible":false, "_type":"V4/Charge/Authenticate/InstructionTarget" }, "http":{ "method":"POST", "url":"<https://acs.sg.com/acs/v2/3dsMethod>", "body":{ "threeDSMethodData":"eyJ0aHJlZURzTW..." }, "_type":"V4/Charge/Authenticate/HttpRequest" }, "_type":"V4/Charge/Authenticate/AuthenticationInstruction" }, "_type":"V4/AuthenticationResponseData" } }
2. Processing instructions
The response to the PCI/Charge/Authenticate service call contains an AuthenticationInstruction object:
- If the response contains a "CHALLENGE" instruction, create a visible iFrame to display the authentication page.
- If the response contains a "FINGERPRINT" instruction, create an invisible iFrame to display the execution page for the ACS JavaScript code.
2.1. iFrame creation
Regardless of the received instruction type (CHALLENGE or FINGERPRINT), you must build an iFrame using the data received in the target object.
Examples of transmitted data according to the instruction type
Instruction"CHALLENGE" | "target":{ "element":"IFRAME", "visible":true, "width":500, "height":600, "_type":"V4/Charge/Authenticate/InstructionTarget" } |
Instruction"FINGERPRINT" (3DS Method) | "target":{ "element":"IFRAME", "visible":false, "_type":"V4/Charge/Authenticate/InstructionTarget" } |
2.2. Submitting the authentication request form
Once the iFrame is created, use the data received in the http object to allow:
- Either the display of the payment method issuer's authentication page, for a CHALLENGE type instruction.
- Or the execution of the JavaScript code of the payment method issuer's ACS, for a FINGERPRINT type instruction.
Examples of data transmitted in the http object :
3DS2 challenge | "http":{ "method":"POST", "url":"https://acs.sg.com/v2/creq", "body":{ "creq":"eyJ0aHJlZURTU2Vy...", "threeDSSessionData":"H4sIAAAAAAAAAC2OyZK..." }, "_type":"V4/Charge/Authenticate/HttpRequest" }, |
Fingerprint | "http":{ "method":"POST", "url":"https://acs.sg.com/v2/3dsMethod", "body":{ "threeDSMethodData":"eyJ0aHJlZURzTW..." }, "_type":"V4/Charge/Authenticate/HttpRequest" }, |
Example of JavaScript implementation
function createInstructionIframe(instruction) { // Get instruction container element container = document.getElementById('instructionContainer'); // Clean instruction container container.innerHTML = '; // Create iframe element var iframe = document.createElement('iframe'); iframe.id = 'instructionIframe'; iframe.name = 'instructionIframe'; iframe.src = 'about:blank'; iframe.style.width = instruction.value.target.width+"px"; iframe.style.height = instruction.value.target.height+"px"; iframe.style.visibility = instruction.value.target.visible ? 'visible' : 'hidden'; // Handle timeout if(instruction.value.timeout){ setTimeout(() => { const instructionResultTimeout = { eventName: 'LYRA_AUTH_INSTRUCTION_RESULT', value: { name: instruction.value.name, value: 'TIMEOUT', protocol: { name: instruction.protocol.name, version: instruction.protocol.version, network: instruction.protocol.network, challengePreference: instruction.protocol.challengePreference, simulation: instruction.protocol.simulation }, }, }; window.postMessage(JSON.stringify(instructionResultTimeout), '*'); }, instruction.value.timeout * 1000); } // Add iframe to container container.appendChild(iframe); // Create form to post var form = document.createElement('form'); form.id = 'instructionForm'; form.name = 'instructionForm'; form.target = 'instructionIframe'; form.method = instruction.value.http.method; form.action = instruction.value.http.url; form.style = 'visibility: hidden'; // Create form body Object.keys(instruction.value.http.body).forEach(function (name) { form.innerHTML += '<input name="' + name + '" value="' + instruction.value.http.body[name] + '">'; }); var body = document.createElement('form'); // Add form to container container.appendChild(form); // Triger form submit form.submit(); }
Example of a call to the createInstructionIframe function in PHP
//Call the charge/Authenticate method
$obj = authenticate($data);
if ($obj['answer']['_type']== 'V4/AuthenticationResponseData'){
$response= $obj['answer'];
//Test if anwser contains an instruction
if($response['value']['_type'] == 'V4/Charge/Authenticate/AuthenticationInstruction'){
$_SESSION['RequestParams']= $param_request;
$_SESSION['requestId'] = $response['id'];
//create an iFrame to proceed to the payer authentication
echo '<script>window.onload = function(){ var instruction =JSON.parse(\'. json_encode($response) .'\'); createInstructionIframe(instruction);}</script>';
}
}
3. Setting up an event listener
After authenticating the payment method holder or executing the 3DS Method, the client's browser sends a response in the form of a JavaScript event.
Use the following code to capture the event:
window.addEventListener('message', function (messageEvent) { var data = messageEvent.data; try { var messageData = JSON.parse(data); if (messageData.eventName === 'LYRA_AUTH_INSTRUCTION_RESULT') { try { // callback call with messageData.value content container = document.getElementById('instructionContainer'); var form = document.createElement('form'); form.method = 'POST'; form.action = "https://myhost.com/payment/authentication/result.php"; form.style = 'visibility: hidden'; form.innerHTML += "<input name='messageData' value='" + data + "'>"; var body = document.createElement('form'); container.appendChild(form); form.submit(); } catch (err) { // error callback call } finally { // always close the iFrame/popin container = document.getElementById('instructionContainer'); container.remove(); } } } catch (err) { // process eventual exceptions during callbacks } }, false);
Event examples"LYRA_AUTH_INSTRUCTION_RESULT"
after a Challenge 3DS2 authentication |
|
after code execution3DS Methodof the ACS (3DS2 authentication) |
|
in case of a timeout during a challenge (3DS2) |
|
4. Handling the “LYRA_AUTH_INSTRUCTION_RESULT” events
Lorsqu'un événement LYRA_AUTH_INSTRUCTION_RESULT
est reçu, appelez le Web Service PCI/Charge/Authenticate afin de décoder son contenu.
Use the following fields in your request:
name | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
amount | Integer| Longueur : 1-12 |requis Montant de la transaction exprimé dans la plus petite fraction de la devise (par exemple : 30050 pour 30050 XPF). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
currency | String| Longueur : 3 |requis Code de la devise selon la norme ISO 4217 alpha-3 (par exemple : "XPF" pour le franc CFP). Possible values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
productType | énumération|optionnel Product type for which the transaction is made. Possible values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
transactionCategory | énumération|requis Catégorie de la transaction. Doit être valorisé à PAYMENT . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customer | objet JSON|recommandé Object containing buyer's data. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
device | objet JSON|requis Object describing browser information. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
paymentForm | objet JSON|requis Object containing the card data. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
protocolRequest | objet JSON|requis Object describing the desired authentication mode. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merchant | objet JSON|requis Object containing information about the contract. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
recurring | objet JSON|optionnel Objet contenant les informations sur l'abonnement. Détails de l'objet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id | String| Longueur : 36 |requis Authentication request identifier provided in the response to the initial call. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
instructionResult | objet JSON|requis Objet contenant le détail de l'instruction reçu dans l'événement JavaScript LYRA_AUTH_INSTRUCTION_RESULT . |
Sample query
{ "amount": 1230, "currency": "XPF", "transactionCategory": "PAYMENT", "productType": "GOODS_OR_SERVICE_PURCHASE", "merchant": { "mid": "1234567" }, "paymentForm":{ "pan": "4970110000000013", "expiryMonth": "02", "expiryYear": "24", "networkPreference": "VISA" }, "device": { "deviceType": "BROWSER", "acceptHeader": "application/json", "ip": "89.249.65.28", "javaEnabled": true, "language": "en", "colorDepth": "1", "screenHeight": 1024, "screenWidth": 768, "timeZoneOffset": 0, "userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" }, "protocolRequest": { "name": "THREEDS", "version": "2", "challengePreference": "NO_PREFERENCE" }, "id": "c82794e9-9c20-44a8-9297-b70e1e7c4006", "instructionResult": { "name" : "CHALLENGE", "protocol" : { "name" : "THREEDS", "version" : "1.0.2", "network" : "VISA", "challengePreference": "NO_PREFERENCE", "simulation": false }, "value": "eyJhbGciOiJIUz..." } }
/** * I initialize the PHP SDK */ require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/keys.php'; require_once __DIR__ . '/helpers.php'; /** * Initialize the SDK * see keys.php */ $client = new Lyra\Client(); /** * I create a formToken */ $store = array("amount" => 250, "currency" => "EUR", "orderId" => uniqid("MyOrderId"), "customer" => array( "email" => "sample@example.com" )); $response = $client->post("V4/Charge/CreatePayment", $store); /* I check if there are some errors */ if ($response['status'] != 'SUCCESS') { /* an error occurs, I throw an exception */ display_error($response); $error = $response['answer']; throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] ); } /* everything is fine, I extract the formToken */ $formToken = $response["answer"]["formToken"]; ?>
AuthenticationInstruction
In the response:* La réponse contient un objetAuthenticationInstruction
: vous devez traiter l'instruction pour continuer le processus d'authentification du porteur. * La réponse contient un objetPayment
: le procesus est terminé.5. Authentication result analysis
The authentication process is complete. The response contains the data needed to proceed with the authorization request.
Below are some examples of data returned after cardholder authentication:
3DS2 frictionless authentication (with or without the 3DS Method) | ''json "answer":{ "id":"3b25e3ed-5d48-4f99-af61-0d5db9e3b18e", "protocol":{ "name":"THREEDS", "version":"2.1.0", "network":"VISA", "challengePreference":"NO_PREFERENCE", "simulation":true, "_type":"V4/Charge/Authenticate/Protocol" }, "value":{ "authenticationType":"FRICTIONLESS", "authenticationId":{ "authenticationIdType":"dsTransId", "value":"18e46ff7-b882-4102-9af4-aef9f40ee6a6", "_type":"V4/Charge/Authenticate/AuthenticationId" }, "authenticationValue":{ "authenticationValueType":"CAVV", "value":"PdY1V9f/aHxC2wbZt4/7Z6Q9f44=", "_type":"V4/Charge/Authenticate/AuthenticationValue" }, "status":"SUCCESS", "commerceIndicator":"05", "extension":{ "authenticationType":"THREEDS_V2", "threeDSServerTransID":"3b25e3ed-5d48-4f99-af61-0d5db9e3b18e", "dsTransID":"18e46ff7-b882-4102-9af4-aef9f40ee6a6", "acsTransID":"410d9fb4-8db1-483e-9a80-f94c3a79017e", "_type":"V4/Charge/Authenticate/AuthenticationResultExtensionThreedsV2" }, "reason":{ "_type":"V4/Charge/Authenticate/AuthenticationResultReason" }, "_type":"V4/Charge/Authenticate/AuthenticationResult" }, "_type":"V4/AuthenticationResponseData" } '' |
Successful 3DS2 challenge authentication |
|
Failed 3DS2 challenge authentication |
|
3DS2 challenge authentication timeout |
|
Technical error. |
|
Successful OTP OSB authentication |
|