Payment links
A payment link is a URL anyone can pay. Create it with the API or in the dashboard, then
send it by email, chat or QR code. Each payment through it is an ordinary payment, with
payment_link set.
import osfrom tuppence import Tuppence
tuppence = Tuppence(os.environ["TUPPENCE_SECRET_KEY"])
# A fixed price, payable once.report = tuppence.payment_links.create(name="Research report", amount=2000, currency="gbp")
# A tip jar: the payer chooses between £1 and £50, and it can be paid again and again.tips = tuppence.payment_links.create( name="Tip jar", currency="gbp", min_amount=100, max_amount=5000, reusable=True)
print(report.url, report.amount_type) # … fixedprint(tips.url, tips.amount_type) # … customer_chooses
# Found by the start of its name, later.print([link.name for link in tuppence.payment_links.list(query="tip").data])Options
Section titled “Options”| Field | |
|---|---|
amount |
A fixed amount. Leave it out to let the payer choose… |
min_amount, max_amount |
…within these bounds (enforced on our side, not the page’s) |
reusable |
true to take many payments; otherwise it completes after one |
max_payments |
For a reusable link: stop after this many |
expires_at |
Unix seconds; after it the link refuses payments |
completion_message, redirect_url |
What the payer sees after paying |
metadata |
Up to 50 keys of your own, copied onto each payment |
Share it
Section titled “Share it”url— the pay page, branded with your business name, logo and colour (Settings → Branding).GET /v1/payment_links/{id}/qr— an SVG QR code (?format=png&size=512for a PNG).
Stop it
Section titled “Stop it”POST /v1/payment_links/{id}/expire archives a link: it takes no more payments. Payments already
made are untouched. You are told — payment_link.completed — when a single-use or max_payments
link has done its job.