mirror of
https://github.com/bitbaum/paykit.git
synced 2026-12-04 07:29:31 +01:00
* feat: sell a time-boxed pass through a payment provider, Bitcoin through OrangeCat first - @bitbaum/paykit/checkout: PaymentProvider (createCheckout, status, verifyWebhook), Plan, Checkout, SettledEvent; entitlement helpers and applySettlement, idempotent on the payment id. - @bitbaum/paykit/orangecat: the account-less OrangeCat payment as a provider, and the X-OrangeCat-Signature check. Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * feat(orangecat): read the payee from OrangeCat payee(id) returns the receiving entity's name, its page and whether it shows an address to pay, so an app can say honestly that nobody can pay it yet. Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD
22 lines
864 B
JavaScript
22 lines
864 B
JavaScript
/**
|
|
* Taking a payment for a plan, whoever moves the money.
|
|
*
|
|
* An app describes what it sells (a `Plan`) and who is buying (its own
|
|
* `reference`). A provider turns that into something the buyer can pay, says
|
|
* whether it has been paid, and authenticates the provider's own "it settled"
|
|
* call. Nothing here names a provider: the same three calls fit a Lightning
|
|
* invoice and a hosted card checkout.
|
|
*/
|
|
/** One header, whatever shape the framework hands them over in. */
|
|
export function readHeader(headers, name) {
|
|
if (typeof headers.get === "function")
|
|
return headers.get(name);
|
|
const wanted = name.toLowerCase();
|
|
for (const [key, value] of Object.entries(headers)) {
|
|
if (key.toLowerCase() !== wanted)
|
|
continue;
|
|
return Array.isArray(value) ? (value[0] ?? null) : (value ?? null);
|
|
}
|
|
return null;
|
|
}
|