• France
status page
Demo shops
assistance
FAQContact support
Search
Categories
Tags
docs.
France
Spain
Europe (English)
India
Homepage
Use cases
Create a payment
Create an installment payment
Create a multi-card (split) payment
Create a payment by Alias (Token)
Create a payment link
Create a recurring payment
Manage subscriptions
Manage your transactions (refund, cancel...)
Analyze your reports
API docs
Embedded Form
REST API
Hosted payment
Mobile payment
File exchange
SDD mandates by REST API
Snippets
Payment methods
Plugins
Marketplace
Guides
Merchant Back Office
Back Office Expert
Functional guides

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
/en-EN/rest/V4.0/api/kb/authentication.html
https://api.lyra.com/api-payment/V4/Charge/CreateQRCode
{
  "amount": 10000,
  "currency": "EUR",
  "paymentMethodType": "[SELECTED PAYMENT METHOD]",
  "orderId": "myOrderId-1234",
  "customer": {
    "email": "sample@example.com"
  }
}
<!-- <pre data-language="json" data-market="es-PE">&#010;{&#010;    &quot;amount&quot;: 200050,&#010;    &quot;currency&quot;: &quot;PEN&quot;,&#010;    &quot;orderId&quot;: &quot;myOrderId-999999&quot;,    &#010;    &quot;channelOptions&quot;: {&#010;      &quot;channelType&quot;: &quot;MAIL&quot;,&#010;      &quot;mailOptions&quot;: {&#010;        &quot;recipient&quot;: &quot;sample@example.com&quot;&#010;      }&#010;    },&#010;    &quot;paymentReceiptEmail&quot;: &quot;sample@example.com&quot;,&#010;    &quot;expirationDate&quot;: &quot;2020-04-20T20:13:26+02:00&quot;,&#010;    &quot;locale&quot;: &quot;es_PE&quot;,&#010;    &quot;dataCollectionForm&quot;: &quot;false&quot;&#010;}&#010;</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 inbase64)

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.valuepour 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.paymentSourcefield has the 'INSTORE’ value.

Analysis of payment results

To know the payment result, implement the instant payment notification (also known as IPN).

  1. In the REST API section (TEST or PRODUCTION), enter only the notification URL: Procedure.
  2. Analyze the IPN: Procedure.
Jobs
Legal
GDPR
25.22-1.11