13 of 300

Navigation 13

Documentation with "On this page"

Three columns: sections on the left, text in the middle and the page contents on the right. The marker on the right shows exactly the headings on screen right now.

Known from documentation sites like Stripe and Tailwind

Tender docsSearch the docs⌘K
On this page: Before you start
Payments

Accept a payment

Create a payment on the server, confirm it in the browser, and get notified when the money is on its way.

Before you start

You need a test key from your dashboard and one of our server libraries. All examples use test mode, so nothing is charged.

npm install tender

Create a payment

A payment describes how much you want to charge and in which currency. It is stored on the server so the amount cannot be changed from the browser.

const payment = await tender.payments.create({ amount: 2000, currency: 'usd', });
Amount and currency

Amounts are in cents, so 2000 is 20 dollars. The currency must match the account the money is paid out to.

Metadata

Store your own order number in metadata so you can find the payment again when the webhook arrives.

Confirm the payment

Send the payment’s secret to the browser and confirm it there. If the bank requires extra authentication, we show it automatically.

Always confirm the payment in the browser. Card details must never pass through your own server.

Handle webhooks

When the payment succeeds, we send an event to your endpoint. Reply quickly with 200 and do the heavy work afterwards.

Verify the signature

Every event is signed. Check the signature before you trust the contents.

Test your integration

Use the test cards to try both successful and declined payments, and check that your webhook handles both.

When everything works, swap the test key for your live key. Nothing else needs to change.

  • A window, not a pointThe line on the right covers every heading on screen, and grows or shrinks as you scroll.
  • The highlight glidesWhen you pick a new page in the left column, the highlight glides there instead of jumping.
  • Groups that foldEach topic can be collapsed, so long sidebars stay manageable.