Package
@yativo/fiat-sdkRequires
Node.js 18 or newer (works with TypeScript, ES modules and CommonJS)
Source
Yativo/yativo-fiat-node
Install
Configure
You need an API key with your server’s IP address on its IP whitelist. Put the key and secret in environment variables, never in code:.env
node --env-file=.env app.mjs. On older versions, use the dotenv package or export the variables in your shell.
The client reads these variables automatically. You can also pass them yourself:
Make your first request
first-request.mjs
Key check: pass and your balances. pass means the key works from this server.
Accept a payment
A deposit gives your customer a hosted page to pay with a local method. You’re credited in the wallet you choose.1
Find a payment method
List the methods for your customer’s country (three-letter code) and currency. The method’s
id is the deposit’s gateway.2
Create the deposit
amount is in the method’s currency. currency is the wallet you’re credited in: one of the method’s base_currency values. Send your order ID as the idempotency key so a retry never creates a second deposit.3
Confirm before you fulfil
When the customer comes back, or a
deposit.updated webhook arrives, read the deposit from the API. A redirect back to your site isn’t proof of payment.status is pending, processing, success, failed, cancelled or expired.
Handle webhooks
Register your URL once and store the secret it returns asYATIVO_WEBHOOK_SECRET. Your account has one webhook URL.
Signature header against the raw body and routes each event to your code. It answers 200 when your code succeeds, 401 for a bad signature and 500 when your code fails, so Yativo retries.
Card Checkout
Card Checkout gives your buyer a hosted page to pay by card, Apple Pay or Google Pay. Your account needs Card Checkout access, and the selling customer needs an approvedcard_checkout endorsement.
card_checkout.order.paid webhook, confirmed by reading the order. The link works for 60 minutes.
Send a payout
payout.updated webhook. See Payouts.
Everyday tasks
Every endpoint is wrapped. The full method list is in docs/REFERENCE.md. To call an endpoint the SDK doesn’t wrap yet, with the same authentication and retries:
Errors
BadRequestError (400), AuthenticationError (401), PermissionDeniedError (403), NotFoundError (404), ConflictError (409), ValidationError (422), RateLimitError (429), APIError (5xx) and APIConnectionError (no answer). They all extend YativoError and have status, code, message and fields.
Network errors, 429 and 5xx are retried twice with backoff, using the same idempotency key. Other errors are never retried. See Troubleshooting for what each common error means.
Pagination
Options
Test in sandbox
Use sandbox keys withYATIVO_ENVIRONMENT=sandbox. No real money moves. Card Checkout test cards: 4242 4242 4242 4242 succeeds and 4000 0000 0000 0002 is declined, with any future expiry and any CVC. Send yourself sample webhooks:
More
Runnable examples
A quick start, a complete checkout server with webhooks, and card payments.
Every method
All endpoints as Node.js / TypeScript calls.

