# 1) Cotizar
curl -X POST https://api.levapay.dev/test/v1/transfers/quote \
-H "Content-Type: application/json" \
-H "X-Api-User: su_usuario_api" \
-H "X-Api-Key: su_PRIVATE_KEY" \
-d '{"network":"natcash","wallet":"50938123456","amount_htg":5000}'
# 2) Enviar
curl -X POST https://api.levapay.dev/test/v1/transfers \
-H "Content-Type: application/json" \
-H "X-Api-User: su_usuario_api" \
-H "X-Api-Key: su_PRIVATE_KEY" \
-d '{"quote_id":"qt_...","idempotency_key":"orden-10025"}'
<?php
$base = 'https://api.levapay.dev/test/v1';
$headers = [
'Content-Type: application/json',
'X-Api-User: su_usuario_api',
'X-Api-Key: su_PRIVATE_KEY',
];
function levapay(string $url, array $body, array $headers): array {
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => json_encode($body),
CURLOPT_RETURNTRANSFER => true,
]);
return json_decode(curl_exec($ch), true);
}
$quote = levapay("$base/transfers/quote", [
'network' => 'moncash', 'wallet' => '50937123456', 'amount_htg' => 5000,
], $headers);
$transfer = levapay("$base/transfers", [
'quote_id' => $quote['data']['quote_id'],
'idempotency_key' => 'orden-10025',
], $headers);
const base = 'https://api.levapay.dev/test/v1';
const headers = {
'Content-Type': 'application/json',
'X-Api-User': 'su_usuario_api',
'X-Api-Key': process.env.LEVAPAY_KEY,
};
const post = (path, body) =>
fetch(base + path, { method: 'POST', headers, body: JSON.stringify(body) })
.then((r) => r.json());
const quote = await post('/transfers/quote', {
network: 'natcash', wallet: '50938123456', amount_htg: 5000,
});
const transfer = await post('/transfers', {
quote_id: quote.data.quote_id,
idempotency_key: 'orden-10025',
});