Pay with a QR Code
Use cases
Grâce au Web Service Charge/CreateQRCode, le marchand crée un QR code.
Une fois créé et affiché, l'acheteur scanne le QR Code pour payer.
List of payment methods
Payconiq |
Test
Test the Charge/CreateQRCode Web Service via our playground.
Fields
mandatory
name | Description |
---|---|
amount | Amount to be paid, expressed in its smallest currency unit (cent for euro). |
currency | Currency of payment. ISO 4217 alpha-3 code. Ex: "EUR" for euro. |
paymentMethodType | Choix du moyen de paiement : "PAYCONIQ" |
customer.email | Buyer's e-mail address. |
recommended
name | Description |
---|---|
orderId | Order reference. |
validityPeriod | Validity period in seconds. Another possibility to configure it via the application. |
size | Taille. Valeurs posibles : S, M (par défaut), L. |
transactionOptions.paymentMethodOptions.paymentSource | Payment source. Valeurs possibles : 'EC' (par défaut), 'INSTORE', 'APP'. |
transactionOptions.paymentMethodOptions.deviceSerialNumber | Serial number of the device. Required fieldiftransactionOptions.paymentMethodOptions.paymentSourcehas the valueINSTORE. |
transactionOptions.paymentMethodOptions.mid | Acquirer contract number. |
Request
Sample query
{ "amount": 10000, "currency": "EUR", "paymentMethodType": "[SELECTED PAYMENT METHOD]", "orderId": "myOrderId-1234", "customer": { "email": "sample@example.com" } }
<!-- <pre data-language="json" data-market="es-PE">
{
 "amount": 200050,
 "currency": "PEN",
 "orderId": "myOrderId-999999", 
 "channelOptions": {
 "channelType": "MAIL",
 "mailOptions": {
 "recipient": "sample@example.com"
 }
 },
 "paymentReceiptEmail": "sample@example.com",
 "expirationDate": "2020-04-20T20:13:26+02:00",
 "locale": "es_PE",
 "dataCollectionForm": "false"
}
</pre>
{ "amount": 200050, "currency": "ARS", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "MAIL", "mailOptions": { "recipient": "sample@example.com" } }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00", "locale": "es_AR", "dataCollectionForm": "false" }
{ "amount": 200050, "currency": "COP", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "MAIL", "mailOptions": { "recipient": "sample@example.com" } }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00", "locale": "es_CO", "dataCollectionForm": "false" }
{ "amount": 200050, "currency": "BRL", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "MAIL", "mailOptions": { "recipient": "sample@example.com" } }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00", "locale": "pt_BR", "dataCollectionForm": "false" }-->
/** * 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"]; ?>
/** * 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"]; ?>
Response
Trois types de réponse existent dans le champ qrCode.qrType
:
- URL
- DATA
- IMAGE(encoded in
base64
)
Example of a response
URL
{ "webService": "Charge/CreateQRCode", "version": "V4", "applicationVersion": "6.10.0", "status": "SUCCESS", "answer": { "uuid": "3e14c758e0464a1f85f6de287689306d", "amount": 10000, "currency": "EUR", "orderId": "myOrderId-1234", "qrCode": { "expirationDate": "2024-02-22T09:55:44+00:00", "qrType": "URL", "value": "https://secure.lyra.com/checkout(...)entID=253965149&s=M", "copyPasteValue": null, "_type": "URL" }, "_type": "V4/Charge/CreateQRCodeResponse" }, (...) "_type": "V4/WebService/Response" }
Le champ qrCode.value
contient une URL. L'acheteur clique sur l'URL pour afficher le QR Code.
Le marchand peut aussi créer un QR Code avec l'URL générée. Exemple d'implémentation en PHP :
<?php
include('phpqrcode/qrlib.php'); // Load the PHP QR Code librairy
$url='qrCode.value'; // Retrieve the answer.qrCode.value
QRcode::png($url, 'image-qrcode.png'); // Create the QR Code
?>
DATA
{ "webService": "Charge/CreateQRCode", "version": "V4", "applicationVersion": "6.10.0", "status": "SUCCESS", "answer": { "uuid": "3e14c758e0464a1f85f6de287689306d", "amount": 10000, "currency": "EUR", "orderId": "myOrderId-1234", "qrCode": { "expirationDate": "2024-01-04T09:50:27+00:00", "qrType": "DATA", "value": "00020101021226(...)f3f8-44fa-805d-3552f3ae759c5204000053039865802BR5925LYRA NETWORK TEL M PAGAME6009SAO PAULO62070503***630426BD", "_type": "DATA" }, "_type": "V4/Charge/CreateQRCodeResponse" }, (...) "_type": "V4/WebService/Response" }
Utilisez la valeur du champqrCode.value
pour créer le QR Code.
Exemple d'implémentation enPHP :
<?php
include('phpqrcode/qrlib.php'); // Load the PHP QR Code librairy
$value='qrCode.value'; // Retrieve the answer.qrCode.value
QRcode::png($value, 'image-qrcode.png'); // Create the QR Code
?>
IMAGE ( base64 encoded)
{ "webService": "Charge/CreateQRCode", "version": "V4", "applicationVersion": "6.10.0", "status": "SUCCESS", "answer": { "uuid": "3e14c758e0464a1f85f6de287689306d", "amount": 10000, "currency": "EUR", "orderId": "myOrderId-1234", "qrCode": { "expirationDate": "2024-01-04T09:50:27+00:00", "qrType": "IMAGE", "value": "iVBORw07(...)wewJpltJrLXvdENKGtEvQpazhQYeMy3B4up5XyA64lTSD+Apcr0Opbr760ZEKiSLRj8r/F3AH5oAdICpAVIC5A8gD9G7EWe3QLtLAAAAABJRU5ErkJggg==", "_type": "IMAGE" }, "_type": "V4/Charge/CreateQRCodeResponse" }, (...) "_type": "V4/WebService/Response" }
Retrieve the value of the qrCode.value
field encoded in base64
and insert it into a tag img
.
<div> <img src="data:image/png;base64,iVBORw07(...)wewJpltJrLXvdENKGtEvQpazhQYeMy3B4up5XyA64lTSD+Apcr0Opbr760ZEKiSLRj8r/F3AH5oAdICpAVIC5A8gD9G7EWe3QLtLAAAAABJRU5ErkJggg==" alt="QR Code"> </div>
Retrouvez la description et l'intégralité des champs dans notre playground : QRCodeTransaction
Error handling
Error table
Code | Description |
---|---|
INT_009 | The format of the amount field is invalid or the field is not transmitted. |
INT_010 | The format of the currency field is invalid or the field is not transmitted. |
INT_050 | The strongAuthentication parameter is invalid. |
INT_815 | The description parameter is too long.The maximum length is 65 characters. |
INT_856 | The locale parameter is invalid. |
INT_858 | The taxRate parameter is invalid. |
INT_869 | The taxAmount parameter is invalid. |
PSP_519 | Unknown currency. |
PSP_606 | Currency not supported by the MID. |
PSP_1091 | QR Code creation has failed in the application. |
PSP_1094 | Error during QR Code creation. |
PSP_1095 | The serial number of the device (fieldtransactionOptions.paymentMethodOptions.deviceSerialNumber ) isMandatoryif thetransactionOptions.paymentMethodOptions.paymentSource field has the 'INSTORE’ value. |
Analysis of payment results
To see the payment result, implement the instant payment notification (also known as IPN).