openreceive 0.4.29 → 0.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/openreceive/version.rb +1 -1
- data/skills/integrate-openreceive/SKILL.md +10 -1
- data/skills/integrate-openreceive/references/astro.md +8 -9
- data/skills/integrate-openreceive/references/bolt.md +9 -7
- data/skills/integrate-openreceive/references/btcpay.md +3 -4
- data/skills/integrate-openreceive/references/django.md +2 -3
- data/skills/integrate-openreceive/references/edd.md +4 -5
- data/skills/integrate-openreceive/references/fastapi.md +4 -5
- data/skills/integrate-openreceive/references/fastify.md +4 -5
- data/skills/integrate-openreceive/references/flask.md +2 -3
- data/skills/integrate-openreceive/references/fossbilling.md +7 -8
- data/skills/integrate-openreceive/references/laravel.md +3 -4
- data/skills/integrate-openreceive/references/lovable.md +16 -12
- data/skills/integrate-openreceive/references/medusa.md +12 -5
- data/skills/integrate-openreceive/references/mobile.md +1 -1
- data/skills/integrate-openreceive/references/nestjs.md +2 -3
- data/skills/integrate-openreceive/references/next.md +4 -5
- data/skills/integrate-openreceive/references/node.md +4 -5
- data/skills/integrate-openreceive/references/nuxt.md +9 -10
- data/skills/integrate-openreceive/references/odoo.md +446 -0
- data/skills/integrate-openreceive/references/paymenter.md +5 -6
- data/skills/integrate-openreceive/references/php.md +2 -3
- data/skills/integrate-openreceive/references/prestashop.md +476 -0
- data/skills/integrate-openreceive/references/rails.md +2 -3
- data/skills/integrate-openreceive/references/react-router.md +8 -9
- data/skills/integrate-openreceive/references/sveltekit.md +9 -10
- data/skills/integrate-openreceive/references/tanstack-start.md +14 -11
- data/skills/integrate-openreceive/references/vendure.md +544 -0
- data/skills/integrate-openreceive/references/woocommerce.md +5 -6
- metadata +6 -2
|
@@ -3,7 +3,7 @@ This is the full file; follow it from Step 0.
|
|
|
3
3
|
# OpenReceive agent directions (SvelteKit)
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
# READ THIS FIRST: this file is
|
|
6
|
+
# READ THIS FIRST: this file is 36 KB and a summary drops required steps. Download it whole:
|
|
7
7
|
curl -fsSL https://openreceive.org/agent-directions/sveltekit/full.md
|
|
8
8
|
# Skip the download only if you already have all of it: pasted, read from disk or fetched raw.
|
|
9
9
|
```
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/sveltekit/full.md
|
|
|
17
17
|
- Do not suggest rotating or revoking a code because it was pasted here.
|
|
18
18
|
- Start the quickstart only once the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
|
|
19
19
|
|
|
20
|
-
These directions describe OpenReceive 0.4.
|
|
20
|
+
These directions describe OpenReceive 0.4.31.
|
|
21
21
|
|
|
22
22
|
Add OpenReceive to a SvelteKit application — the app you are already working
|
|
23
23
|
in, on `@sveltejs/adapter-node`. OpenReceive ships no SvelteKit package: the
|
|
@@ -429,13 +429,12 @@ enough; drop the `.md` for the same page a person would read.
|
|
|
429
429
|
- https://openreceive.org/guides/custom-checkout-route.md — advanced: replacing the shipped adapter's routes with your own
|
|
430
430
|
- https://openreceive.org/guides/react-material-ui-recipe.md — a worked custom UI on a component library
|
|
431
431
|
- https://openreceive.org/guides/quickstart-next.md — each hook explained step by step, on Next.js; they are the same here
|
|
432
|
+
- https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
|
|
432
433
|
- https://openreceive.org/guides.md — the index, if what you need is not above
|
|
433
434
|
|
|
434
435
|
Questions, or a problem with the library itself:
|
|
435
436
|
https://openreceive.org/contact
|
|
436
437
|
|
|
437
|
-
- https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
|
|
438
|
-
|
|
439
438
|
---
|
|
440
439
|
|
|
441
440
|
## The quickstart, in full
|
|
@@ -474,7 +473,7 @@ npm install @openreceive/http @openreceive/svelte pg
|
|
|
474
473
|
On Node, with `@sveltejs/adapter-node`. The wallet connection and your
|
|
475
474
|
database driver need Node, so the route cannot run on an edge runtime. The
|
|
476
475
|
Vercel and Netlify adapters deploy Node functions: read
|
|
477
|
-
Bitcoin checkout on serverless hosts first. For
|
|
476
|
+
[Bitcoin checkout on serverless hosts](https://openreceive.org/guides/serverless.md) first. For
|
|
478
477
|
Cloudflare Workers, the [TanStack Start recipe](https://openreceive.org/guides/tanstack-start-recipe.md#where-it-runs)
|
|
479
478
|
explains what a Worker needs. This recipe was not run on those hosts.
|
|
480
479
|
|
|
@@ -570,13 +569,13 @@ export const POST: RequestHandler = (event) => handleOpenReceive(event);
|
|
|
570
569
|
|
|
571
570
|
`native` is the request's `RequestEvent`, so `authorize` can check the
|
|
572
571
|
session your app already has: its cookies, or the `event.locals.user` your
|
|
573
|
-
`hooks.server.ts` sets. The Next.js quickstart
|
|
572
|
+
`hooks.server.ts` sets. The [Next.js quickstart](https://openreceive.org/guides/quickstart-next.md)
|
|
574
573
|
explains each hook. They are the same here.
|
|
575
574
|
|
|
576
575
|
One stack serves the whole server process. Behind a reverse proxy, set
|
|
577
576
|
adapter-node's `ADDRESS_HEADER` (and `XFF_DEPTH`), so that
|
|
578
577
|
`getClientAddress()` returns the payer's address and not the proxy's
|
|
579
|
-
(Rate limiting).
|
|
578
|
+
([Rate limiting](https://openreceive.org/guides/rate-limiting.md)).
|
|
580
579
|
|
|
581
580
|
On SvelteKit 2, import the secret as `env.NWC_URI` from
|
|
582
581
|
`$env/dynamic/private`, and import server modules from `$lib/server/`, with
|
|
@@ -586,7 +585,7 @@ only.
|
|
|
586
585
|
### Your database
|
|
587
586
|
|
|
588
587
|
`db` is a `pg` Pool, `node:sqlite` or `better-sqlite3`, or one of the
|
|
589
|
-
adapters in Node ORM recipes. With Drizzle, pass
|
|
588
|
+
adapters in [Node ORM recipes](https://openreceive.org/guides/node-orms.md). With Drizzle, pass
|
|
590
589
|
the driver underneath it. `sv add drizzle` sets up Postgres through
|
|
591
590
|
postgres.js or Neon, which OpenReceive does not take directly. Then give
|
|
592
591
|
OpenReceive its own small `pg` Pool on the same `DATABASE_URL`. It is the same
|
|
@@ -595,7 +594,7 @@ database, not a second one.
|
|
|
595
594
|
Create OpenReceive's two tables with your migrations
|
|
596
595
|
(`npx openreceive scaffold payments --orm drizzle` writes the Drizzle
|
|
597
596
|
schema), or run `paymentsSchemaSql("postgres")` from `@openreceive/http`
|
|
598
|
-
once. It is idempotent. See Payment storage.
|
|
597
|
+
once. It is idempotent. See [Payment storage](https://openreceive.org/guides/storage.md).
|
|
599
598
|
|
|
600
599
|
### The checkout page
|
|
601
600
|
|
|
@@ -628,7 +627,7 @@ export const load: PageServerLoad = async ({ params, cookies }) => {
|
|
|
628
627
|
The page renders on the server and starts the checkout in the browser. The
|
|
629
628
|
payer picks Bitcoin and gets the invoice. Keep it at the order's own URL: a
|
|
630
629
|
payer with a swap deposit in flight comes back to it
|
|
631
|
-
(Swap refunds).
|
|
630
|
+
([Swap refunds](https://openreceive.org/guides/swap-refunds.md)).
|
|
632
631
|
|
|
633
632
|
### Settings
|
|
634
633
|
|
|
@@ -17,7 +17,7 @@ curl -fsSL https://openreceive.org/agent-directions/tanstack-start/full.md
|
|
|
17
17
|
- Do not suggest rotating or revoking a code because it was pasted here.
|
|
18
18
|
- Start the quickstart only once the NWC code is saved, and the LSC code is saved or the user said "Bitcoin only".
|
|
19
19
|
|
|
20
|
-
These directions describe OpenReceive 0.4.
|
|
20
|
+
These directions describe OpenReceive 0.4.31.
|
|
21
21
|
|
|
22
22
|
Add OpenReceive to a TanStack Start application on Node — the app you are
|
|
23
23
|
already working in, with its own Postgres. OpenReceive ships no TanStack
|
|
@@ -474,13 +474,12 @@ enough; drop the `.md` for the same page a person would read.
|
|
|
474
474
|
- https://openreceive.org/guides/custom-checkout-route.md — advanced: replacing the shipped adapter's routes with your own
|
|
475
475
|
- https://openreceive.org/guides/react-material-ui-recipe.md — a worked custom UI on a component library
|
|
476
476
|
- https://openreceive.org/guides/quickstart-next.md — each hook explained step by step, on Next.js; they are the same here
|
|
477
|
+
- https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
|
|
477
478
|
- https://openreceive.org/guides.md — the index, if what you need is not above
|
|
478
479
|
|
|
479
480
|
Questions, or a problem with the library itself:
|
|
480
481
|
https://openreceive.org/contact
|
|
481
482
|
|
|
482
|
-
- https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
|
|
483
|
-
|
|
484
483
|
---
|
|
485
484
|
|
|
486
485
|
## The quickstart, in full
|
|
@@ -600,12 +599,12 @@ export async function handleOpenReceive(request: Request): Promise<Response> {
|
|
|
600
599
|
```
|
|
601
600
|
|
|
602
601
|
`authorize` sees the incoming request with its cookies, so check it with
|
|
603
|
-
the session your app already has. The Next.js quickstart
|
|
602
|
+
the session your app already has. The [Next.js quickstart](https://openreceive.org/guides/quickstart-next.md)
|
|
604
603
|
explains each hook. They are the same here.
|
|
605
604
|
|
|
606
605
|
Create OpenReceive's two tables with your migrations, or run
|
|
607
606
|
`paymentsSchemaSql("postgres")` from `@openreceive/http` once. It is
|
|
608
|
-
idempotent. See Payment storage.
|
|
607
|
+
idempotent. See [Payment storage](https://openreceive.org/guides/storage.md).
|
|
609
608
|
|
|
610
609
|
### On Supabase (Lovable)
|
|
611
610
|
|
|
@@ -630,7 +629,7 @@ npm install @openreceive/http @openreceive/react
|
|
|
630
629
|
) returns void language plpgsql as $$
|
|
631
630
|
begin
|
|
632
631
|
update public.orders set status = 'paid'
|
|
633
|
-
where id = p_reference::uuid and status = '
|
|
632
|
+
where id = p_reference::uuid and status = 'awaiting_payment'; -- your unpaid status
|
|
634
633
|
end
|
|
635
634
|
$$;
|
|
636
635
|
```
|
|
@@ -682,17 +681,21 @@ There is no `onPaid`: `openreceive_on_paid` is the fulfillment. `findOrder`
|
|
|
682
681
|
reads the order with your server-side Supabase client; in a Lovable app that
|
|
683
682
|
is `supabaseAdmin` from `@/integrations/supabase/client.server`.
|
|
684
683
|
|
|
685
|
-
|
|
686
|
-
cookies
|
|
687
|
-
browser, not in a cookie, so `authorize` cannot see who is signed in
|
|
688
|
-
|
|
684
|
+
By default the checkout calls the payment routes from the browser with the
|
|
685
|
+
page's cookies and nothing else. A Lovable app keeps its Supabase sign-in in
|
|
686
|
+
the browser, not in a cookie, so `authorize` cannot see who is signed in from
|
|
687
|
+
those cookies. Since 0.4.25 the React `<Checkout>` also takes a `fetch` that
|
|
688
|
+
sends the access token
|
|
689
|
+
([Use Supabase Auth in `authorize`](https://openreceive.org/guides/supabase.md#4-use-supabase-auth-in-authorize)), but
|
|
690
|
+
this recipe keeps the simpler route that works with every checkout: give the
|
|
691
|
+
buyer a cookie of their own. Create orders in a server function
|
|
689
692
|
that sets an HttpOnly `buyer` cookie (a random value, kept across orders) and
|
|
690
693
|
stores the same value on the order as `buyer_token`. `currentBuyer` reads it
|
|
691
694
|
back from the request's `cookie` header.
|
|
692
695
|
|
|
693
696
|
Before it serves, the server checks the database, and the payment routes
|
|
694
697
|
answer 503 until the migration is applied and `openreceive_on_paid` is
|
|
695
|
-
yours; the log names the fix. More: Supabase over HTTPS.
|
|
698
|
+
yours; the log names the fix. More: [Supabase over HTTPS](https://openreceive.org/guides/supabase.md#supabase-over-https).
|
|
696
699
|
|
|
697
700
|
### The checkout page
|
|
698
701
|
|