Skip to content

SDKs

There are three official clients, in Go, Node and Python. All three do the same things:

  1. Authenticate with your key.
  2. The contract, typed: types, enums and routes are generated from this same OpenAPI, so they cannot drift from the API.
  3. Idempotency and safe retries: every create carries an Idempotency-Key (yours, or one the SDK generates, reuses on every retry and returns to you), and the SDK only retries what cannot move money twice.
  4. Webhook signature verification, in constant time, with a clock window and over the raw body.

None of them has dependencies outside its language’s standard library.

By default they talk to production (https://api.tucapi.app). For the sandbox pass the base URL https://api.tucapi.app/sandbox with your test key: tucapi.New("tuc_test_...", tucapi.WithBaseURL("https://api.tucapi.app/sandbox")), new TuCapi('tuc_test_...', { baseUrl: 'https://api.tucapi.app/sandbox' }), TuCapi("tuc_test_...", base_url="https://api.tucapi.app/sandbox").

Package Install Client
Go github.com/Yhonnyj/pagos-sdk-go/v2 go get github.com/Yhonnyj/pagos-sdk-go/v2 tucapi.New("tuc_live_...")
Node tucapi (npm) npm install tucapi new TuCapi('tuc_live_...')
Python tucapi (PyPI) pip install tucapi TuCapi("tuc_live_...")
Operation Go Node Python
GET /v2/balances c.Balances.List(ctx, …) c.balances.list(…) c.balances.list(…)
GET /v2/banks c.Banks.List(ctx, …) c.banks.list(…) c.banks.list(…)
GET /v2/capabilities c.Capabilities.Get(ctx, …) c.capabilities.get(…) c.capabilities.get(…)
GET /v2/events c.Events.List(ctx, …) c.events.list(…) c.events.list(…)
GET /v2/methods c.Methods.List(ctx, …) c.methods.list(…) c.methods.list(…)
POST /v2/payins c.Payins.Create(ctx, …) c.payins.create(…) c.payins.create(…)
GET /v2/payins/{id} c.Payins.Get(ctx, …) c.payins.get(…) c.payins.get(…)
POST /v2/payins/{id}/cancel c.Payins.Cancel(ctx, …) c.payins.cancel(…) c.payins.cancel(…)
POST /v2/payins/{id}/confirm c.Payins.Confirm(ctx, …) c.payins.confirm(…) c.payins.confirm(…)
POST /v2/payins/{id}/resend-code c.Payins.ResendCode(ctx, …) c.payins.resendCode(…) c.payins.resend_code(…)
POST /v2/payouts c.Payouts.Create(ctx, …) c.payouts.create(…) c.payouts.create(…)
GET /v2/payouts/{id} c.Payouts.Get(ctx, …) c.payouts.get(…) c.payouts.get(…)
POST /v2/payouts/{id}/cancel c.Payouts.Cancel(ctx, …) c.payouts.cancel(…) c.payouts.cancel(…)
GET /v2/transactions/{id} c.Transactions.Get(ctx, …) c.transactions.get(…) c.transactions.get(…)
POST /v2/webhook-endpoints c.WebhookEndpoints.Create(ctx, …) c.webhookEndpoints.create(…) c.webhook_endpoints.create(…)
Go
c := tucapi.New("tuc_live_...")
created, err := c.Payouts.Create(ctx, tucapi.NewPayout{
Country: "VE", Currency: "VES", Method: tucapi.MethodCodeMobilePayment, Amount: "1500.50",
Beneficiary: tucapi.Beneficiary{Name: "Ana Pérez", Document: &tucapi.Document{Type: "V", Number: "12345678"},
BankCode: "0102", AccountNumber: "04121234567"},
}, tucapi.WithIdempotencyKey("order-4821"))
// created.IdempotencyKey is the key that was sent
Node
const c = new TuCapi('tuc_live_...')
const created = await c.payouts.create(
{ country: 'VE', currency: 'VES', method: 'mobile_payment', amount: '1500.50',
beneficiary: { name: 'Ana Pérez', document: { type: 'V', number: '12345678' }, bank_code: '0102', account_number: '04121234567' } },
{ idempotencyKey: 'order-4821' },
)
// created.idempotencyKey is the key that was sent
Python
c = TuCapi("tuc_live_...")
created = c.payouts.create(
{"country": "VE", "currency": "VES", "method": "mobile_payment", "amount": "1500.50",
"beneficiary": {"name": "Ana Pérez", "document": {"type": "V", "number": "12345678"},
"bank_code": "0102", "account_number": "04121234567"}},
idempotency_key="order-4821",
)
# created["idempotency_key"] is the key that was sent
Go Node Python
Verify and read a notification tucapi.ParseEvent(r, secret) parseEvent(rawBody, req.headers, secret) parse_event(raw_body, headers, secret)
On bytes already read tucapi.VerifyEvent(body, sig, ts, secret) verifyEvent(body, sig, ts, secret) verify_event(body, sig, ts, secret)
If it doesn’t verify tucapi.ErrInvalidSignature SignatureError SignatureError