1. Introduction
This service facilitates the creation of QR code images. It can be used to render a URL that we want to encode or a dynamic QR to generate a charge.
2. Use
2.1. Rendering a QR code
Method: GET
URL: {endpoint}/api/v2/qr/render
| Field | Required | Options | Default value | Type |
content |
Yes | null |
URL |
|
output |
No | svg, png, base64 |
svg |
String |
lang |
No | en,es |
null |
String |
- content: It must be a valid URL and be URLEncoded.
- output: If you send the output parameter as
base64you will get a response from the server inJSONformat, otherwise you will get the image insvgopngformat depending on what you choose. - lang: If you send the
langparameter a frame will be added to the image and below the QR image will appear the word SCAN ME if sentenor SCAN ME if sentes.
Example:
https://{endpoint}/api/v2/qr/render?content=https://google.com&lang=es&output=base64
Base64 request response:
{
"success": true,
"message": "Successfully obtained information",
"data": {
"url": "https://google.com",
"base64": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvb..."
}
}
Answer fields
| Campo | Tipo | Descripción |
success |
Boolean | This field is true when the transaction was successful |
message |
String | Message with success confirmation |
data |
Object | QR Code information container |
url |
String | URL encoded |
base64 |
String |
Image in base64 |
2.2. Dynamic QR Code
Method: GET
URL: {endpoint}/api/v2/qr/generate
2.2.1. Use of keys
In order to generate dynamic QR images it is necessary to have the trade keys to be used in the headers of the request, along with the Accept: Application/json it is important that the Secret Key is not shared as shown in the application, as it may be exposed. The key must be prepared with MD5 in order to be used.
Online MD5 HASH Generator: https://www.md5hashgenerator.com/
Headers
Accept: application/json
x-auth-key: 12345678
x-auth-hash: 8e68546db84c4aa7988085b6e0fa944c // MD5 del secret Key
Parameters
| Field | Required | Validations | Type |
amount |
Yes | Float | |
tax_amount |
No | Float | |
order_id |
No | Max. 50 characters | String |
order_description |
No |
Max. 120 characters | String |
order_reference |
No | Max. 120 characters | String |
- amount: Amount to collect.
- tax_amount: Tax value.
- order_id: Order number. If not sent the order_id is auto-generated by the Pixel platform.
- order_description: Order description. If not sent the order_description is auto-generated by the PixelPay platform.
- order_reference: Reference of the purchase (useful for commerce). This value is returned in the Webhook extras field.
2.2.2. Webhook Configuration
Within the PixelPay platform we must go to Preferences > API Options and activate the Enable Webhook switch and place the URL to which the request will be made in the Success URL field.
Image 1: Activate Webhook.
Example:
https://{endpoint}/api/v2/qr/generate?tax_amount=10&order_
id=1001&order_description=Pago generado con QR&order_reference=
Cobro de prueba&amount=155
Response:
@return {
"success": true,
"message": "Successfully obtained information",
"data": {
"url": 'https://endpoint.app/company/qr/a8Zux99kmGuylmmSl+KyxJzSUJfJocmpkZrRWMfV0oOJtbKn0pOlolbJnoLW2NfIl8SsYQ==',
"base64": 'data:image/svg+xml;base64,...'
}
}
Comments
0 comments
Please sign in to leave a comment.