QR Dinámico
1 min
En cualquiera de los métodos utilizados para generar el código QR, se debe tener en cuenta que el mismo tiene una validez máxima de 10 minutos desde que es generado.
Generar imagen de código de pago QR
Esta API te permite generar un código QR para cobrar tus productos o servicios e insertarlos en una aplicación propia. El retorno de la misma es una imagen de código pregenerada.
GET
https://api.mobbex.com/p/payment_code/gen/{code}?reference={reference}&total={total}
Path Parameters
- codestringrequiredDescription
Query Parameters
- referencestringrequiredDescription
- totalNumberrequiredDescription
curl
curl --location --request GET 'https://api.mobbex.com/p/payment_code/gen/HyPoGfFxf?reference=0001-00000002&total=100'javascript
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.mobbex.com/p/payment_code/gen/HyPoGfFxf?reference=0001-00000002&total=100");
xhr.send();200
404
{
"message": "Ain't no cake like that."
}
Generar Código QR
Esta API te permite generar un código QR para pagos de tus productos o servicios a través de una billetera virtual. El retorno es un objeto con toda la información sobre el código generado.
POST
https://api.mobbex.com/p/payment_code/
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
Body Parameters
- totalstringrequiredDescription
- referencestringrequiredDescription
- sourceReferencestringrequiredDescription
- webhookstringDescription
- emailstringDescription
javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
myHeaders.append("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"total": 100,
"reference": "060820211629",
"sourceReference": "arg.qr.prisma"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.mobbex.com/p/payment_code", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.mobbex.com/p/payment_code',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"total": 100,
"reference": "060820211629",
"sourceReference": "arg.qr.prisma"
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',
'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;200
404
{
"message": "Ain't no cake like that."
}