Angelito Payments proporciona una API RESTful para gestionar pagos, clientes, suscripciones y webhooks. La API utiliza JSON para solicitudes y respuestas, y se autentica mediante API Keys.
curl -X POST https://payments.angelitosystems.net/api/v1/payments -H "Content-Type: application/json" -H "Authorization: Bearer ask_test_••••••••••••" -H "Idempotency-Key: a1b2c3d4-e5f6-7890-abcd-ef1234567890" -d '{
"application_id": "app_spendly",
"amount": 4990,
"currency": "PEN",
"description": "Plan Pro - Spendly"
}'Base URL
https://payments.angelitosystems.net/api/v1
Autenticación
API Key via header Authorization: Bearer <key>
Todas las solicitudes a la API requieren un header de autorización con tu API Key. Las API Keys pueden ser de tipo TEST o LIVE, con diferentes scopes de acceso.
Importante: Las API Keys TEST solo pueden procesar pagos en modo prueba. Las API Keys LIVE procesan pagos reales.
Angelito Payments opera en dos entornos principales:
Entorno de prueba. Sin cargos reales. Ideal para desarrollo y testing.
Entorno de producción. Procesa pagos reales con proveedores como Culqi.
Para garantizar que las operaciones críticas no se ejecuten múltiples veces, utiliza el header Idempotency-Key con un valor único por solicitud. Si se envía la misma clave dos veces, la segunda solicitud retornará la respuesta original sin re-procesar.
La API retorna respuestas de error consistentes:
{
"statusCode": 400,
"message": "Los datos enviados no son válidos",
"error": "Bad Request",
"request_id": "req_abc123"
}400
Bad Request
401/403
Auth / Forbidden
429/5xx
Rate limit / Server
const response = await fetch('https://payments.angelitosystems.net/api/v1/payments', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': crypto.randomUUID()
},
body: JSON.stringify({
application_id: 'app_spendly',
amount: 4990,
currency: 'PEN',
description: 'Plan Pro'
})
});
const data = await response.json();$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://payments.angelitosystems.net/api/v1/payments');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer YOUR_API_KEY',
'Idempotency-Key: ' . uniqid()
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'application_id' => 'app_spendly',
'amount' => 4990,
'currency' => 'PEN',
'description' => 'Plan Pro'
]));
$response = curl_exec($ch);
curl_close($ch);use IlluminateSupportFacadesHttp;
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . config('services.angelito.key'),
'Idempotency-Key' => Str::uuid()->toString(),
])->post('https://payments.angelitosystems.net/api/v1/payments', [
'application_id' => 'app_spendly',
'amount' => 4990,
'currency' => 'PEN',
'description' => 'Plan Pro',
]);
$payment = $response->json();