Skip to content

Pay through Rotur payment requests - #108

Merged
Mistium merged 3 commits into
developfrom
rotur-payment-requests
Oct 3, 2026
Merged

Mistium merged 3 commits into
developfrom
rotur-payment-requests

Conversation

@Mistium

@Mistium Mistium commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Buying a project or a game product, donating with a comment, and refunding a game product now go through Rotur payment requests (https://docs.rotur.dev/build-an-app/payments). MistWarp no longer moves credits with the person's own token, so none of these need credits:transfer.

Deploy together with MistWarp/api#31. That PR changes the intent and confirm calls this one makes: intents answer {key, requestId, approveUrl} and confirms take {key}. Neither side works with the other side's old version.

How paying works

  1. On the click, the page opens a small window straight away, so the browser doesn't block it.
  2. mistwarp-api makes the payment request and answers with Rotur's approve page, and the window goes there.
  3. The person approves with their Rotur password. For a sale, Rotur shows the split: the creator, any collaborators or remixed creators, and MistWarp's fee.
  4. Rotur posts {type: 'rotur:payment', id, status} back to this page (checked against https://rotur.dev and the request id), then mistwarp-api confirms with Rotur and delivers the purchase. If the window just closes, the page still asks mistwarp-api twice, in case it was paid but couldn't say so. Nothing on this page decides what was paid.

The shared code is in src/lib/rotur/payment-window.js, used by:

  • Buying a project: purchase.js and the confirm dialog on the project page.
  • Buying a game product: in the editor and the community site, and in packaged games (game-shop.js). A packaged game isn't on MistWarp's origin, so Rotur can't message it, and it asks mistwarp-api until the payment shows up or the window closes.
  • Donating with a comment: CommentThread.jsx. The comment is posted with the donation's key, once it's paid.
  • Refunding a game product: the creator pays the buyer back on Rotur, then revokes with refundKey.

Links instead of transfers

  • Support on a project and Donate on a profile now open rotur.dev/pay/<username> in a new tab, with a note. These are gifts from one person to another, with nothing to deliver, so a payment request isn't needed.

Removed

  • sendCommercePayment, payUser, createCommerceBounty and isInsufficientFunds. Rotur now checks the balance on its approve page.
  • New bounties are paused until Rotur can hold credits for them (escrow, or holding a payment request until a winner is picked). Bounties that are already funded still pay out and can be cancelled.
  • The payouts warning in Admin, with the payouts queue it reported on. mistwarp-api no longer pays sellers from its own account.

Screenshots

The community site at this branch, with mistwarp-api and api.rotur.dev mocked. The Rotur window is the live rotur.dev approve page, fed a mocked payment request.

Confirming a purchase (Firefox). Since #114 there's no balance line; Rotur shows the balance on its own page:
Confirm purchase

Waiting while Rotur's window is open (Firefox):
Waiting for Rotur

Rotur's approve page, with the split between the creator and MistWarp:
Rotur approve page

Paid. Rotur tells MistWarp and closes the window:
Paid on Rotur

The project is unlocked and loading (Firefox):
Unlocked project

Declined on Rotur (Firefox). Declining, an expired request and closing the window all show "Payment cancelled." on the project page, in the game shop, on donations and in packaged games:
Payment cancelled

The same flow passes end to end in Chromium and in Firefox: intent, approval, the rotur:payment message, confirm and unlock.

Testing

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Deploying scratch-gui with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3679823
Status: ✅  Deploy successful!
Preview URL: https://7f2c91d9.scratch-gui.pages.dev
Branch Preview URL: https://rotur-payment-requests.scratch-gui.pages.dev

View logs

Buying a project or game product, donating with a comment and refunding
a game product now open Rotur's approve page in a window. The person
approves the payment there with their password, and mistwarp-api
confirms it with Rotur. MistWarp no longer moves credits with the
person's own token, so it no longer needs credits:transfer for any of
these.

Supporting a project and donating on a profile link to the person's
Rotur pay page. New bounties are paused until Rotur can hold credits
for them; funded bounties still pay out and can be cancelled. The admin
payouts warning goes, with the payouts queue it reported on.
Declining on Rotur, letting the request expire or closing its window now
shows "Payment cancelled." on the project page, in the game shop and on a
donation, as the products modal does for refunds, instead of nothing.
…current

mistwarp-api refuses purchase intents without a returnUrl, which only
editors and exports from before payment requests leave out.
@Mistium
Mistium force-pushed the rotur-payment-requests branch from f96a68d to 3679823 Compare October 3, 2026 07:47
@Mistium
Mistium merged commit 0b3a3f3 into develop Oct 3, 2026
2 checks passed
@Mistium
Mistium deleted the rotur-payment-requests branch October 15, 2026 21:45
mc20000-01 pushed a commit to mc20000-01/scratch-gui that referenced this pull request Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant