Contracts: agreements and their evidence
PreviewPut agreements in front of your customers, require them before payment, record acceptances as evidence, and handle withdrawals.
You can put agreements in front of your own customers: a distance sales contract, a pre-information form, terms of service and a privacy notice. Payrudder keeps the texts, shows them where the customer pays, records that a specific text was accepted, and mails the customer a copy.
Payrudder supplies templates and evidence, not legal guarantees. Nothing here says that a text is sufficient in any country, and the starter texts must be reviewed by a lawyer before use. See What was checked, and what was not.
The model
A version is one edition of an agreement in one or more languages (en, tr, de, fr, es, ar). It is immutable: editing a text publishes the next version of its series. A series is a kind and an audience, consumer or business.
A version has a sha256, an author and a time, and is either:
- material: customers who accepted an earlier one are asked again, or
- minor: they are not.
The first version of a series is always material. Publish one with POST /v1/contracts/versions.
A text is restricted markdown: # headings, - bullets, 1. numbered items, **bold**, blank lines between paragraphs. Raw HTML is shown as text.
{{variable}} placeholders come from a fixed list: seller_name, seller_address, seller_tax_id, seller_tax_office, seller_mersis, customer_name, customer_email, customer_address, order_description, order_total, order_currency, date. A text with any other placeholder is refused. Values are escaped when they are printed.
An acceptance is append-only evidence. For each version accepted it records:
- the version and its hash,
- the hash of the text served, the language it was served in and the one that was asked for,
- the words next to the box,
- the context (a hosted invoice, or your own checkout),
- the variables as they were resolved,
- the time, the IP address and the user agent.
observed says which of these Payrudder saw itself and which the seller reported.
The versions accepted together share a group_id and one snapshot: the page they accepted, stored as it was written, with its sha256. The snapshot holds no IP address and no user agent. A PDF copy of it is drawn from the stored page on request (never stored): mailed to the customer with the acceptance, offered on the portal and in the console. A text the PDF font cannot draw (Arabic) has none.
The database refuses updates and deletes of acceptances. A sandbox tenant's rows, and those of a tenant being moved, may be deleted. There is no hash chain.
A seller that starts a digital service at once (immediate_start) asks a consumer for the request to start now and the acknowledgement of losing the right of withdrawal as two separate boxes, never merged with the acceptance of the contract. Each is recorded with its words.
A business customer (customer_type = business) gets the business series when you published one, else the consumer text. A customer of unknown type is treated as a consumer: the consumer's text gives rights a business does not have, never the other way round.
Where it applies
PUT /v1/contracts/settings sets required_kinds. While it is not empty:
| Path | What happens |
|---|---|
POST /v1/subscriptions | refused with plans.contract.not_accepted until the customer has accepted the current version of each required kind. Record it with POST /v1/customers/{external_id}/contract-acceptances; GET /v1/customers/{external_id}/contract-requirements returns the texts to show |
Hosted invoice page, payment link and portal invoice (POST /i/{token}/pay, POST /c/{token}/invoices/{invoice_id}/pay) | the page shows each text the customer has not accepted with an unticked box and a button that says it is an order with an obligation to pay. The server checks the boxes (the page needs no script) and starts nothing without them, or for a text replaced since the page was shown |
| Credit pack purchase, ad-hoc payment link | they end on the same invoice page, so they are covered there; the link's "continue" step takes no money |
A payment link that names its own agreements (required_contracts on POST /v1/payment-links) | see below |
| Renewals, dunning charges | never held back: nobody is present to accept |
Default (not agreed): the link's list replaces your required_kinds for the page of that link (it does not add to it), and an empty or absent list means the setting applies.
- The kinds must be published when the link is made (
plans.contract.kind_unpublished). - Each may be named once (
billing.payment_link.bad_required_contracts). - The invoice link an ad-hoc link hands out when the payer continues carries the list. The same invoice opened by another link or by the portal asks for the setting.
A guest payment (a payment link with no customer) is covered by the invoice it was accepted for.
The hosted pages fail closed: if your agreements cannot be read, or a kind you require has no published version, the page offers no way to pay and a pay request is refused.
List acceptances
GET /v1/customers/{external_id}/contract-acceptances is paged (page_size, default 100, at most 200; next_page_token), newest first. Narrow it by kind, source (api or hosted), version_id and the time of acceptance (from inclusive, to exclusive, RFC 3339).
After the acceptance
The customer is mailed the page they accepted, in their language. It is a system mail that your mail switch does not hold back; a guest has no address and gets none. The mail is sent only when the page fetched has the hash the acceptance holds.
Your webhook endpoints get contract.accepted (one event for the group), contract.version_published and contract.withdrawal_requested. See Webhooks.
Withdrawals
A withdrawal request records a customer's statement: when it reached you, who decided, the outcome. You decide it; Payrudder never refunds from the statement. contract.withdrawal_decided is sent for every decision.
Record the statement
The customer uses the hosted withdrawal function, or your server calls POST /v1/customers/{external_id}/contract-withdrawals and names the invoice with invoice_id.
Decide it
PUT /v1/contract-withdrawals/{id}/status accepts or rejects it, or marks an accepted one refunded. When accepting, refund_amount_minor can ask for less than what is left of the invoice.
Follow the refund
When you accept a withdrawal that names an invoice and the setting withdrawal_refund is full (the default), billing is asked for a credit note that returns the invoice to the card. none leaves the refund to you. POST /v1/contract-withdrawals/{id}/refund asks later, or again after a failure (amount_minor for less than what is left).
The withdrawal's refund_state says what became of the refund:
refund_state | Meaning |
|---|---|
requested | asked for; credit_note_id names the credit note |
refunded | the provider confirmed the refund. Final |
refund_failed | the provider refused it. refund_note says why |
outside | the payment cannot go back through Payrudder (a bank transfer): refund it by hand |
failed | billing refused or did not answer: ask again |
refunded and refund_failed are copied from the credit note's own credit_note.refunded / credit_note.refund_failed events. A repeated or reordered event changes nothing, and the withdrawal's status stays yours to set.
A refund_failed withdrawal is not asked for again: its credit note exists, so the card refund is retried on the credit note, never by a second credit note. The refund is asked for once per withdrawal.
Key permissions
| Action | Permission |
|---|---|
| Record a withdrawal, decide it | customers:write, so a checkout's server can do both |
POST /v1/contract-withdrawals/{id}/refund | invoices:write: the refund is a credit note that returns money to a card |
Accept a withdrawal while withdrawal_refund is full | invoices:write too. A key with customers:write only gets 403 gateway.auth.permission_denied and nothing is decided |
The portal, the withdrawal function and the renewal notice
The portal (/c/{token}) lists what the customer accepted, each with the page they accepted exactly as it was stored. It asks them to accept again when a material version was published since (a customer who accepted something before; nobody is asked on a first visit). Nothing is held back: renewals still charge.
"Withdraw from contract here" is a link on the page of a paid invoice and on the portal, offered to a consumer of a seller that requires agreements. Switch it off with withdrawal_function.
The customer confirms their name and the contract, checks what will be sent, presses "Confirm withdrawal" and is mailed the acknowledgement with what they submitted and when. It records the statement (source hosted, contract.withdrawal_requested); you decide.
- Once per invoice: one open (not rejected) hosted withdrawal is allowed for an invoice, so two presses of the button that race cannot both be recorded or acknowledged; the one that loses is told it was received already. A rejected withdrawal lets the customer try again. What you record through the API or the console is not limited by it (default, not agreed).
- What the customer types (their name, at most 200 characters, and their own words, at most 1000, 2000 bytes in the whole statement) is recorded as one line each. Line breaks, tabs, other control characters and the bidirectional overrides are replaced or dropped, so a typed line cannot pass for a line of the statement ("Your name: Someone Else"). The acknowledgement mail and the pages print it as text, never as markup.
This follows Directive 2011/83/EU art. 11a, applied from 19 June 2026. Which Member State's wording of the labels is enough is not checked.
Mailed once per renewal, renewal_notice_days before it (7 by default, 0 off), to a customer who accepted an agreement. It carries the price of the next period, the date and your own words on how to cancel (renewal_cancel_texts, per language). Only subscriptions whose fee is invoiced in advance have such a date.
Keeping the evidence
retention_months (12 to 120, default 36) is how long the IP address and user agent of an acceptance are kept. A daily job blanks them afterwards and changes nothing else; it is the only thing that ever changes an acceptance. The rest of the record, including the snapshot, stays.
- A sandbox reset deletes the sandbox's acceptances (they name its customers). Live evidence is never deleted.
- Promoting a sandbox to live copies the agreement texts as live's own first versions, and never an acceptance.
What was checked, and what was not
The Turkish Mesafeli Sözleşmeler Yönetmeliği (consolidated text of mevzuat.gov.tr) and the EU Consumer Rights Directive 2011/83/EU with Directive (EU) 2023/2673 (Publications Office) were read, with article numbers and dates, for the structure of the pages and the starter texts.
Not checked: that any text is legally sufficient anywhere, whether Payrudder is an intermediary service provider under the Turkish rules, national transpositions of the EU texts, how long an IP address may be kept under KVKK or the GDPR, auto-renewal rules, and the wording of the box sentences in German, French, Spanish and Arabic.