YooBankDocumentação pública

Exemplos de integração

Placeholders apenas. Não chamam produção nestes ficheiros.

cURL — criar PAY-IN

curl -sS -X POST "https://api.yoobank.net/api/v1/merchants/${YOOBANK_MERCHANT_UUID}/pay-in-intents" \
  -H "Authorization: Bearer ${YOOBANK_API_TOKEN}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${YOOBANK_IDEMPOTENCY_KEY}" \
  --max-time 30 \
  -d '{
    "asset": "usdt",
    "amount": "10.50",
    "jurisdiction": "BR",
    "expires_at": "2026-12-31T23:59:59+00:00",
    "reference": "order-12345"
  }'

cURL — ler PAY-IN

curl -sS "https://api.yoobank.net/api/v1/merchants/${YOOBANK_MERCHANT_UUID}/pay-in-intents/${YOOBANK_INTENT_UUID}" \
  -H "Authorization: Bearer ${YOOBANK_API_TOKEN}" \
  --max-time 15

PHP 8.x — criar PAY-IN

Ficheiro executável de referência: examples/create-payin.php

Usa Bearer, JSON, timeouts, strings decimais, Idempotency-Key, reference, e trata status HTTP. Credencial só via getenv.

PHP 8.x — webhook

Ficheiro: examples/webhook.php

php://input, headers canónicos, HMAC-SHA256, hash_equals, JSON só depois da verificação, idempotência conceptual por intent_uuid. Sem tabela obrigatória e sem SQL.

Node.js (opcional)

const token = process.env.YOOBANK_API_TOKEN;
const merchant = process.env.YOOBANK_MERCHANT_UUID;
const idempotencyKey = process.env.YOOBANK_IDEMPOTENCY_KEY;

const response = await fetch(
  `https://api.yoobank.net/api/v1/merchants/${merchant}/pay-in-intents`,
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${token}`,
      'Content-Type': 'application/json',
      'Idempotency-Key': idempotencyKey,
    },
    body: JSON.stringify({
      asset: 'usdt',
      amount: '10.50',
      jurisdiction: 'BR',
      expires_at: '2026-12-31T23:59:59+00:00',
      reference: 'order-12345',
    }),
  },
);
const body = await response.text();
if (!response.ok) {
  throw new Error(`HTTP ${response.status}: ${body}`);
}

Python (opcional)

import json
import os
import urllib.request

token = os.environ["YOOBANK_API_TOKEN"]
merchant = os.environ["YOOBANK_MERCHANT_UUID"]
payload = {
    "asset": "usdt",
    "amount": "10.50",
    "jurisdiction": "BR",
    "expires_at": "2026-12-31T23:59:59+00:00",
    "reference": "order-12345",
}
request = urllib.request.Request(
    f"https://api.yoobank.net/api/v1/merchants/{merchant}/pay-in-intents",
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
    headers={
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json",
        "Idempotency-Key": os.environ["YOOBANK_IDEMPOTENCY_KEY"],
    },
)
with urllib.request.urlopen(request, timeout=30) as response:
    print(response.read().decode("utf-8"))