Códigos de Barra o Insertados
2 min
Generar imagen de código de barras
Esta API te permite generar un código de barras 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}&expiration={expiration}
Path Parameters
- codestringrequiredDescription
Query Parameters
- referencestringrequiredDescription
- totalNumberrequiredDescription
- expirationstringDescription
- emailstringDescription
- surchargeDaysIntegerDescription
- surchargeTotalNumberDescription
curl
curl --location --request GET 'https://api.mobbex.com/p/payment_code/gen/HyPoGfFxf?reference=0001-00000002&total=100&expiration=31-12-2017&surchargeDays=5&surchargeTotal=50'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&expiration=31-12-2017&surchargeDays=5&surchargeTotal=50");
xhr.send();200
Descripción del Ejemplo:
- Referencia (Factura): 0001-00000002
- Vencimiento: 31-12-2017
- Total: 100.00
- Recargo: 50 pesos a los 5 dias del vencimiento
Generar código de barras
Esta API te permite generar un código de barras para pagos en efectivo de tus productos o servicios. 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
- totalNumberrequiredDescription
- referencestringrequiredDescription
- sourceReferencestringrequiredDescription
- expirationStringDescription
- emailstringDescription
- surchargeDaysIntegerDescription
- surchargeTotalstringDescription
- webhookstringDescription
csharp
var client = new RestClient("https://api.mobbex.com/p/payment_code");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj");
request.AddHeader("x-access-token", "d31f0721-2f85-44e7-bcc6-15e19d1a53cc");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@" ""total"": 100,
" + "\n" +
@" ""reference"": ""060820211629"",
" + "\n" +
@" ""sourceReference"": ""arg_mobbex_cash""
" + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);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_mobbex_cash"
});
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_mobbex_cash"
}',
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
{
"uid": "_L5O3yt1h",
"status": {
"code": "2",
"text": "En Espera",
"message": "El cupón vence el día 8/08.",
"data": {},
"view": "default"
},
"barcode": "04473704250942108080010000000000000000000000515003571355",
"barcodeOptions": {
"bcid": "interleaved2of5",
"includetext": "1",
"textxalign": "center",
"textsize": "11"
}
}404
{
"message": "Ain't no cake like that."
}