Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
SDK oficial para PHP — aceite pagamentos em segundos com uma integração simples
composer config repositories.alpa vcs https://github.com/anthonymengottii/alpa-php-sdk composer require alpa/alpa-php:dev-main
<?php require 'vendor/autoload.php'; use Alpa\AlpaClient; $alpa = new AlpaClient($_ENV['ALPA_API_KEY']);
$link = $alpa->paymentLinks->create([ 'title' => 'Produto Premium', 'amountCents' => 9900, 'description' => 'Acesso vitalício', ]);
[ 'id' => 'lnk_abc123', 'title' => 'Produto Premium', 'description' => 'Acesso vitalício', 'amount' => 9900, 'currency' => 'BRL', 'status' => 'ACTIVE', 'slug' => 'abc123', 'createdAt' => '2026-04-08T00:00:00.000Z', 'updatedAt' => '2026-04-08T00:00:00.000Z', ]
slug
$checkoutUrl = $alpa->paymentLinks->getCheckoutUrl($link['slug']); // https://checkout.usealpa.com/pay/abc123
$tx = $alpa->transactions->create([ 'product' => 'Curso PHP', 'paymentMethod' => 'PIX', 'amountCents' => 19900, 'clientName' => 'João Silva', 'clientEmail' => 'joao@example.com', 'clientDocument' => '12345678900', ]); echo $tx['pixCopiaECola'];
$result = $alpa->coupons->validate('DESCONTO10', 19900); // $result['valid'], $result['discountCents'], $result['finalAmountCents']
<?php $payload = file_get_contents('php://input'); $signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? ''; if (!$alpa->verifyWebhookSignature($payload, $signature, $_ENV['ALPA_WEBHOOK_SECRET'])) { http_response_code(401); exit(json_encode(['error' => 'Assinatura inválida'])); } $event = json_decode($payload, true); echo json_encode(['received' => true]);
<?php use Alpa\Exceptions\AlpaValidationException; use Alpa\Exceptions\AlpaException; try { $tx = $alpa->transactions->create([...]); } catch (AlpaValidationException $e) { echo 'Dados inválidos: ' . $e->getMessage(); } catch (AlpaException $e) { echo 'Erro ' . $e->getStatusCode() . ': ' . $e->getMessage(); }