Integre Throne em 1 linha. Idempotência, retry exponencial e webhook signature verification embutidos · você só foca no negócio.
Mantidos pelo time core. Testes E2E rodam em CI · atualização sincronizada com release da API. Recomendados pra produção.
composer require throne/sdk-phpnpm install @throne/sdkanypip install throne-sdkgo get github.com/throne-gateway/sdk-gogem install throne-sdkimplementation 'com.throne:sdk:1.0'dotnet add package Throne.SDKImportar de https://api.thronecorporate.com/docs/postmanO que cada SDK oferece. Use pra decidir qual stack adotar.
| Feature | PHP | Node.js | Python | Go | Ruby | Java |
|---|---|---|---|---|---|---|
| Idempotency-Key automático | ✓ | ✓ | ✓ | ○ | ○ | ○ |
| Retry exponencial built-in | ✓ | ✓ | ✓ | ○ | ○ | ○ |
| Webhook signature verifier | ✓ | ✓ | ✓ | ○ | ○ | ○ |
| Type-safety | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Framework integration | Laravel | Express/Fastify | FastAPI/Django | net/http | Rails | Spring Boot |
| Async support | N/A | async/await | asyncio | context | sync | CompletableFuture |
| Status | Production | Production | Beta | Alpha | Roadmap | Planned |
Criar transação PIX, escutar webhook e processar paid → 25 linhas.
use Throne\SDK\ThroneClient; use Throne\SDK\Webhooks\Verifier; // Init · pk_live/sk_live ou pk_test/sk_test do env $throne = new ThroneClient(env('THRONE_PK'), env('THRONE_SK')); // Criar cobrança PIX · idempotency automático $tx = $throne->transactions->create([ 'amount_cents' => 9900, 'payment_method' => 'pix', 'customer' => ['email' => 'cliente@example.com'], 'metadata' => ['order_id' => 'PED-42'], ]); echo $tx->payment_data->qr_code_payload; // Handler webhook · assinatura verificada antes de processar Route::post('/throne/webhook', function (Request $req) use ($throne) { $event = Verifier::verify( payload: $req->getContent(), signature: $req->header('X-Throne-Signature'), secret: env('THRONE_WEBHOOK_SECRET'), ); if ($event->type === 'transaction.paid') { Order::where('id', $event->data->metadata->order_id)->update(['paid' => true]); } return response('OK', 200); });
Mesma transação acima · com TypeScript types completos.
import { ThroneClient, verifyWebhook } from '@throne/sdk'; import express from 'express'; const throne = new ThroneClient({ publicKey: process.env.THRONE_PK!, secretKey: process.env.THRONE_SK!, }); const app = express(); app.use(express.raw({ type: 'application/json' })); // Criar cobrança PIX app.post('/checkout', async (req, res) => { const tx = await throne.transactions.create({ amount_cents: 9900, payment_method: 'pix', customer: { email: 'cliente@example.com' }, metadata: { order_id: 'PED-42' }, }); res.json({ qr: tx.payment_data.qr_code_payload }); }); // Webhook handler app.post('/throne/webhook', (req, res) => { const event = verifyWebhook({ payload: req.body, signature: req.headers['x-throne-signature'] as string, secret: process.env.THRONE_WEBHOOK_SECRET!, }); if (event.type === 'transaction.paid') { // Type-safe: event.data tem shape WebhookTransactionPaid db.orders.update({ id: event.data.metadata.order_id }, { paid: true }); } res.status(200).send('OK'); });
Pydantic models · type hints · FastAPI integrado.
from throne_sdk import ThroneClient, verify_webhook from fastapi import FastAPI, Request, HTTPException import os throne = ThroneClient( public_key=os.environ['THRONE_PK'], secret_key=os.environ['THRONE_SK'], ) app = FastAPI() @app.post('/checkout') async def checkout(): tx = await throne.transactions.create( amount_cents=9900, payment_method='pix', customer={'email': 'cliente@example.com'}, metadata={'order_id': 'PED-42'}, ) return {'qr': tx.payment_data.qr_code_payload} @app.post('/throne/webhook') async def webhook(req: Request): payload = await req.body() try: event = verify_webhook( payload=payload, signature=req.headers.get('X-Throne-Signature'), secret=os.environ['THRONE_WEBHOOK_SECRET'], ) except ValueError: raise HTTPException(401, 'invalid_signature') if event.type == 'transaction.paid': # Pydantic model: event.data tipado order_id = event.data.metadata['order_id'] await mark_paid(order_id) return {'ok': True}
Use HTTP direto · 7 langs de exemplo no quickstart. Ou contribua: PRs welcome no monorepo SDKs.
Gere sua API key e teste o sandbox em 60 segundos.
Começar agora →