@openreceive/angular 0.4.2 → 0.4.5
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.
- package/dist/fesm2022/openreceive-angular-checkout-component.mjs +5 -5
- package/dist/fesm2022/openreceive-angular-checkout-component.mjs.map +1 -1
- package/dist/types/openreceive-angular-checkout-component.d.ts +2 -2
- package/package.json +3 -3
- package/skills/integrate-openreceive/SKILL.md +16 -5
- package/skills/integrate-openreceive/references/btcpay.md +193 -0
- package/skills/integrate-openreceive/references/django.md +667 -0
- package/skills/integrate-openreceive/references/fastapi.md +537 -0
- package/skills/integrate-openreceive/references/fastify.md +529 -0
- package/skills/integrate-openreceive/references/laravel.md +658 -0
- package/skills/integrate-openreceive/references/next.md +580 -0
- package/skills/integrate-openreceive/references/node.md +33 -14
- package/skills/integrate-openreceive/references/php.md +598 -0
- package/skills/integrate-openreceive/references/rails.md +72 -27
- package/skills/integrate-openreceive/references/woocommerce.md +153 -0
|
@@ -119,9 +119,9 @@ class CheckoutComponent {
|
|
|
119
119
|
checkout;
|
|
120
120
|
reference;
|
|
121
121
|
prefix;
|
|
122
|
+
csrfHeader;
|
|
122
123
|
paymentWizard;
|
|
123
124
|
decodeLinkUrl;
|
|
124
|
-
assetBaseUrl;
|
|
125
125
|
themeToggle;
|
|
126
126
|
defaultTheme;
|
|
127
127
|
storageKey;
|
|
@@ -200,9 +200,9 @@ class CheckoutComponent {
|
|
|
200
200
|
deferThemeResolution: !this.elementsReady,
|
|
201
201
|
...(this.reference === undefined ? {} : { reference: this.reference }),
|
|
202
202
|
...(this.prefix === undefined ? {} : { prefix: this.prefix }),
|
|
203
|
+
...(this.csrfHeader === undefined ? {} : { csrfHeader: this.csrfHeader }),
|
|
203
204
|
...(this.paymentWizard === undefined ? {} : { paymentWizard: this.paymentWizard }),
|
|
204
205
|
...(this.decodeLinkUrl === undefined ? {} : { decodeLinkUrl: this.decodeLinkUrl }),
|
|
205
|
-
...(this.assetBaseUrl === undefined ? {} : { assetBaseUrl: this.assetBaseUrl }),
|
|
206
206
|
...(this.defaultTheme === undefined ? {} : { defaultTheme: this.defaultTheme }),
|
|
207
207
|
...(this.storageKey === undefined ? {} : { storageKey: this.storageKey }),
|
|
208
208
|
...(this.metadata === undefined ? {} : { metadata: this.metadata }),
|
|
@@ -224,7 +224,7 @@ class CheckoutComponent {
|
|
|
224
224
|
return createWrapperCheckoutShellBinding(this.checkout ?? null, options);
|
|
225
225
|
}
|
|
226
226
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.3", ngImport: i0, type: CheckoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
227
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.3", type: CheckoutComponent, isStandalone: true, selector: "openreceive-angular-checkout", inputs: { checkout: "checkout", reference: "reference", prefix: "prefix",
|
|
227
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.3", type: CheckoutComponent, isStandalone: true, selector: "openreceive-angular-checkout", inputs: { checkout: "checkout", reference: "reference", prefix: "prefix", csrfHeader: "csrfHeader", paymentWizard: "paymentWizard", decodeLinkUrl: "decodeLinkUrl", themeToggle: "themeToggle", defaultTheme: "defaultTheme", storageKey: "storageKey", metadata: "metadata", syncUrl: "syncUrl", resumePathPrefix: "resumePathPrefix", routeReference: "routeReference", resumePaymentHash: "resumePaymentHash", resumable: "resumable", onCopy: "onCopy", onOpenWallet: "onOpenWallet", onState: "onState", onSettled: "onSettled", onProviderCopy: "onProviderCopy", onStartOver: "onStartOver", onError: "onError", options: "options" }, usesOnChanges: true, ngImport: i0, template: `
|
|
228
228
|
<section [openreceiveElementBindings]="rootBindings">
|
|
229
229
|
@if (elementsReady && shell; as shell) {
|
|
230
230
|
@if (shell.themeToggle) {
|
|
@@ -263,12 +263,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.3", ngImpor
|
|
|
263
263
|
type: Input
|
|
264
264
|
}], prefix: [{
|
|
265
265
|
type: Input
|
|
266
|
+
}], csrfHeader: [{
|
|
267
|
+
type: Input
|
|
266
268
|
}], paymentWizard: [{
|
|
267
269
|
type: Input
|
|
268
270
|
}], decodeLinkUrl: [{
|
|
269
271
|
type: Input
|
|
270
|
-
}], assetBaseUrl: [{
|
|
271
|
-
type: Input
|
|
272
272
|
}], themeToggle: [{
|
|
273
273
|
type: Input
|
|
274
274
|
}], defaultTheme: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openreceive-angular-checkout-component.mjs","sources":["../../src/element-bindings.ts","../../src/openreceive-element-bindings.directive.ts","../../src/openreceive-checkout.component.ts","../../src/openreceive-angular-checkout-component.ts"],"sourcesContent":["/**\n * Applying a wrapper binding to a custom element, independent of Angular.\n *\n * Angular templates can only bind attribute names written out literally, so a\n * hand-transcribed `[attr.*]` list silently drops any attribute the shared\n * factory later adds. Driving attributes and listeners from the binding object\n * keeps Angular in step with the other wrappers by construction.\n */\n\nexport interface ElementBindings {\n readonly attributes?: Readonly<Record<string, string | undefined>>;\n readonly listeners?: Readonly<Record<string, ((event: Event) => void) | undefined>>;\n}\n\nexport interface ElementBindingTarget {\n getAttribute(name: string): string | null;\n setAttribute(name: string, value: string): void;\n removeAttribute(name: string): void;\n addEventListener(name: string, listener: (event: Event) => void): void;\n removeEventListener(name: string, listener: (event: Event) => void): void;\n}\n\nexport type AttachedListeners = readonly (readonly [string, (event: Event) => void])[];\n\nexport interface AppliedElementBindings {\n readonly attributes: readonly string[];\n readonly listeners: AttachedListeners;\n}\n\nexport const EMPTY_APPLIED_ELEMENT_BINDINGS: AppliedElementBindings = {\n attributes: [],\n listeners: [],\n};\n\nexport function applyElementBindings(\n element: ElementBindingTarget,\n bindings: ElementBindings,\n applied: AppliedElementBindings,\n): AppliedElementBindings {\n return {\n attributes: syncAttributes(element, bindings.attributes ?? {}, applied.attributes),\n listeners: syncListeners(element, bindings.listeners ?? {}, applied.listeners),\n };\n}\n\nexport function detachElementListeners(\n element: ElementBindingTarget,\n listeners: AttachedListeners,\n): void {\n for (const [name, handler] of listeners) element.removeEventListener(name, handler);\n}\n\nfunction syncAttributes(\n element: ElementBindingTarget,\n attributes: Readonly<Record<string, string | undefined>>,\n applied: readonly string[],\n): readonly string[] {\n for (const name of applied) {\n if (attributes[name] === undefined) element.removeAttribute(name);\n }\n const next: string[] = [];\n for (const [name, value] of Object.entries(attributes)) {\n if (value === undefined) continue;\n if (element.getAttribute(name) !== value) element.setAttribute(name, value);\n next.push(name);\n }\n return next;\n}\n\nfunction syncListeners(\n element: ElementBindingTarget,\n listeners: Readonly<Record<string, ((event: Event) => void) | undefined>>,\n attached: AttachedListeners,\n): AttachedListeners {\n const next = Object.entries(listeners).flatMap(([name, handler]) =>\n handler === undefined ? [] : [[name, handler] as const],\n );\n const unchanged =\n next.length === attached.length &&\n next.every(([name, handler], index) => {\n const current = attached[index];\n return current !== undefined && current[0] === name && current[1] === handler;\n });\n if (unchanged) return attached;\n detachElementListeners(element, attached);\n for (const [name, handler] of next) element.addEventListener(name, handler);\n return next;\n}\n","import {\n Directive,\n ElementRef,\n Input,\n NgZone,\n inject,\n type OnChanges,\n type OnDestroy,\n} from \"@angular/core\";\nimport {\n type AppliedElementBindings,\n EMPTY_APPLIED_ELEMENT_BINDINGS,\n type ElementBindings,\n applyElementBindings,\n detachElementListeners,\n} from \"./element-bindings\";\n\n/** Applies a wrapper binding's attributes and listeners to the element host. */\n@Directive({\n selector: \"[openreceiveElementBindings]\",\n standalone: true,\n})\nexport class ElementBindingsDirective implements OnChanges, OnDestroy {\n @Input(\"openreceiveElementBindings\") bindings: ElementBindings = {};\n\n private applied: AppliedElementBindings = EMPTY_APPLIED_ELEMENT_BINDINGS;\n // Zone-wrapped handlers are cached per original handler: the applier compares\n // identity to decide whether to re-attach, so a fresh wrapper each pass would\n // detach and re-add every listener on every change.\n private readonly zoneWrapped = new WeakMap<(event: Event) => void, (event: Event) => void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly zone = inject(NgZone);\n\n ngOnChanges(): void {\n // Setting attributes restarts the element's poll/countdown timers. Applying them\n // outside Angular keeps those timers unpatched, so they never schedule a change\n // detection pass; the listeners below re-enter the zone for host callbacks.\n this.zone.runOutsideAngular(() => {\n this.applied = applyElementBindings(\n this.host.nativeElement,\n { ...this.bindings, listeners: this.zoneListeners(this.bindings.listeners) },\n this.applied,\n );\n });\n }\n\n ngOnDestroy(): void {\n detachElementListeners(this.host.nativeElement, this.applied.listeners);\n this.applied = EMPTY_APPLIED_ELEMENT_BINDINGS;\n }\n\n private zoneListeners(\n listeners: ElementBindings[\"listeners\"],\n ): Readonly<Record<string, ((event: Event) => void) | undefined>> {\n if (listeners === undefined) return {};\n const wrapped: Record<string, ((event: Event) => void) | undefined> = {};\n for (const [name, handler] of Object.entries(listeners)) {\n if (handler === undefined) continue;\n let entry = this.zoneWrapped.get(handler);\n if (entry === undefined) {\n entry = (event: Event) => this.zone.run(() => handler(event));\n this.zoneWrapped.set(handler, entry);\n }\n wrapped[name] = entry;\n }\n return wrapped;\n }\n}\n","import {\n type AfterViewInit,\n ChangeDetectorRef,\n Component,\n CUSTOM_ELEMENTS_SCHEMA,\n Input,\n inject,\n NgZone,\n type OnChanges,\n} from \"@angular/core\";\nimport {\n type CheckoutSnapshot,\n createWrapperCheckoutShellBinding,\n defineElements,\n type ThemePreference,\n validateCheckoutProps,\n type WrapperCheckoutShellBinding,\n type WrapperCheckoutShellOptions,\n} from \"@openreceive/angular\";\nimport type { ElementBindings } from \"./element-bindings\";\nimport { ElementBindingsDirective } from \"./openreceive-element-bindings.directive\";\n\n@Component({\n selector: \"openreceive-angular-checkout\",\n standalone: true,\n imports: [ElementBindingsDirective],\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <section [openreceiveElementBindings]=\"rootBindings\">\n @if (elementsReady && shell; as shell) {\n @if (shell.themeToggle) {\n <openreceive-theme-toggle\n [openreceiveElementBindings]=\"shell.themeToggle\"\n ></openreceive-theme-toggle>\n }\n <openreceive-checkout [openreceiveElementBindings]=\"shell.checkout\"></openreceive-checkout>\n }\n </section>\n `,\n})\nexport class CheckoutComponent implements AfterViewInit, OnChanges {\n // Prop names, defaults, and per-mode applicability are the shared contract in\n // docs/internal/wrapper-parity.md. These inputs RESTATE it because `@Input()`\n // is a decorator on a declared field: a type cannot generate fields, so they\n // cannot be derived from WrapperCheckoutComponentProps the way\n // Vue's defineProps and React's CheckoutProps are. The duplication is forced,\n // not neglected; tests/wrapper-parity.test.mjs is what keeps it in step.\n // Snapshot mode: bind a `checkout` to render it directly.\n // Create mode: omit `checkout` and bind `reference` (+ optional `prefix`); the underlying\n // <openreceive-checkout> element creates the checkout, then renders and polls itself.\n @Input() checkout?: CheckoutSnapshot | null;\n @Input() reference?: string;\n @Input() prefix?: string;\n @Input() paymentWizard?: boolean;\n @Input() decodeLinkUrl?: string;\n @Input() assetBaseUrl?: string;\n @Input() themeToggle?: boolean;\n @Input() defaultTheme?: ThemePreference;\n @Input() storageKey?: string;\n // Create mode only.\n @Input() metadata?: Record<string, unknown>;\n @Input() syncUrl?: boolean;\n @Input() resumePathPrefix?: string;\n @Input() routeReference?: string;\n @Input() resumePaymentHash?: string;\n @Input() resumable?: boolean;\n @Input() onCopy?: (event: Event) => void;\n @Input() onOpenWallet?: (event: Event) => void;\n @Input() onState?: (event: Event) => void;\n @Input() onSettled?: (event: Event) => void;\n @Input() onProviderCopy?: (event: Event) => void;\n @Input() onStartOver?: (event: Event) => void;\n @Input() onError?: (event: Event) => void;\n @Input() options: WrapperCheckoutShellOptions = {};\n\n /**\n * The custom elements render only once this flips, and it flips inside\n * `runOutsideAngular`: the element starts poll and countdown timers in its\n * connected callback, and zone-patched timers would schedule a change-detection\n * pass on every tick for the lifetime of the checkout.\n */\n protected elementsReady = false;\n\n private readonly zone = inject(NgZone);\n private readonly changeDetector = inject(ChangeDetectorRef);\n\n // Rebuilt on input changes only. A getter would rebuild the whole binding\n // (storage reads, matchMedia, fresh objects) on every change-detection pass.\n // Null until the first `ngOnChanges`: inputs are not set yet at construction,\n // so building (and validating) here would reject every instantiation.\n protected shellBinding: WrapperCheckoutShellBinding | null = null;\n\n // The shell root's attributes, driven by the same directive as the custom\n // elements: a hand-transcribed [attr.*] list would silently drop any root\n // attribute the shared factory later adds.\n protected rootBindings: ElementBindings = {};\n\n ngAfterViewInit(): void {\n // No-op during Angular Universal SSR: custom elements only exist in the\n // browser, and the element renders itself after hydration.\n if (globalThis.customElements === undefined || globalThis.HTMLElement === undefined) return;\n this.zone.runOutsideAngular(() => {\n defineElements();\n this.elementsReady = true;\n // Rebuild so the mounted shell carries the stored theme, not the deferred default.\n this.applyShell();\n this.changeDetector.detectChanges();\n });\n }\n\n ngOnChanges(): void {\n this.applyShell();\n }\n\n get shell(): WrapperCheckoutShellBinding | null {\n return this.shellBinding;\n }\n\n private applyShell(): void {\n this.shellBinding = this.buildShell();\n this.rootBindings = { attributes: this.shellBinding.rootAttributes };\n }\n\n private buildShell(): WrapperCheckoutShellBinding {\n validateCheckoutProps({\n framework: \"@openreceive/angular\",\n checkout: this.checkout,\n reference: this.reference,\n metadata: this.metadata,\n syncUrl: this.syncUrl,\n resumePathPrefix: this.resumePathPrefix,\n routeReference: this.routeReference,\n resumePaymentHash: this.resumePaymentHash,\n });\n const options: WrapperCheckoutShellOptions = {\n ...this.options,\n themeToggle: this.themeToggle ?? this.options.themeToggle ?? true,\n // Storage and matchMedia only exist in the browser: resolving the theme before\n // the elements mount would make a server-rendered shell disagree with hydration.\n deferThemeResolution: !this.elementsReady,\n ...(this.reference === undefined ? {} : { reference: this.reference }),\n ...(this.prefix === undefined ? {} : { prefix: this.prefix }),\n ...(this.paymentWizard === undefined ? {} : { paymentWizard: this.paymentWizard }),\n ...(this.decodeLinkUrl === undefined ? {} : { decodeLinkUrl: this.decodeLinkUrl }),\n ...(this.assetBaseUrl === undefined ? {} : { assetBaseUrl: this.assetBaseUrl }),\n ...(this.defaultTheme === undefined ? {} : { defaultTheme: this.defaultTheme }),\n ...(this.storageKey === undefined ? {} : { storageKey: this.storageKey }),\n ...(this.metadata === undefined ? {} : { metadata: this.metadata }),\n ...(this.syncUrl === undefined ? {} : { syncUrl: this.syncUrl }),\n ...(this.resumePathPrefix === undefined ? {} : { resumePathPrefix: this.resumePathPrefix }),\n ...(this.routeReference === undefined ? {} : { routeReference: this.routeReference }),\n ...(this.resumePaymentHash === undefined\n ? {}\n : { resumePaymentHash: this.resumePaymentHash }),\n ...(this.resumable === undefined ? {} : { resumable: this.resumable }),\n ...(this.onCopy === undefined ? {} : { onCopy: this.onCopy }),\n ...(this.onOpenWallet === undefined ? {} : { onOpenWallet: this.onOpenWallet }),\n ...(this.onState === undefined ? {} : { onState: this.onState }),\n ...(this.onSettled === undefined ? {} : { onSettled: this.onSettled }),\n ...(this.onProviderCopy === undefined ? {} : { onProviderCopy: this.onProviderCopy }),\n ...(this.onStartOver === undefined ? {} : { onStartOver: this.onStartOver }),\n ...(this.onError === undefined ? {} : { onError: this.onError }),\n };\n return createWrapperCheckoutShellBinding(this.checkout ?? null, options);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './openreceive-checkout.component';\n"],"names":[],"mappings":";;;;AAAA;;;;;;;AAOG;AAsBI,MAAM,8BAA8B,GAA2B;AACpE,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,SAAS,EAAE,EAAE;CACd;SAEe,oBAAoB,CAClC,OAA6B,EAC7B,QAAyB,EACzB,OAA+B,EAAA;IAE/B,OAAO;AACL,QAAA,UAAU,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,IAAI,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC;AAClF,QAAA,SAAS,EAAE,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC;KAC/E;AACH;AAEM,SAAU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;;;;;;;AAWT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAbS,wBAAwB,EAAA,QAAA,EAAA,8BAAA,EAAA,MAAA,EAAA,CAAA,4BAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAevB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAlB7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,8BAA8B;AACxC,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,wBAAwB,CAAC;oBACnC,OAAO,EAAE,CAAC,sBAAsB,CAAC;AACjC,oBAAA,QAAQ,EAAE;;;;;;;;;;;AAWT,EAAA,CAAA;AACF,iBAAA;;sBAWE;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;;ACzEH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"openreceive-angular-checkout-component.mjs","sources":["../../src/element-bindings.ts","../../src/openreceive-element-bindings.directive.ts","../../src/openreceive-checkout.component.ts","../../src/openreceive-angular-checkout-component.ts"],"sourcesContent":["/**\n * Applying a wrapper binding to a custom element, independent of Angular.\n *\n * Angular templates can only bind attribute names written out literally, so a\n * hand-transcribed `[attr.*]` list silently drops any attribute the shared\n * factory later adds. Driving attributes and listeners from the binding object\n * keeps Angular in step with the other wrappers by construction.\n */\n\nexport interface ElementBindings {\n readonly attributes?: Readonly<Record<string, string | undefined>>;\n readonly listeners?: Readonly<Record<string, ((event: Event) => void) | undefined>>;\n}\n\nexport interface ElementBindingTarget {\n getAttribute(name: string): string | null;\n setAttribute(name: string, value: string): void;\n removeAttribute(name: string): void;\n addEventListener(name: string, listener: (event: Event) => void): void;\n removeEventListener(name: string, listener: (event: Event) => void): void;\n}\n\nexport type AttachedListeners = readonly (readonly [string, (event: Event) => void])[];\n\nexport interface AppliedElementBindings {\n readonly attributes: readonly string[];\n readonly listeners: AttachedListeners;\n}\n\nexport const EMPTY_APPLIED_ELEMENT_BINDINGS: AppliedElementBindings = {\n attributes: [],\n listeners: [],\n};\n\nexport function applyElementBindings(\n element: ElementBindingTarget,\n bindings: ElementBindings,\n applied: AppliedElementBindings,\n): AppliedElementBindings {\n return {\n attributes: syncAttributes(element, bindings.attributes ?? {}, applied.attributes),\n listeners: syncListeners(element, bindings.listeners ?? {}, applied.listeners),\n };\n}\n\nexport function detachElementListeners(\n element: ElementBindingTarget,\n listeners: AttachedListeners,\n): void {\n for (const [name, handler] of listeners) element.removeEventListener(name, handler);\n}\n\nfunction syncAttributes(\n element: ElementBindingTarget,\n attributes: Readonly<Record<string, string | undefined>>,\n applied: readonly string[],\n): readonly string[] {\n for (const name of applied) {\n if (attributes[name] === undefined) element.removeAttribute(name);\n }\n const next: string[] = [];\n for (const [name, value] of Object.entries(attributes)) {\n if (value === undefined) continue;\n if (element.getAttribute(name) !== value) element.setAttribute(name, value);\n next.push(name);\n }\n return next;\n}\n\nfunction syncListeners(\n element: ElementBindingTarget,\n listeners: Readonly<Record<string, ((event: Event) => void) | undefined>>,\n attached: AttachedListeners,\n): AttachedListeners {\n const next = Object.entries(listeners).flatMap(([name, handler]) =>\n handler === undefined ? [] : [[name, handler] as const],\n );\n const unchanged =\n next.length === attached.length &&\n next.every(([name, handler], index) => {\n const current = attached[index];\n return current !== undefined && current[0] === name && current[1] === handler;\n });\n if (unchanged) return attached;\n detachElementListeners(element, attached);\n for (const [name, handler] of next) element.addEventListener(name, handler);\n return next;\n}\n","import {\n Directive,\n ElementRef,\n Input,\n NgZone,\n inject,\n type OnChanges,\n type OnDestroy,\n} from \"@angular/core\";\nimport {\n type AppliedElementBindings,\n EMPTY_APPLIED_ELEMENT_BINDINGS,\n type ElementBindings,\n applyElementBindings,\n detachElementListeners,\n} from \"./element-bindings\";\n\n/** Applies a wrapper binding's attributes and listeners to the element host. */\n@Directive({\n selector: \"[openreceiveElementBindings]\",\n standalone: true,\n})\nexport class ElementBindingsDirective implements OnChanges, OnDestroy {\n @Input(\"openreceiveElementBindings\") bindings: ElementBindings = {};\n\n private applied: AppliedElementBindings = EMPTY_APPLIED_ELEMENT_BINDINGS;\n // Zone-wrapped handlers are cached per original handler: the applier compares\n // identity to decide whether to re-attach, so a fresh wrapper each pass would\n // detach and re-add every listener on every change.\n private readonly zoneWrapped = new WeakMap<(event: Event) => void, (event: Event) => void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly zone = inject(NgZone);\n\n ngOnChanges(): void {\n // Setting attributes restarts the element's poll/countdown timers. Applying them\n // outside Angular keeps those timers unpatched, so they never schedule a change\n // detection pass; the listeners below re-enter the zone for host callbacks.\n this.zone.runOutsideAngular(() => {\n this.applied = applyElementBindings(\n this.host.nativeElement,\n { ...this.bindings, listeners: this.zoneListeners(this.bindings.listeners) },\n this.applied,\n );\n });\n }\n\n ngOnDestroy(): void {\n detachElementListeners(this.host.nativeElement, this.applied.listeners);\n this.applied = EMPTY_APPLIED_ELEMENT_BINDINGS;\n }\n\n private zoneListeners(\n listeners: ElementBindings[\"listeners\"],\n ): Readonly<Record<string, ((event: Event) => void) | undefined>> {\n if (listeners === undefined) return {};\n const wrapped: Record<string, ((event: Event) => void) | undefined> = {};\n for (const [name, handler] of Object.entries(listeners)) {\n if (handler === undefined) continue;\n let entry = this.zoneWrapped.get(handler);\n if (entry === undefined) {\n entry = (event: Event) => this.zone.run(() => handler(event));\n this.zoneWrapped.set(handler, entry);\n }\n wrapped[name] = entry;\n }\n return wrapped;\n }\n}\n","import {\n type AfterViewInit,\n ChangeDetectorRef,\n Component,\n CUSTOM_ELEMENTS_SCHEMA,\n Input,\n inject,\n NgZone,\n type OnChanges,\n} from \"@angular/core\";\nimport {\n type CheckoutSnapshot,\n createWrapperCheckoutShellBinding,\n defineElements,\n type ThemePreference,\n validateCheckoutProps,\n type WrapperCheckoutShellBinding,\n type WrapperCheckoutShellOptions,\n} from \"@openreceive/angular\";\nimport type { ElementBindings } from \"./element-bindings\";\nimport { ElementBindingsDirective } from \"./openreceive-element-bindings.directive\";\n\n@Component({\n selector: \"openreceive-angular-checkout\",\n standalone: true,\n imports: [ElementBindingsDirective],\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `\n <section [openreceiveElementBindings]=\"rootBindings\">\n @if (elementsReady && shell; as shell) {\n @if (shell.themeToggle) {\n <openreceive-theme-toggle\n [openreceiveElementBindings]=\"shell.themeToggle\"\n ></openreceive-theme-toggle>\n }\n <openreceive-checkout [openreceiveElementBindings]=\"shell.checkout\"></openreceive-checkout>\n }\n </section>\n `,\n})\nexport class CheckoutComponent implements AfterViewInit, OnChanges {\n // Prop names, defaults, and per-mode applicability are the shared contract in\n // docs/internal/wrapper-parity.md. These inputs RESTATE it because `@Input()`\n // is a decorator on a declared field: a type cannot generate fields, so they\n // cannot be derived from WrapperCheckoutComponentProps the way\n // Vue's defineProps and React's CheckoutProps are. The duplication is forced,\n // not neglected; tests/wrapper-parity.test.mjs is what keeps it in step.\n // Snapshot mode: bind a `checkout` to render it directly.\n // Create mode: omit `checkout` and bind `reference` (+ optional `prefix`); the underlying\n // <openreceive-checkout> element creates the checkout, then renders and polls itself.\n @Input() checkout?: CheckoutSnapshot | null;\n @Input() reference?: string;\n @Input() prefix?: string;\n @Input() csrfHeader?: string;\n @Input() paymentWizard?: boolean;\n @Input() decodeLinkUrl?: string;\n @Input() themeToggle?: boolean;\n @Input() defaultTheme?: ThemePreference;\n @Input() storageKey?: string;\n // Create mode only.\n @Input() metadata?: Record<string, unknown>;\n @Input() syncUrl?: boolean;\n @Input() resumePathPrefix?: string;\n @Input() routeReference?: string;\n @Input() resumePaymentHash?: string;\n @Input() resumable?: boolean;\n @Input() onCopy?: (event: Event) => void;\n @Input() onOpenWallet?: (event: Event) => void;\n @Input() onState?: (event: Event) => void;\n @Input() onSettled?: (event: Event) => void;\n @Input() onProviderCopy?: (event: Event) => void;\n @Input() onStartOver?: (event: Event) => void;\n @Input() onError?: (event: Event) => void;\n @Input() options: WrapperCheckoutShellOptions = {};\n\n /**\n * The custom elements render only once this flips, and it flips inside\n * `runOutsideAngular`: the element starts poll and countdown timers in its\n * connected callback, and zone-patched timers would schedule a change-detection\n * pass on every tick for the lifetime of the checkout.\n */\n protected elementsReady = false;\n\n private readonly zone = inject(NgZone);\n private readonly changeDetector = inject(ChangeDetectorRef);\n\n // Rebuilt on input changes only. A getter would rebuild the whole binding\n // (storage reads, matchMedia, fresh objects) on every change-detection pass.\n // Null until the first `ngOnChanges`: inputs are not set yet at construction,\n // so building (and validating) here would reject every instantiation.\n protected shellBinding: WrapperCheckoutShellBinding | null = null;\n\n // The shell root's attributes, driven by the same directive as the custom\n // elements: a hand-transcribed [attr.*] list would silently drop any root\n // attribute the shared factory later adds.\n protected rootBindings: ElementBindings = {};\n\n ngAfterViewInit(): void {\n // No-op during Angular Universal SSR: custom elements only exist in the\n // browser, and the element renders itself after hydration.\n if (globalThis.customElements === undefined || globalThis.HTMLElement === undefined) return;\n this.zone.runOutsideAngular(() => {\n defineElements();\n this.elementsReady = true;\n // Rebuild so the mounted shell carries the stored theme, not the deferred default.\n this.applyShell();\n this.changeDetector.detectChanges();\n });\n }\n\n ngOnChanges(): void {\n this.applyShell();\n }\n\n get shell(): WrapperCheckoutShellBinding | null {\n return this.shellBinding;\n }\n\n private applyShell(): void {\n this.shellBinding = this.buildShell();\n this.rootBindings = { attributes: this.shellBinding.rootAttributes };\n }\n\n private buildShell(): WrapperCheckoutShellBinding {\n validateCheckoutProps({\n framework: \"@openreceive/angular\",\n checkout: this.checkout,\n reference: this.reference,\n metadata: this.metadata,\n syncUrl: this.syncUrl,\n resumePathPrefix: this.resumePathPrefix,\n routeReference: this.routeReference,\n resumePaymentHash: this.resumePaymentHash,\n });\n const options: WrapperCheckoutShellOptions = {\n ...this.options,\n themeToggle: this.themeToggle ?? this.options.themeToggle ?? true,\n // Storage and matchMedia only exist in the browser: resolving the theme before\n // the elements mount would make a server-rendered shell disagree with hydration.\n deferThemeResolution: !this.elementsReady,\n ...(this.reference === undefined ? {} : { reference: this.reference }),\n ...(this.prefix === undefined ? {} : { prefix: this.prefix }),\n ...(this.csrfHeader === undefined ? {} : { csrfHeader: this.csrfHeader }),\n ...(this.paymentWizard === undefined ? {} : { paymentWizard: this.paymentWizard }),\n ...(this.decodeLinkUrl === undefined ? {} : { decodeLinkUrl: this.decodeLinkUrl }),\n ...(this.defaultTheme === undefined ? {} : { defaultTheme: this.defaultTheme }),\n ...(this.storageKey === undefined ? {} : { storageKey: this.storageKey }),\n ...(this.metadata === undefined ? {} : { metadata: this.metadata }),\n ...(this.syncUrl === undefined ? {} : { syncUrl: this.syncUrl }),\n ...(this.resumePathPrefix === undefined ? {} : { resumePathPrefix: this.resumePathPrefix }),\n ...(this.routeReference === undefined ? {} : { routeReference: this.routeReference }),\n ...(this.resumePaymentHash === undefined\n ? {}\n : { resumePaymentHash: this.resumePaymentHash }),\n ...(this.resumable === undefined ? {} : { resumable: this.resumable }),\n ...(this.onCopy === undefined ? {} : { onCopy: this.onCopy }),\n ...(this.onOpenWallet === undefined ? {} : { onOpenWallet: this.onOpenWallet }),\n ...(this.onState === undefined ? {} : { onState: this.onState }),\n ...(this.onSettled === undefined ? {} : { onSettled: this.onSettled }),\n ...(this.onProviderCopy === undefined ? {} : { onProviderCopy: this.onProviderCopy }),\n ...(this.onStartOver === undefined ? {} : { onStartOver: this.onStartOver }),\n ...(this.onError === undefined ? {} : { onError: this.onError }),\n };\n return createWrapperCheckoutShellBinding(this.checkout ?? null, options);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './openreceive-checkout.component';\n"],"names":[],"mappings":";;;;AAAA;;;;;;;AAOG;AAsBI,MAAM,8BAA8B,GAA2B;AACpE,IAAA,UAAU,EAAE,EA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AAA,EAAA,cAAA,EAAA,gBAAA,EAAA,iBAAA,EAAA,mBAAA,EAAA,SAAA,EAAA,WAAA,EAAA,MAAA,EAAA,QAAA,EAAA,YAAA,EAAA,cAAA,EAAA,OAAA,EAAA,SAAA,EAAA,SAAA,EAAA,WAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,OAAA,EAAA,SAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAblB;;;;;;;;;;;AAWT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAbS,wBAAwB,EAAA,QAAA,EAAA,8BAAA,EAAA,MAAA,EAAA,CAAA,4BAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAevB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAlB7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,8BAA8B;AACxC,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,wBAAwB,CAAC;oBACnC,OAAO,EAAE,CAAC,sBAAsB,CAAC;AACjC,oBAAA,QAAQ,EAAE;;;;;;;;;;;AAWT,EAAA,CAAA;AACF,iBAAA;;sBAWE;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;;ACzEH;;AAEG;;;;"}
|
|
@@ -19,9 +19,9 @@ declare class CheckoutComponent implements AfterViewInit, OnChanges {
|
|
|
19
19
|
checkout?: CheckoutSnapshot | null;
|
|
20
20
|
reference?: string;
|
|
21
21
|
prefix?: string;
|
|
22
|
+
csrfHeader?: string;
|
|
22
23
|
paymentWizard?: boolean;
|
|
23
24
|
decodeLinkUrl?: string;
|
|
24
|
-
assetBaseUrl?: string;
|
|
25
25
|
themeToggle?: boolean;
|
|
26
26
|
defaultTheme?: ThemePreference;
|
|
27
27
|
storageKey?: string;
|
|
@@ -56,7 +56,7 @@ declare class CheckoutComponent implements AfterViewInit, OnChanges {
|
|
|
56
56
|
private applyShell;
|
|
57
57
|
private buildShell;
|
|
58
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutComponent, never>;
|
|
59
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CheckoutComponent, "openreceive-angular-checkout", never, { "checkout": { "alias": "checkout"; "required": false; }; "reference": { "alias": "reference"; "required": false; }; "prefix": { "alias": "prefix"; "required": false; }; "
|
|
59
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CheckoutComponent, "openreceive-angular-checkout", never, { "checkout": { "alias": "checkout"; "required": false; }; "reference": { "alias": "reference"; "required": false; }; "prefix": { "alias": "prefix"; "required": false; }; "csrfHeader": { "alias": "csrfHeader"; "required": false; }; "paymentWizard": { "alias": "paymentWizard"; "required": false; }; "decodeLinkUrl": { "alias": "decodeLinkUrl"; "required": false; }; "themeToggle": { "alias": "themeToggle"; "required": false; }; "defaultTheme": { "alias": "defaultTheme"; "required": false; }; "storageKey": { "alias": "storageKey"; "required": false; }; "metadata": { "alias": "metadata"; "required": false; }; "syncUrl": { "alias": "syncUrl"; "required": false; }; "resumePathPrefix": { "alias": "resumePathPrefix"; "required": false; }; "routeReference": { "alias": "routeReference"; "required": false; }; "resumePaymentHash": { "alias": "resumePaymentHash"; "required": false; }; "resumable": { "alias": "resumable"; "required": false; }; "onCopy": { "alias": "onCopy"; "required": false; }; "onOpenWallet": { "alias": "onOpenWallet"; "required": false; }; "onState": { "alias": "onState"; "required": false; }; "onSettled": { "alias": "onSettled"; "required": false; }; "onProviderCopy": { "alias": "onProviderCopy"; "required": false; }; "onStartOver": { "alias": "onStartOver"; "required": false; }; "onError": { "alias": "onError"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, {}, never, never, true, never>;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export { CheckoutComponent };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openreceive/angular",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Angular wrapper for the OpenReceive checkout custom element.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"module": "./dist/fesm2022/openreceive-angular.mjs",
|
|
21
21
|
"types": "./dist/types/openreceive-angular.d.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@openreceive/browser": "0.4.
|
|
24
|
-
"@openreceive/elements": "0.4.
|
|
23
|
+
"@openreceive/browser": "0.4.5",
|
|
24
|
+
"@openreceive/elements": "0.4.5"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@angular/core": ">=17.0.0"
|
|
@@ -5,7 +5,8 @@ description: >
|
|
|
5
5
|
Use when adding Bitcoin, Lightning, or crypto checkout to a Node.js, Express,
|
|
6
6
|
Fastify, Next.js, Rails, React, Vue, Svelte, Angular, or plain-HTML
|
|
7
7
|
application with OpenReceive (the @openreceive/* npm packages or the
|
|
8
|
-
openreceive-rails gem)
|
|
8
|
+
openreceive-rails gem), or when connecting a BTCPay Server store to a
|
|
9
|
+
receive-only NWC wallet with the OpenReceive plugin.
|
|
9
10
|
license: MIT
|
|
10
11
|
---
|
|
11
12
|
|
|
@@ -23,15 +24,25 @@ code** (`NWC_URI`).
|
|
|
23
24
|
1. Identify the server stack of the application you are in.
|
|
24
25
|
2. Open the matching reference — it is complete (quickstart inlined) and needs
|
|
25
26
|
no network access:
|
|
26
|
-
- Node
|
|
27
|
+
- Node, Express: [references/node.md](references/node.md)
|
|
28
|
+
- Node, Fastify: [references/fastify.md](references/fastify.md)
|
|
29
|
+
- Node, Next.js App Router: [references/next.md](references/next.md)
|
|
27
30
|
- Rails: [references/rails.md](references/rails.md)
|
|
31
|
+
- Django: [references/django.md](references/django.md)
|
|
32
|
+
- Laravel: [references/laravel.md](references/laravel.md)
|
|
33
|
+
- WordPress + WooCommerce: [references/woocommerce.md](references/woocommerce.md) — the packaged gateway and merchant settings.
|
|
34
|
+
- BTCPay Server: [references/btcpay.md](references/btcpay.md) — a plugin,
|
|
35
|
+
configured in BTCPay's store UI or Greenfield API; no application code,
|
|
36
|
+
no npm packages, no gem. The rest of this file is about the library.
|
|
28
37
|
3. Follow its **Step 0** first: confirm `NWC_URI` is set in the server
|
|
29
38
|
environment before writing code. Never print the value; never invent a
|
|
30
39
|
placeholder.
|
|
31
40
|
|
|
32
|
-
Install
|
|
33
|
-
|
|
34
|
-
`
|
|
41
|
+
Install, per adapter — Express: `npm install @openreceive/express @openreceive/react`;
|
|
42
|
+
Fastify: `npm install @openreceive/fastify @openreceive/react`; Next.js:
|
|
43
|
+
`npm install @openreceive/next @openreceive/react`. Swap the UI package (`vue`,
|
|
44
|
+
`svelte`, `angular`, `elements`) for the frontend the app already has. Install
|
|
45
|
+
(Rails): `bundle add openreceive-rails`.
|
|
35
46
|
|
|
36
47
|
## The three server objects
|
|
37
48
|
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# OpenReceive agent directions (BTCPay Server)
|
|
2
|
+
|
|
3
|
+
These directions describe OpenReceive 0.4.5.
|
|
4
|
+
|
|
5
|
+
Connect a BTCPay Server store to a receive-only NWC wallet with the OpenReceive
|
|
6
|
+
plugin, and optionally let payers pay BTCPay invoices with USDT, USDC, ETH or
|
|
7
|
+
SOL. You do not need a copy of the OpenReceive source, and there is no
|
|
8
|
+
application code to write: the plugin is configured through BTCPay's store UI
|
|
9
|
+
or its Greenfield API, and the quickstart is appended to this file in full.
|
|
10
|
+
|
|
11
|
+
This is the BTCPay plugin, not the Node or Rails library. Do not install
|
|
12
|
+
`@openreceive/*` packages or the `openreceive-rails` gem into a BTCPay
|
|
13
|
+
deployment, do not add `openreceive_payments` tables, and do not mount
|
|
14
|
+
OpenReceive HTTP routes. BTCPay's invoices, checkout, webhooks and Greenfield
|
|
15
|
+
API are the host; the plugin only supplies the Lightning backend and the swap
|
|
16
|
+
rail.
|
|
17
|
+
|
|
18
|
+
## What the plugin is
|
|
19
|
+
|
|
20
|
+
A BTCPay Server plugin (`BTCPayServer.Plugins.OpenReceive`) that registers a
|
|
21
|
+
Lightning connection-string handler for `type=openreceive;nwc=<NWC URI>`.
|
|
22
|
+
Saving that string makes the NWC wallet the store's Lightning node: BTCPay
|
|
23
|
+
mints every Lightning invoice in that wallet and its own `LightningListener`
|
|
24
|
+
records the payments. The plugin never calls a NIP-47 `pay_*` method, so
|
|
25
|
+
every send-side BTCPay feature (Lightning payouts, pull-payment refunds over
|
|
26
|
+
Lightning, the send tab) is unavailable by design.
|
|
27
|
+
|
|
28
|
+
The one required credential is a receive-only NWC code. A Lightning Swap
|
|
29
|
+
Connect (LSC) code optionally adds server-side swaps: a provider order aimed at
|
|
30
|
+
the invoice's existing BOLT11, tracked in the plugin's own table, with the
|
|
31
|
+
refund path on the same checkout screen.
|
|
32
|
+
|
|
33
|
+
## Step 0 — check the deployment before you change anything
|
|
34
|
+
|
|
35
|
+
1. Confirm the BTCPay Server version is 2.4.2 or later (Server Settings →
|
|
36
|
+
About, or `GET /api/v1/server/info`). The plugin declares that minimum and
|
|
37
|
+
BTCPay refuses to load it below.
|
|
38
|
+
2. Check whether the plugin is installed (Server Settings → Plugins, or the
|
|
39
|
+
store navigation shows an "OpenReceive" entry). If not, install it from the
|
|
40
|
+
BTCPay plugin directory (Server Settings → Plugins, search "OpenReceive"),
|
|
41
|
+
as the quickstart says; do not invent an installer command.
|
|
42
|
+
3. Check whether the store already has an OpenReceive connection:
|
|
43
|
+
`GET /api/v1/stores/{storeId}/openreceive/settings` returns
|
|
44
|
+
`lightningNodeIsOpenReceive`. If true, the wallet step is done — go to
|
|
45
|
+
swaps only if the user wants them.
|
|
46
|
+
4. If no receive-only NWC code is available, stop and tell the user exactly
|
|
47
|
+
what to create:
|
|
48
|
+
|
|
49
|
+
> OpenReceive cannot mint an invoice without a receive-only NWC code. Get
|
|
50
|
+
> one at https://openreceive.org/get_a_nwc_code_to_receive_payments and
|
|
51
|
+
> paste it into Store → OpenReceive → Test connection, or hand it to me and
|
|
52
|
+
> I will set it through the Greenfield API.
|
|
53
|
+
|
|
54
|
+
Never print, log or echo the code; report only whether it is set. Never
|
|
55
|
+
paste a bare `nostr+walletconnect://` string into BTCPay's Lightning node
|
|
56
|
+
screen — that form is claimed by the Nostr plugin, without the receive-only
|
|
57
|
+
guard.
|
|
58
|
+
5. If the user wants altcoin payments, ask for an LSC code from
|
|
59
|
+
https://openreceive.org/set_up_swap_provider. Do not wait for it: the
|
|
60
|
+
wallet works without it, and swaps switch on later with one settings change.
|
|
61
|
+
|
|
62
|
+
Only then start the quickstart.
|
|
63
|
+
|
|
64
|
+
## Non-negotiables
|
|
65
|
+
|
|
66
|
+
- The connection string is `type=openreceive;nwc=<NWC URI>[;allow-spend=true]`
|
|
67
|
+
and nothing else. Set it through the setup page or
|
|
68
|
+
`PUT /api/v1/stores/{storeId}/openreceive/settings` with `nwcUri`, never by
|
|
69
|
+
editing BTCPay's Lightning node screen by hand.
|
|
70
|
+
- Receive-only is required. A code that advertises `pay_invoice` or another
|
|
71
|
+
spend method is refused on save. The override (`allowSpendCapableWallet`,
|
|
72
|
+
the checkbox on the setup page) is the user's explicit choice; never tick it
|
|
73
|
+
to make a save succeed.
|
|
74
|
+
- The wallet's network must match BTCPay's. A mismatch is a refusal, not a
|
|
75
|
+
warning.
|
|
76
|
+
- The wallet must grant `make_invoice` and `list_transactions`.
|
|
77
|
+
`lookup_invoice` is optional; do not ask the user for a code that grants it.
|
|
78
|
+
- Swaps require the store's Lightning node to be the OpenReceive connection.
|
|
79
|
+
Enabling swaps on a store using the internal node is refused
|
|
80
|
+
(`wallet_required`).
|
|
81
|
+
- Swaps set the store's invoice expiration to 60 minutes when it is shorter,
|
|
82
|
+
and the plugin refuses to create a swap on an invoice with less than the
|
|
83
|
+
provider's window left. Do not lower the expiration below 45 minutes on a
|
|
84
|
+
swap-enabled store.
|
|
85
|
+
- Top-up (amountless) invoices are unsupported on this backend. Do not
|
|
86
|
+
configure a point of sale or payment link that relies on them with this
|
|
87
|
+
wallet.
|
|
88
|
+
- Secrets stay server-side. The NWC code and LSC code live in BTCPay's
|
|
89
|
+
database like every other BTCPay credential; never copy them into
|
|
90
|
+
screenshots, tickets, browser code or logs. The provider's order token never
|
|
91
|
+
leaves the server.
|
|
92
|
+
- BTCPay's `LightningListener` is the settlement authority. Provider
|
|
93
|
+
`completed` is not payment; only the wallet reporting the Lightning invoice
|
|
94
|
+
settled is. Do not build anything that fulfils on a provider state.
|
|
95
|
+
- There is no merchant-initiated refund of a settled Lightning payment. A swap
|
|
96
|
+
refund is a payer reclaiming a deposit that never converted, and only from
|
|
97
|
+
the `refund_required` provider state.
|
|
98
|
+
|
|
99
|
+
## Verifying
|
|
100
|
+
|
|
101
|
+
Store → OpenReceive → **Run a health check** (the doctor page) runs every probe now: connection, preflight,
|
|
102
|
+
notifications, last scan, provider reachability, invoice expiration, swaps
|
|
103
|
+
needing attention. On a regtest machine, `packages/dotnet/docker/up.sh` then
|
|
104
|
+
`e2e.sh` in the OpenReceive repository proves the whole path end to end, and
|
|
105
|
+
that is the only situation where cloning the repository is the right move.
|
|
106
|
+
|
|
107
|
+
## More documentation
|
|
108
|
+
|
|
109
|
+
Fetch one when the moment comes. Each is raw markdown, so a plain GET is
|
|
110
|
+
enough; drop the `.md` for the same page a person would read.
|
|
111
|
+
|
|
112
|
+
- https://openreceive.org/guides/btcpay-reference.md — every setting, route, swap state, doctor probe and log event of the plugin
|
|
113
|
+
- https://openreceive.org/guides/security.md — why receive-only is the only wallet credential
|
|
114
|
+
- https://openreceive.org/guides/lightning-swap-connect.md — what an LSC code actually is
|
|
115
|
+
- https://openreceive.org/guides/automated-swaps.md — provider states, and what turning swaps on commits a merchant to
|
|
116
|
+
- https://openreceive.org/guides/swap-refunds.md — the refund states; the route back is BTCPay's own invoice checkout page here
|
|
117
|
+
- https://openreceive.org/guides.md — the index, if what you need is not above
|
|
118
|
+
|
|
119
|
+
Questions, or a problem with the plugin itself:
|
|
120
|
+
https://openreceive.org/contact
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## The quickstart, in full
|
|
125
|
+
|
|
126
|
+
Inlined verbatim so this file needs no network access — follow it once Step 0
|
|
127
|
+
passes. The page it comes from is https://openreceive.org/guides/quickstart-btcpay.
|
|
128
|
+
|
|
129
|
+
## BTCPay Server quickstart
|
|
130
|
+
|
|
131
|
+
Requires BTCPay Server ≥ 2.4.2.
|
|
132
|
+
|
|
133
|
+
The OpenReceive plugin makes a receive-only NWC wallet the Lightning node of a
|
|
134
|
+
BTCPay store. BTCPay mints every Lightning invoice in that wallet and records
|
|
135
|
+
payments through its own settlement machinery. Optionally, payers can pay a
|
|
136
|
+
BTCPay invoice with USDT, USDC, ETH or SOL through a Lightning Swap Connect
|
|
137
|
+
provider; the swap settles into the same wallet. The store's internal node is
|
|
138
|
+
never used.
|
|
139
|
+
|
|
140
|
+
This is not the Node or Rails library. There are no hooks, no
|
|
141
|
+
`openreceive_payments` table and no OpenReceive HTTP routes: BTCPay's
|
|
142
|
+
invoices, checkout, webhooks and Greenfield API are the host.
|
|
143
|
+
|
|
144
|
+
### 1. Prerequisites
|
|
145
|
+
|
|
146
|
+
- A BTCPay Server, version 2.4.2 or later, on any network (mainnet, testnet,
|
|
147
|
+
signet, regtest). The wallet must be on the same network.
|
|
148
|
+
- A receive-only NWC code for the wallet you want to receive into
|
|
149
|
+
([get one here](https://openreceive.org/get_a_nwc_code_to_receive_payments)).
|
|
150
|
+
The code must grant `make_invoice` and `list_transactions` and must not
|
|
151
|
+
advertise any spend method. `lookup_invoice` is optional.
|
|
152
|
+
- Optionally, a Lightning Swap Connect (LSC) code from a
|
|
153
|
+
[swap provider](https://openreceive.org/set_up_swap_provider), if payers
|
|
154
|
+
should be able to pay with USDT, USDC, ETH or SOL.
|
|
155
|
+
|
|
156
|
+
### 2. Install the plugin
|
|
157
|
+
|
|
158
|
+
In BTCPay, open **Server Settings → Plugins**, search the plugin directory
|
|
159
|
+
for **OpenReceive**, click **Install**, and restart BTCPay when prompted.
|
|
160
|
+
BTCPay creates the plugin's one table (`openreceive_swaps`, schema
|
|
161
|
+
`BTCPayServer.Plugins.OpenReceive`) in its own Postgres at startup; nothing
|
|
162
|
+
else is created.
|
|
163
|
+
|
|
164
|
+
To build the plugin from source instead, follow
|
|
165
|
+
[the .NET workspace README](https://github.com/OpenReceive/openreceive/blob/master/packages/dotnet/README.md).
|
|
166
|
+
|
|
167
|
+
### 3. Connect the wallet
|
|
168
|
+
|
|
169
|
+
Follow the plugin README's illustrated walkthrough:
|
|
170
|
+
[OpenReceive for BTCPay Server](https://github.com/OpenReceive/openreceive/blob/master/packages/dotnet/BTCPayServer.Plugins.OpenReceive/README.md).
|
|
171
|
+
It opens the **OpenReceive** page in the store's sidebar, saves the
|
|
172
|
+
receive-only NWC code, optionally saves the LSC code to turn swaps on, and
|
|
173
|
+
creates a first test invoice. There is nothing else to configure: you never
|
|
174
|
+
open BTCPay's Lightning node screen, and the plugin never reads the internal
|
|
175
|
+
node.
|
|
176
|
+
|
|
177
|
+
Saving fails closed if the wallet advertises a spend method such as
|
|
178
|
+
`pay_invoice`. Mint a receive-only code instead; the override for a wallet
|
|
179
|
+
that cannot is a deliberate, logged choice. Swaps raise the store's invoice
|
|
180
|
+
expiration to 60 minutes when it is shorter, because a swap needs at least 45
|
|
181
|
+
minutes of invoice life.
|
|
182
|
+
|
|
183
|
+
### 4. Check it
|
|
184
|
+
|
|
185
|
+
**Run a health check** on the OpenReceive page runs every probe in place:
|
|
186
|
+
the connection, the wallet preflight, payment notifications, the last wallet
|
|
187
|
+
scan, the swap provider and its assets, the invoice expiration, and swaps
|
|
188
|
+
that need a human. Each failing probe carries a fix link.
|
|
189
|
+
|
|
190
|
+
Every setting, Greenfield route, swap state, log event and probe is in the
|
|
191
|
+
[BTCPay plugin reference](https://openreceive.org/guides/btcpay-reference.md), including what is
|
|
192
|
+
unsupported by design: every send-side feature, top-up invoices, and a bare
|
|
193
|
+
`nostr+walletconnect://` string in BTCPay's Lightning node screen.
|