• Francia
página de estado
demo
asistencia
FAQContacte el soporte tecnico
Buscar
Categoria
Tags
España
Francia
España
Europa (Inglés)
India
Página principal
Casos de uso
Crear un pago
Crear un pago en vencimientos
Crear un pago multitarjeta
Crear un pago por token
Crear un enlace de pago
Crear una suscripción
Gestione sus suscripciones
Gestione sus transacciones
Analizar los diarios
Docs API
Formulario incrustado
API REST
Formulario en redirección
Pago móvil
Intercambio de ficheros
Ejemplo de código
Medios de pago
Plugins
Guías
Back office Experto
Guías funcionales

Pagar con un código QR

Casos de uso

Utilizando el servicio web Charge/CreateQRCode, el comerciante crea un código QR.

Una vez creado y mostrado, el comprador escanea el código QR para pagar.

Lista de medios de pago


Payconiq

Testear

Testee el Web Service Charge/CreateQRCode desde nuestro playground.

Campos


OBLIGATORIO
APELLIDO Descripción
amount Monto para pagar, expresado en su fracción monetaria más pequeña (el céntimo para el euro).
currency Moneda del pago. Código ISO 4217 alpha-3. Ejemplo: "EUR" para el euro.
paymentMethodType Elección del método de pago: "PAYCONIQ"
customer.email E-mail del comprador.

recomendado
APELLIDO Descripción
orderId Referencia del pedido.
validityPeriod Periodo de validez en segundos. También puede configurarse desde la aplicación.
size Taille.
Valores posibles: S, M (predeterminado), L.
transactionOptions.paymentMethodOptions.paymentSource Origen del pago.
Valores posibles: 'EC' (predeterminado), 'INSTORE', 'APP'.
transactionOptions.paymentMethodOptions.deviceSerialNumber Número de serie del dispositivo.
Campo obligatorioSItransactionOptions.paymentMethodOptions.paymentSourcetiene el valorINSTORE.
transactionOptions.paymentMethodOptions.mid Número de contrato adquiriente.

Solicitud


Ejemplo de solicitud
/es/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"];

?>

Respuesta

Hay tres tipos de respuesta en el campo qrCode.qrType :

  • URL
  • DATA
  • IMAGE(codificada enbase64)

Ejemplo de respuesta

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" 
}

El campo qrCode.value contiene una URL. El comprador hace clic en ella para ver el código QR.

El comerciante también puede crear un código QR con la URL generada. Ejemplo de implementación 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" 
}

Utilice el valor del campoqrCode.valuepara crear el código QR.
Ejemplo de implementación 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
?>
IMAGEN (codificada base64 )
{
    "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" 
}

Recupere el valor del campo qrCode.value, codificado en base64, e insértelo en una etiqueta. img.

<div>
   <img src="data:image/png;base64,iVBORw07(...)wewJpltJrLXvdENKGtEvQpazhQYeMy3B4up5XyA64lTSD+Apcr0Opbr760ZEKiSLRj8r/F3AH5oAdICpAVIC5A8gD9G7EWe3QLtLAAAAABJRU5ErkJggg==" alt="QR Code">
</div>

Encuentra la descripción y todos los campos en nuestro patio de juegos: QRCodeTransaction

Manejo de errores

Tabla de errores
Código Descripción
INT_009 El formato del campo amount no es válido o el campo no se ha transmitido.
INT_010 El formato del campo currency no es válido o el campo no se ha transmitido.
INT_050 El parámetro strongAuthentication es inválido.
INT_815 El parámetro description es demasiado largo. La longitud máxima es de 65 caracteres.
INT_856 El parámetro locale es inválido.
INT_858 El parámetro taxRate es inválido.
INT_869 El parámetro taxAmount es inválido.
PSP_519 Moneda desconocida.
PSP_606 Moneda no admitida por la afiliación.
PSP_1091 No se pudo crear el código QR en la aplicación.
PSP_1094 Error al crear el código QR.
PSP_1095 El número de serie del dispositivo (campotransactionOptions.paymentMethodOptions.deviceSerialNumber) esOBLIGATORIOsi el campotransactionOptions.paymentMethodOptions.paymentSourcetiene el valor 'INSTORE'.

Analizar el resultado del pago

Para conocer el resultado del pago, implemente la URL de notificación al final el pago (IPN).

  1. Ingrese solamente la URL de notificación en la sección API REST (TEST o PRODUCTION): Procedimiento.
  2. Analice la IPN: Procedimiento.
Jobs
Legal
GDPR
25.25.0-1.11