Join and leave
How a customer joins a shop's thank-you list with Log in with PayPal, what Mend keeps, and how they leave.
Mend pays only customers who chose to join the shop's thank-you list. Joining and leaving both go through Log in with PayPal, on the PayPal sandbox.
The words a customer agrees to
The confirmation page shows the shop's name and this text, version 2026-10-29.1:
<shop name> may look at your past orders with them and send thank-you cashback to this PayPal account. To learn whether it works, a random share of customers is held back each time and gets no cashback that round, and later purchases are counted to measure the result. Thank-you notes are written with AI from the names of items you bought. Mend keeps your PayPal email, its verification status and your PayPal account ID for this. You can leave at any time.Mend stores the version and a SHA-256 hash of the exact text the customer saw with their membership. A member whose wording Mend no longer accepts is not drafted again until they join on the current one.
Joining, step by step
- The shop shares its join link: https://mend-web.onrender.com/api/join/paypal/start?intent=join
- Opening it shows a Mend confirmation page with the shop's name, the words above and one button, Join with PayPal. Nothing has changed and nothing has been sent to PayPal yet. The page cannot be shown inside another site's frame.
- The button posts the form back to the same address. Mend checks that the request came from its own page, that the CSRF token belongs to this browser, and that the hash of the words shown still matches the current wording. A changed wording is refused, never recorded.
- Mend sends the browser to PayPal's sign-in page on
www.sandbox.paypal.comand asks for three scopes: openid, email and paypalattributes. The sign-in state travels in a signed cookie that lasts 10 minutes. - PayPal shows its own consent screen, listing the email, the account's verification status and the payer id.
- PayPal sends the customer back to
/api/join/paypal/callbackwith a one-time code. Mend refuses a missing, edited or expired cookie, or a state that does not match PayPal's, before it calls PayPal at all. - Mend swaps the code for a token, reads the customer's PayPal profile, and keeps only three things: the email, whether PayPal verified it, and the payer id. The token is used inside that one request and never stored or logged.
- The engine checks the consent hash again and records the member with the wording version, the time and the app that recorded it.
The customer then lands on a short Mend page at /join/done that says "You're on the list." If anything stopped the join on the way, such as a changed wording or a sign-in that took longer than 10 minutes, the same page says what happened and what to do next. A script that sends Accept: application/json without text/html gets JSON instead, such as {"outcome":"joined","linked":true}. linked says whether the verified PayPal email matches one customer in the shop's order records. Only a linked member has an order history Mend can rank.
What joining does not do
- It does not give Mend any power over the customer's PayPal account. Mend only reads the profile once.
- Mend pays the PayPal account recorded at joining, never an address from an order record, a note or anything Claude wrote.
- Mend does not email members. The only message they get is the note that comes with their cashback.
Leaving
The leave link is https://mend-web.onrender.com/api/join/paypal/start?intent=leave. The confirmation says "Leave the thank-you list of" the shop, adds that any reward not yet sent is cancelled, and has one button, Leave with PayPal. The customer signs in with PayPal the same way.
- Leaving needs an email PayPal has verified, because an unverified email proves nothing about who owns it.
- Mend finds the member by that email or by their PayPal payer id, so a customer who changed their PayPal email can still leave.
- Leaving deletes the member and, in the same step, cancels every campaign not yet sent that includes them. A cancelled campaign can never be approved or sent.
- The customer lands on the same
/join/donepage, which says "You've left the list." A script that asked for JSON gets{"outcome":"left"}.
The live join, leave and join again were tested on the sandbox on 26 Oct 2026. The audit log showed one member leaving and one open draft that held them cancelled.
Limits
Each address may open the join and leave pages, and come back from PayPal, 20 times a minute, and read the consent words 60 times a minute.
Demo stand-ins
The demo shop's 40 stand-in members were joined by the seed script, not by people. They are marked as stand-ins everywhere in the console, counted apart from people who joined, and can never be joined over or removed through Log in with PayPal.
Take back unclaimed cashback
How Mend asks PayPal to return cashback nobody has claimed, what the answer means, and what happens when PayPal fails on one item.
Architecture
The parts of Mend and where each runs, every PayPal call and who makes it, and three diagrams, of the whole system, of one campaign end to end and of the code modules.