Payment links
A link you share (chat, email, social, a QR code) that takes a payment on a Watenga page.
A link has a fixed amount, or none (the customer chooses: donations, tips). It can expire, stop after a number of uses, and carry your metadata into every payment made with it.
Keys and scopes
payment_links scope (read to list, write to create and change).Create a link
Share link.url. Leave out amount for a pay-what-you-want link.
const link = await watenga.paymentLinks.create({
title: 'Lunch box',
amount: '12.50',
currency: 'USD',
max_uses: 100,
metadata: { campaign: 'october' },
});
console.log(link.url);Change, list and switch off
Changes apply to new payments; every change is kept in the link’s history (versions). Switching a link off keeps its payments.
await watenga.paymentLinks.update(link.id, { amount: '14.00' });
for await (const l of watenga.paymentLinks.listAll({ is_active: true })) console.log(l.slug, l.use_count);
await watenga.paymentLinks.deactivate(link.id);Webhook events
| Event | When |
|---|---|
payment.capture.completed | Someone paid with the link (the link’s metadata is on the transaction) |
Each event carries the object in data.object; verify the signature first (Webhooks).
Test it
Use a test secret key (sk_test_…): it never moves money. Pay with the test cards and wallet numbers, and receive the webhooks on your machine with watenga listen --forward-to http://localhost:3000/webhooks (CLI).
Related: Hosted checkout · Pagination