Spec: PayPal, Cash App, Zelle, Polar, affiliates, and a creator program #1

Open
opened 2026-10-19 13:07:32 +03:00 by Kirubel-Kibru-Yaltopia · 0 comments

For Yared

Add the ways a student outside Ethiopia can pay, and add two growth programs: affiliates (someone recommends a course and earns a cut) and a creator program (someone makes a course and earns a share). Do not invent a second way to unlock a course. Every provider must end in the order state machine already in SPEC §8.3.

The checkout screen already lists PayPal and Zelle as simulated methods (packages/features/src/student.tsx). Cash App is new. Telebirr, CBE Birr, Visa and Mastercard stay on ArifPay. This work does not replace ArifPay.

Rules that already exist — do not break them

From SPEC §8:

  • One PaymentAdapter per provider (id, methods, createCheckout, verifyWebhook, queryStatus). Order and enrollment code must not know which provider ran.
  • PENDING → PAID and the enrollment insert happen in one transaction and are idempotent.
  • Never unlock a course from the browser return URL. Unlock only from a verified webhook or a server-side queryStatus.
  • Webhook amount and currency must match the order. A mismatch sets flaggedReason, does not unlock, and alerts an admin.
  • A student who already owns a course cannot buy it again.
  • On PAID: in-app notification, SMS, and an emailed receipt.
  • Refunds move the order to REFUNDED and must also reverse any affiliate commission and creator share for that order.

The demo (apps/demo) stays simulated. Real adapters belong in apps/api/src/payments/ when that app exists. Until then, new methods on the demo checkout use the same Pay / Fail simulation as Telebirr, so the client can click through them.

What each rail actually is

Rail Can it auto-unlock? Use it for
PayPal Yes. Orders API + webhook. Diaspora students who already have PayPal.
Cash App Only with an approved Cash App Pay / Block business account. Same students, if the account is approved. Otherwise the manual flow below.
Zelle No. There is no merchant checkout API. A reference-code payment a staff member confirms.
Polar Yes, for the academy’s own pre-recorded courses. Polar is the merchant of record, so the academy does not need its own payments license. International card checkout and sales tax.
ArifPay Yes, already specified. Telebirr, CBE Birr, and local cards.

PayPal

  • Provider id: PAYPAL. Method id stays PAYPAL.
  • Create a PayPal order in the course currency (ETB if PayPal accepts it for this merchant, otherwise USD — see open decision 1). Redirect the student to PayPal, then back to /orders/{id}.
  • Capture on the webhook (PAYMENT.CAPTURE.COMPLETED), not on the return URL.
  • Verify the webhook signature. Store providerRef as the PayPal order id.
  • Sandbox keys in staging. A staff test purchase uses an isTest course, then a refund, and never shows in student stats (SPEC §8.4).

Cash App

  • Provider id: CASHAPP. Method id: CASH_APP.
  • Prefer Cash App Pay through Block (Square) if the client’s business account is approved: hosted checkout, webhook, same unlock rule as PayPal.
  • If the account is not approved, do not fake a webhook. Use the manual flow in the Zelle section, with the Cash App cashtag instead of a Zelle handle.

Zelle

Zelle does not offer a checkout API we can call. Do not pretend a return URL or a screenshot is a verified webhook.

Manual flow:

  1. Checkout creates a PENDING order and shows a short reference, the amount, and the academy’s Zelle name (email or US phone). The reference is the only thing the student must put in the Zelle note.
  2. The course stays locked.
  3. Staff open the order in admin, match the Zelle receipt to the reference and the amount, and mark it paid. That action is the only thing that may call the same PAID transition as a webhook. Record who confirmed it and when.
  4. If the amount or reference does not match, staff flag it. No unlock.
  5. Unconfirmed orders still expire on the normal timer (30 minutes is too short for a bank transfer — see open decision 2). Suggested hold: 48 hours, only for ZELLE and for Cash App when it is on the manual flow.

Show copy that says a person confirms Zelle, so the student does not expect the course to open the second they hit send.

Polar

Polar does not require the academy to hold a payments or money-transmitter license. Polar is the legal seller (merchant of record): it charges the card, handles sales tax on that sale, and pays the academy out. What the academy still has to do, before the first payout:

  • Create a Polar organization for MakeUp Academy only.
  • Pass Polar’s account review (they ask for the product and a live site; review can take up to 14 days).
  • Identity check of the organization owner (passport, ID card, or driver’s license, plus a selfie) through Stripe Identity.
  • A Stripe Connect Express account so Polar can pay us.

Polar’s own rules, which this design must follow:

  • Allowed: pre-recorded digital courses sold by us. Their acceptable-use policy lists courses and digital video as products they will sell.
  • Not allowed: a marketplace, or selling someone else’s product for a revenue share, or letting other people sell through our Polar account. So creators and affiliates are not Polar sellers. Polar charges the student for a MakeUp Academy course. We pay creators and affiliates ourselves, from our own ledger, after the money has settled.
  • Not allowed if the company’s main offer is live human service (coaching, in-person appointments). This integration is for the video course only.

Provider id: POLAR. One Polar product per course (or one product with the course id in metadata). Checkout session URL comes back from createCheckout. Webhook order.paid (confirm the event name against current Polar docs) is verified with the webhook secret, then runs the same PAID transition. Amount and currency must match. Refunds from Polar must move our order to REFUNDED and reverse affiliate and creator balances for that order.

Polar fees and the 7-day settlement delay (organizations created on or after 12 May 2026) are Polar’s, not something we reimplement. Do not unlock early and do not delay the unlock until the payout; the student gets the course when Polar says the order is paid.

Affiliates

A person recommends a course. If a new student buys through their link, they earn a percentage of that order.

  • An affiliate has a code (SELAM) and a link /{locale}/course/{slug}?ref=SELAM.
  • Clicking the link stores the code on this browser for 30 days. A newer code replaces the older one. The code is copied onto the order at checkout and does not change after that.
  • Commission is a percent of the amount the student actually paid (the order snapshot), default 10% (open decision 3). Set per affiliate when someone needs a different rate.
  • Commission is created only when the order becomes PAID, and only if the buyer is not the affiliate. No commission on isTest courses.
  • REFUNDED reverses that commission. If it was already paid out, the affiliate balance may go negative and the next payout absorbs it.
  • The student never sees the commission. They may see “Referred by {name}” only if we decide to (default: no).
  • Admin can create, pause, and close an affiliate. A paused code stops earning but keeps history.
  • The affiliate, once signed in, sees: code, link, pending balance, paid balance, and a list of orders (course name, date, commission, status). Not the buyer’s phone or email.
  • Payout is a recorded transfer we make ourselves (Telebirr, PayPal, or bank). Minimum payout 500 ETB or the USD equivalent (open decision 4). Staff mark it paid and attach a reference. This is not a Polar or PayPal split.

Creator program

A creator makes a course for the academy and earns a share of sales. The academy remains the seller.

  • Application: name, email, phone, language, a short sample, and which course they want to teach. Status: APPLIED → APPROVED or REJECTED.
  • An approved creator can draft a course (title, description, lessons, price suggestion) in the admin they are allowed to see. They cannot publish, cannot change the live price, and cannot see other creators’ students.
  • An admin publishes. Publishing snapshots the creator’s share percent onto the course (default 30% of the amount paid, open decision 5). Later edits to the creator’s rate do not rewrite old orders.
  • On PAID, write a creator earning for that order: amount paid × share. On REFUNDED, reverse it. No earning on isTest courses. No earning when the buyer is the creator.
  • If an affiliate also referred that sale, both can be paid. Affiliate percent and creator percent come off the amount paid. They must not add up to more than 100%. Reject the checkout configuration (not the student’s payment) if an admin sets rates that do.
  • Creator screen: their courses, status, pending and paid earnings. No student phone numbers.
  • Payout works like affiliates: we pay them, staff record it. Creators are not given Polar accounts.

Data to add

Keep names close to the existing order. Suggested records:

  • Affiliate — id, user id, code (unique), percent, status (ACTIVE | PAUSED), createdAt.
  • ReferralClick — optional; only if we need to debug. The cookie plus the code on the order is enough for v1.
  • Order.affiliateId and Order.creatorShareMinor / Order.affiliateCommissionMinor snapshotted at PAID.
  • Creator — id, user id, status (APPLIED | APPROVED | REJECTED), share percent, appliedAt.
  • Course.creatorId nullable. Empty means the academy owns it and nobody takes a share.
  • Earning — id, payee (affiliate or creator), order id, minor amount, currency, status (PENDING | PAID | REVERSED), payout id.
  • Payout — id, payee, amount, method, external reference, paidAt, staff user id.
  • Order.method already a string. Add CASH_APP. provider becomes ARIFPAY | PAYPAL | CASHAPP | ZELLE | POLAR.
  • Zelle / manual Cash App: Order.paymentReference, Order.confirmedBy, Order.confirmedAt.

Admin

  • Orders list already needs a method column. Add provider, reference, and who confirmed a manual payment.
  • New screens: Affiliates, Creators (applications + earnings), Payouts.
  • Manual “Mark paid” is permission-gated. It writes the same audit fields as a webhook (confirmedBy instead of providerRef).

Acceptance checks

  1. PayPal sandbox: pay → course unlocks from the webhook, not from the return URL. A second webhook does not double-enroll. Wrong amount does not unlock.
  2. PayPal fail / cancel → FAILED or CANCELLED, course stays locked.
  3. Zelle: order stays PENDING after the student leaves checkout. Unlock happens only after staff confirm a matching reference and amount. A wrong amount does not unlock.
  4. Polar test mode: paid webhook unlocks; refund webhook sets REFUNDED.
  5. Affiliate link: buy inside 30 days → one commission on PAID. Buy as yourself with your own code → no commission. Refund → commission reversed.
  6. Creator: unpublished draft is invisible to students. After publish, a sale writes one earning at the snapshotted percent. Refund reverses it.
  7. Affiliate 10% + creator 30% on a 1,000 ETB order → 100 and 300, both reversed on refund.
  8. isTest purchases create no affiliate or creator earnings and stay out of their dashboards.

Open decisions (do not guess)

  1. Charge PayPal and Polar in ETB or USD, and who sets the FX rate.
  2. How long a Zelle / manual Cash App order stays PENDING (suggestion: 48 hours).
  3. Default affiliate percent (suggestion: 10).
  4. Minimum payout and which methods we will actually send (Telebirr, PayPal, bank).
  5. Default creator share (suggestion: 30), and whether the creator may propose a price or only the academy sets it.
  6. Polar organization owner: whose passport is used for the identity check.
  7. Confirm Polar’s current webhook event names against their docs before coding the adapter.

Out of scope

  • Replacing ArifPay for Telebirr and CBE Birr.
  • Giving each creator their own Polar or PayPal seller account.
  • Live classes, coaching calls, or in-person bookings.
  • Paying affiliates or creators automatically through the card network.
## For Yared Add the ways a student outside Ethiopia can pay, and add two growth programs: affiliates (someone recommends a course and earns a cut) and a creator program (someone makes a course and earns a share). Do not invent a second way to unlock a course. Every provider must end in the order state machine already in SPEC §8.3. The checkout screen already lists PayPal and Zelle as simulated methods (`packages/features/src/student.tsx`). Cash App is new. Telebirr, CBE Birr, Visa and Mastercard stay on ArifPay. This work does not replace ArifPay. ## Rules that already exist — do not break them From SPEC §8: - One `PaymentAdapter` per provider (`id`, `methods`, `createCheckout`, `verifyWebhook`, `queryStatus`). Order and enrollment code must not know which provider ran. - `PENDING → PAID` and the enrollment insert happen in one transaction and are idempotent. - Never unlock a course from the browser return URL. Unlock only from a verified webhook or a server-side `queryStatus`. - Webhook amount and currency must match the order. A mismatch sets `flaggedReason`, does not unlock, and alerts an admin. - A student who already owns a course cannot buy it again. - On `PAID`: in-app notification, SMS, and an emailed receipt. - Refunds move the order to `REFUNDED` and must also reverse any affiliate commission and creator share for that order. The demo (`apps/demo`) stays simulated. Real adapters belong in `apps/api/src/payments/` when that app exists. Until then, new methods on the demo checkout use the same Pay / Fail simulation as Telebirr, so the client can click through them. ## What each rail actually is | Rail | Can it auto-unlock? | Use it for | |---|---|---| | PayPal | Yes. Orders API + webhook. | Diaspora students who already have PayPal. | | Cash App | Only with an approved Cash App Pay / Block business account. | Same students, if the account is approved. Otherwise the manual flow below. | | Zelle | No. There is no merchant checkout API. | A reference-code payment a staff member confirms. | | Polar | Yes, for the academy’s own pre-recorded courses. Polar is the merchant of record, so the academy does not need its own payments license. | International card checkout and sales tax. | | ArifPay | Yes, already specified. | Telebirr, CBE Birr, and local cards. | ### PayPal - Provider id: `PAYPAL`. Method id stays `PAYPAL`. - Create a PayPal order in the course currency (ETB if PayPal accepts it for this merchant, otherwise USD — see open decision 1). Redirect the student to PayPal, then back to `/orders/{id}`. - Capture on the webhook (`PAYMENT.CAPTURE.COMPLETED`), not on the return URL. - Verify the webhook signature. Store `providerRef` as the PayPal order id. - Sandbox keys in staging. A staff test purchase uses an `isTest` course, then a refund, and never shows in student stats (SPEC §8.4). ### Cash App - Provider id: `CASHAPP`. Method id: `CASH_APP`. - Prefer Cash App Pay through Block (Square) if the client’s business account is approved: hosted checkout, webhook, same unlock rule as PayPal. - If the account is not approved, do not fake a webhook. Use the manual flow in the Zelle section, with the Cash App cashtag instead of a Zelle handle. ### Zelle Zelle does not offer a checkout API we can call. Do not pretend a return URL or a screenshot is a verified webhook. Manual flow: 1. Checkout creates a `PENDING` order and shows a short reference, the amount, and the academy’s Zelle name (email or US phone). The reference is the only thing the student must put in the Zelle note. 2. The course stays locked. 3. Staff open the order in admin, match the Zelle receipt to the reference and the amount, and mark it paid. That action is the only thing that may call the same `PAID` transition as a webhook. Record who confirmed it and when. 4. If the amount or reference does not match, staff flag it. No unlock. 5. Unconfirmed orders still expire on the normal timer (30 minutes is too short for a bank transfer — see open decision 2). Suggested hold: 48 hours, only for `ZELLE` and for Cash App when it is on the manual flow. Show copy that says a person confirms Zelle, so the student does not expect the course to open the second they hit send. ### Polar Polar does **not** require the academy to hold a payments or money-transmitter license. Polar is the legal seller (merchant of record): it charges the card, handles sales tax on that sale, and pays the academy out. What the academy still has to do, before the first payout: - Create a Polar organization for MakeUp Academy only. - Pass Polar’s account review (they ask for the product and a live site; review can take up to 14 days). - Identity check of the organization owner (passport, ID card, or driver’s license, plus a selfie) through Stripe Identity. - A Stripe Connect Express account so Polar can pay us. Polar’s own rules, which this design must follow: - Allowed: pre-recorded digital courses sold by us. Their acceptable-use policy lists courses and digital video as products they will sell. - Not allowed: a marketplace, or selling someone else’s product for a revenue share, or letting other people sell through our Polar account. So creators and affiliates are **not** Polar sellers. Polar charges the student for a MakeUp Academy course. We pay creators and affiliates ourselves, from our own ledger, after the money has settled. - Not allowed if the company’s main offer is live human service (coaching, in-person appointments). This integration is for the video course only. Provider id: `POLAR`. One Polar product per course (or one product with the course id in metadata). Checkout session URL comes back from `createCheckout`. Webhook `order.paid` (confirm the event name against current Polar docs) is verified with the webhook secret, then runs the same `PAID` transition. Amount and currency must match. Refunds from Polar must move our order to `REFUNDED` and reverse affiliate and creator balances for that order. Polar fees and the 7-day settlement delay (organizations created on or after 12 May 2026) are Polar’s, not something we reimplement. Do not unlock early and do not delay the unlock until the payout; the student gets the course when Polar says the order is paid. ## Affiliates A person recommends a course. If a new student buys through their link, they earn a percentage of that order. - An affiliate has a code (`SELAM`) and a link `/{locale}/course/{slug}?ref=SELAM`. - Clicking the link stores the code on this browser for 30 days. A newer code replaces the older one. The code is copied onto the order at checkout and does not change after that. - Commission is a percent of the amount the student actually paid (the order snapshot), default 10% (open decision 3). Set per affiliate when someone needs a different rate. - Commission is created only when the order becomes `PAID`, and only if the buyer is not the affiliate. No commission on `isTest` courses. - `REFUNDED` reverses that commission. If it was already paid out, the affiliate balance may go negative and the next payout absorbs it. - The student never sees the commission. They may see “Referred by {name}” only if we decide to (default: no). - Admin can create, pause, and close an affiliate. A paused code stops earning but keeps history. - The affiliate, once signed in, sees: code, link, pending balance, paid balance, and a list of orders (course name, date, commission, status). Not the buyer’s phone or email. - Payout is a recorded transfer we make ourselves (Telebirr, PayPal, or bank). Minimum payout 500 ETB or the USD equivalent (open decision 4). Staff mark it paid and attach a reference. This is not a Polar or PayPal split. ## Creator program A creator makes a course for the academy and earns a share of sales. The academy remains the seller. - Application: name, email, phone, language, a short sample, and which course they want to teach. Status: `APPLIED → APPROVED` or `REJECTED`. - An approved creator can draft a course (title, description, lessons, price suggestion) in the admin they are allowed to see. They cannot publish, cannot change the live price, and cannot see other creators’ students. - An admin publishes. Publishing snapshots the creator’s share percent onto the course (default 30% of the amount paid, open decision 5). Later edits to the creator’s rate do not rewrite old orders. - On `PAID`, write a creator earning for that order: `amount paid × share`. On `REFUNDED`, reverse it. No earning on `isTest` courses. No earning when the buyer is the creator. - If an affiliate also referred that sale, both can be paid. Affiliate percent and creator percent come off the amount paid. They must not add up to more than 100%. Reject the checkout configuration (not the student’s payment) if an admin sets rates that do. - Creator screen: their courses, status, pending and paid earnings. No student phone numbers. - Payout works like affiliates: we pay them, staff record it. Creators are not given Polar accounts. ## Data to add Keep names close to the existing order. Suggested records: - `Affiliate` — id, user id, code (unique), percent, status (`ACTIVE | PAUSED`), createdAt. - `ReferralClick` — optional; only if we need to debug. The cookie plus the code on the order is enough for v1. - `Order.affiliateId` and `Order.creatorShareMinor` / `Order.affiliateCommissionMinor` snapshotted at `PAID`. - `Creator` — id, user id, status (`APPLIED | APPROVED | REJECTED`), share percent, appliedAt. - `Course.creatorId` nullable. Empty means the academy owns it and nobody takes a share. - `Earning` — id, payee (affiliate or creator), order id, minor amount, currency, status (`PENDING | PAID | REVERSED`), payout id. - `Payout` — id, payee, amount, method, external reference, paidAt, staff user id. - `Order.method` already a string. Add `CASH_APP`. `provider` becomes `ARIFPAY | PAYPAL | CASHAPP | ZELLE | POLAR`. - Zelle / manual Cash App: `Order.paymentReference`, `Order.confirmedBy`, `Order.confirmedAt`. ## Admin - Orders list already needs a method column. Add provider, reference, and who confirmed a manual payment. - New screens: Affiliates, Creators (applications + earnings), Payouts. - Manual “Mark paid” is permission-gated. It writes the same audit fields as a webhook (`confirmedBy` instead of `providerRef`). ## Acceptance checks 1. PayPal sandbox: pay → course unlocks from the webhook, not from the return URL. A second webhook does not double-enroll. Wrong amount does not unlock. 2. PayPal fail / cancel → `FAILED` or `CANCELLED`, course stays locked. 3. Zelle: order stays `PENDING` after the student leaves checkout. Unlock happens only after staff confirm a matching reference and amount. A wrong amount does not unlock. 4. Polar test mode: paid webhook unlocks; refund webhook sets `REFUNDED`. 5. Affiliate link: buy inside 30 days → one commission on `PAID`. Buy as yourself with your own code → no commission. Refund → commission reversed. 6. Creator: unpublished draft is invisible to students. After publish, a sale writes one earning at the snapshotted percent. Refund reverses it. 7. Affiliate 10% + creator 30% on a 1,000 ETB order → 100 and 300, both reversed on refund. 8. `isTest` purchases create no affiliate or creator earnings and stay out of their dashboards. ## Open decisions (do not guess) 1. Charge PayPal and Polar in ETB or USD, and who sets the FX rate. 2. How long a Zelle / manual Cash App order stays `PENDING` (suggestion: 48 hours). 3. Default affiliate percent (suggestion: 10). 4. Minimum payout and which methods we will actually send (Telebirr, PayPal, bank). 5. Default creator share (suggestion: 30), and whether the creator may propose a price or only the academy sets it. 6. Polar organization owner: whose passport is used for the identity check. 7. Confirm Polar’s current webhook event names against their docs before coding the adapter. ## Out of scope - Replacing ArifPay for Telebirr and CBE Birr. - Giving each creator their own Polar or PayPal seller account. - Live classes, coaching calls, or in-person bookings. - Paying affiliates or creators automatically through the card network.
Yared-Girma-Yaltopia was assigned by Kirubel-Kibru-Yaltopia 2026-10-19 13:07:32 +03:00
Sign in to join this conversation.
No Label
No Milestone
No project
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: RezinaLMS/RezinaLMS-CustomerEnd#1
No description provided.