Creating a payment order by QR Code
Use cases
The merchant creates a QR Code payment order and a payment link. The message is sent by the merchant.
Request
Payment with a QR Code
Sample query
Required fields:
- Amount: €100,00.
- Distribution channel: URL.
. Recommended fields:
- Référence de la commande : "myOrderId-1234".
- QR code: 250 px.
/en-EN/rest/V4.0/api/kb/authentication.html
https://github.com/lyra/rest-php-examples/blob/master/www/minimalEmbeddedForm.php#L9-L44
https://api.lyra.com/api-payment/V4/Charge/CreatePaymentOrder
{ "amount": 10000, "currency": "EUR", "orderId": "myOrderId-1234", "channelOptions": { "channelType": "URL", "urlOptions": { "generateQRCode" : "true", "qrCodeSize" : 250 } } }
PARAMETER | required | Description |
---|---|---|
channelOptions.urlOptions.generateQRCode | YES | Parameter to generate a QR Code (Can take the valuetrue orfalse ). |
channelOptions.urlOptions.qrCodeSize | No | Parameter allowing you to define the size of the QR Code in pixels (value between 50 and 400). Defaults to 100. |
Response
Example of a response
Récupérez dans l'objet Answer la valeur de channelDetails.urlDetails.qrCode
correspondant à une image encodée en base64.
(..) "channelDetails": { "channelType": "URL", (..) "urlDetails": { "qrCode": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AQAAAACgl2eQAAABZklEQVR4Xu2XUYrDMAxEBTlAjpSr+0g5gMGrp2lK4y79zoAHEWzl/UwlOW6M32oxZyYtQFqAtABpAdJzgB4od4ot06ndDWDdxnlUxAampBfQYm+Z2YaipXFTID32OPDrD2Qey5YAS3Y7I/NfyzkATHv6au9g7wZIvQbnXSbJCCBZvvKVLFftzACYtHYeUYPTNUT3Yj0f6DUsGToESHMg+AFpcDspWX4Wq1i0nx1A7DilTOk6C3e3aQHIZgEyO7fc84FR1xKqQ7/BTzYtAM1+ftmT2YrJ563lPIBWlYK8SjbZNABeWwb/gI+g8dwA2ewcv417b/Hfv8PDARnsdZRRrJPx/2w5CwCbuWRweHKklUcvQBLWdd26f9wtgI6xmpTrfpKN5wewJpltJrLXvdENKGtEvQpazhQYeMy3B4up5XyA64lTSD+Apcr0Opbr760ZEKiSLRj8r/F3AH5oAdICpAVIC5A8gD9G7EWe3QLtLAAAAABJRU5ErkJggg==", "_type": "V4/URLDetails" }, }
Insérez cette donnée dans une balise img
.
<div> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AQAAAACgl2eQAAABZklEQVR4Xu2XUYrDMAxEBTlAjpSr+0g5gMGrp2lK4y79zoAHEWzl/UwlOW6M32oxZyYtQFqAtABpAdJzgB4od4ot06ndDWDdxnlUxAampBfQYm+Z2YaipXFTID32OPDrD2Qey5YAS3Y7I/NfyzkATHv6au9g7wZIvQbnXSbJCCBZvvKVLFftzACYtHYeUYPTNUT3Yj0f6DUsGToESHMg+AFpcDspWX4Wq1i0nx1A7DilTOk6C3e3aQHIZgEyO7fc84FR1xKqQ7/BTzYtAM1+ftmT2YrJ563lPIBWlYK8SjbZNABeWwb/gI+g8dwA2ewcv417b/Hfv8PDARnsdZRRrJPx/2w5CwCbuWRweHKklUcvQBLWdd26f9wtgI6xmpTrfpKN5wewJpltJrLXvdENKGtEvQpazhQYeMy3B4up5XyA64lTSD+Apcr0Opbr760ZEKiSLRj8r/F3AH5oAdICpAVIC5A8gD9G7EWe3QLtLAAAAABJRU5ErkJggg==" alt="QR Code"> </div>
The payment link can be sent using thepaymentURL
field of the objectAnswer.
View the description and all the other fields in our playground:PaymentOrder
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_856 | The locale parameter is invalid. |
INT_858 | The taxRate parameter is invalid. |
INT_869 | The taxAmount parameter is invalid. |
INT_936 | . |
PSP_519 | Unknown currency. |
PSP_606 | Currency not supported by the MID. |
PSP_1007 | The expiry date of the payment order cannot be earlier than the current date or exceed 90 days. |
PSP_1015 | No data collection form for this shop. |
PSP_1018 | The data collection form cannot be used for the requested currency. |
Analysis of payment results
To know the payment result, implement the instant payment notification (also known as IPN).