Guides

Task-oriented, end-to-end recipes across VINR products.

View as MarkdownInstall skills

Guides are goal-driven walkthroughs: start to finish, copy-paste runnable, and verified against the sandbox. Each one solves a single real task — accept a payment, meter usage, award loyalty points — without making you stitch the pieces together yourself. For the why behind a feature see the product sections; for field-level detail see the API Reference.

How guides are organizedAsk

Every guide follows the same shape so you always know where to look:

  • Overview — a short diagram or summary of the flow and which systems talk to each other.
  • Steps — numbered, server-first, with runnable @vinr/sdk snippets you can paste into a backend handler.
  • Test it — sandbox cards or fixtures that exercise success and failure paths.
  • Go live — the swap from sandbox to live keys plus the checks that matter in production.
  • Next steps — links to the guides and concepts you'll likely reach for next.

Guides are intentionally narrow. When a topic needs deep explanation (how settlement timing works, what a dispute lifecycle looks like) the guide links out to the relevant concept page instead of repeating it.

Every snippet assumes you've set VINR_SECRET_KEY to a sandbox key. Sandbox calls never move real money and never touch live customer data, so run them freely.

PrerequisitesAsk

Before you start any guide, have the following in place:

Get your API keys

Grab a sandbox secret key from the Dashboard and export it. All server-side calls authenticate with it.

export VINR_SECRET_KEY=sk_sandbox_...

See Authentication for key types, rotation, and scoping.

Install the SDK

The TypeScript SDK wraps the REST API and ships typed models for every resource.

npm install @vinr/sdk
import { Vinr } from '@vinr/sdk';

const vinr = new Vinr({ secretKey: process.env.VINR_SECRET_KEY });

Be able to receive webhooks

Most guides fulfil work on a webhook, not on a redirect. Expose a public URL (use a tunnel like ngrok in development) and verify every payload:

const event = vinr.webhooks.verify(
  await req.text(),
  req.headers.get('x-vinr-signature'),
);

See Webhooks for endpoint registration and the event catalog.

Prefer raw REST? Every SDK call maps to https://sandbox.api.vinr.com with an X-Api-Key: <key> header. Amounts are always integers in minor units — 1000 means EUR 10.00.

Browse by productAsk

Pick the pillar that matches what you're building. Each guide is self-contained and runnable.

Payments

Accept money, handle SCA, and reconcile the result.

Billing

Sell subscriptions, meter usage, and collect on invoices.

Engagement

Reward customers and tie loyalty to real transactions.

A guide at a glanceAsk

To see the pattern before you commit, here's the shape almost every guide shares — create a resource server-side with an idempotency key, then react to the authoritative webhook:

// 1. create (idempotent — safe to retry)
const payment = await vinr.payments.create(
  { amount: 2500, currency: 'EUR', metadata: { orderId: 'A-1' } },
  { idempotencyKey: 'order-A-1' },
);

// 2. fulfil on the verified event, never on the redirect
function onEvent(event) {
  if (event.type === 'payment.completed') {
    fulfill(event.data.metadata.orderId); // runs exactly once
  }
}

If you internalize that pattern, every guide on this site will feel familiar.

Next stepsAsk

Was this page helpful?
Edit on GitHub

Last updated on

On this page