-
-
The AI shopkeeper called create_bill. The server priced the order from a fixed list; the ticket shows PayPal buttons (sandbox).
-
Paid with a PayPal sandbox test card. The ticket gets its PAGADO stamp and the shopkeeper thanks the customer in Spanish.
-
Progress page: Mi Español Plus subscribed through PayPal Subscriptions (sandbox), with a cancel button.
-
AI partner. The learner wrote "un camiseta"; the correction card shows "una camiseta" and the reason in Chinese.
Inspiration
Self-taught Spanish learners in Taiwan can find flashcards, grammar notes and videos. What they cannot find is someone to talk to: someone who waits while they type a sentence, answers at their level, and explains the mistake in Chinese. A private tutor could do that, but a tutor is paid by the hour.
I am learning Spanish myself. Before this build I made Mi Español, a free site with a five-minute daily routine. All of its checking is rule-based. It knows whether a fill-in answer is right, but it cannot hold a conversation. For the hackathon I added the conversation, and one of the first real things a learner has to do in Spanish abroad: pay.
What was there before October 1
Mi Español was already live before October 1, with dialogue practice in 7 everyday scenes, spaced-repetition flashcards, listening and speaking practice, and progress tracking. It had no AI and no payments.
In early October, on the original site and not for this hackathon, I added the daily five-minute routine (October 6), seven more scenes for 14 in total (October 9), and fill-in items and A2 flashcards with example sentences from Tatoeba (October 6–11). Everything in the next section was built for the hackathon, from October 19, 2026.
What it does
- AI partner (Claude Haiku 5.5). A fourth mode in the conversation tab. Pick one of the 14 scenes and talk freely. The model plays the other person in simple Latin American (Mexican) Spanish and gives a Traditional Chinese translation of each reply. When the learner makes a real mistake, a card under their message shows the corrected sentence and a one-line reason in Chinese. Corrections go into the existing mistake book for later review.
- Mi Español Plus (PayPal Subscriptions). Free learners get 3 AI conversations a day, 20 turns each. Plus costs NT$60 a month and allows up to 200 turns a day. Learners subscribe and cancel on the progress page.
- Pay in Spanish (PayPal Orders, agentic). In three shop scenes (clothes shop, café, market), the AI shopkeeper takes the order in Spanish. When the customer is done, the model calls a
create_billtool. The server turns that call into a PayPal order from a fixed price list, and the page prints a ticket with a PayPal button. After payment, the shopkeeper thanks the customer in Spanish and the ticket gets a PAGADO stamp.
How I built it
- The page is the existing single static file: HTML, CSS and plain JavaScript, no framework.
- The back end is Vercel functions in Node. The new ones are tutor, checkout, plus and config.
- Claude Haiku 5.5 runs through the Anthropic Messages API with a JSON schema for every reply, low effort, and one tool,
create_bill. - PayPal Orders v2 creates and captures shop bills. PayPal Subscriptions v1 handles Plus. The PayPal JS SDK draws both buttons, including the card button.
- Upstash Redis stores quotas, subscriptions and bills.
- A script copies the 14 scenes from the page into the server, so the AI can only role-play scenes that exist on the site.
Where the money decisions live:
- The model never sets a price.
create_billsends item names and quantities. The server looks each name up in a fixed price list and builds the PayPal order itself. - Only the server's capture marks a bill as paid, not the model and not the page. If the learner types the marker the server uses for "payment confirmed", it is stripped.
- The server checks a subscription with PayPal before the device counts as Plus. It checks again once the last check is more than 6 hours old. One subscription covers at most 3 devices.
- Cost has hard limits: 3 conversations of 20 turns per free device per day, 200 turns per Plus device per day, and 4,000 turns per day for the whole site.
Challenges I ran into
- PayPal blocks payments between two Taiwan-registered accounts. My first sandbox merchant and buyer were both Taiwanese, and the subscription was refused. The demo merchant is now a US sandbox account.
- The model kept correcting the same old sentence. A prompt rule was not enough. The server now drops any correction whose quoted words are not in the learner's latest message.
- The shopkeeper sometimes just said the total. When the customer said "Eso es todo, ¿cuánto es?", the model answered with a number instead of calling
create_bill, so no ticket and no button appeared. The prompt now says that the ticket only exists through the tool.
Accomplishments that I'm proud of
- Both PayPal flows work end to end in the sandbox with the US demo merchant (tested October 22, 2026). The AI shopkeeper opened a bill, it was paid with a sandbox test card and captured, and the ticket got its PAGADO stamp. A Plus subscription paid with a test card lifted the daily limit; after cancelling, PayPal shows the subscription as CANCELLED.
- The per-turn cost is measured, not guessed: one turn uses 1,700–2,900 input tokens and 60–400 output tokens, about US$0.0003–0.0004. From that, a full 20-turn conversation comes to roughly half a cent to one cent (estimated; later turns carry more history). NT$60 is about US$2, so a month of Plus covers roughly 200–400 full conversations (estimated). A learner who used all 200 turns every day would cost about as much as they pay; the daily cap is there for that case.
What I learned
- Sandbox accounts have a country, and the country changes what PayPal allows. Test with the buyer country your users will have.
- Keep money out of the model. The model decides when to open a bill; the server decides what it costs and whether it was paid.
What's next
- A native speaker review of the lesson Spanish. It has not had one yet.
- Find out what learners will pay. NT$60 a month is my estimate, not data.
Log in or sign up for Devpost to join the conversation.