@bitpal/checkout 0.9.0 → 0.10.0
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/README.md +7 -0
- package/dist/index.cjs +6 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,6 +180,7 @@ app.post(
|
|
|
180
180
|
| `checkout.session.expired` | Session expired unpaid |
|
|
181
181
|
| `checkout.session.unresolved` | Underpaid / overpaid / wrong token — needs review |
|
|
182
182
|
| `checkout.refund.recorded` | An on-chain auto-refund (over / under / late payment) was recorded |
|
|
183
|
+
| `x402.payment.resolved` | An x402 payment that `/settle` left unresolved was later settled on-chain (see below) |
|
|
183
184
|
|
|
184
185
|
### ⚠️ Replay defense + at-least-once delivery
|
|
185
186
|
|
|
@@ -227,6 +228,12 @@ handler with `X-PAYMENT-RESPONSE` set. The middleware also does what the API can
|
|
|
227
228
|
timeout — answers `503` and asks for a retry with the *same* header. Handing back a `402` there
|
|
228
229
|
would make the caller re-sign and pay twice.
|
|
229
230
|
|
|
231
|
+
When `/settle` answers `503`, nobody knows yet whether the money moved — so BitPal watches the chain
|
|
232
|
+
and tells you how it ended with a **`x402.payment.resolved`** webhook (`status`: `confirmed` |
|
|
233
|
+
`reverted` | `expired`, plus `payment_id` and `tx_hash`). It fires only on that path: the normal case
|
|
234
|
+
already returned the result to you, and you should not have to handle the same outcome twice. Verify
|
|
235
|
+
it exactly like a checkout webhook.
|
|
236
|
+
|
|
230
237
|
Not on Express? `X402Gate` is the framework-neutral core — give it the header and the resource URL,
|
|
231
238
|
it tells you whether to bill or serve. On a `settled` result, call `commit()` once you have delivered
|
|
232
239
|
the response, or `release()` if you could not.
|
package/dist/index.cjs
CHANGED
|
@@ -351,7 +351,12 @@ var CHECKOUT_WEBHOOK_EVENTS = [
|
|
|
351
351
|
"checkout.session.settled",
|
|
352
352
|
"checkout.session.expired",
|
|
353
353
|
"checkout.session.unresolved",
|
|
354
|
-
"checkout.refund.recorded"
|
|
354
|
+
"checkout.refund.recorded",
|
|
355
|
+
// x402 결제의 **사후** 확정. 정상 경로(/settle 이 그 자리에서 결과를 반환)는 발행되지 않는다 —
|
|
356
|
+
// 이미 아는 결과를 중복으로 받지 않게 하기 위함이다. /settle 이 503 을 반환해 결과를 모른 채
|
|
357
|
+
// 남았을 때, reconciler 가 체인을 보고 종결시키면 이 이벤트가 온다.
|
|
358
|
+
// payload: { payment_id, status: 'confirmed'|'reverted'|'expired', tx_hash, resource, amount, … }
|
|
359
|
+
"x402.payment.resolved"
|
|
355
360
|
];
|
|
356
361
|
var WEBHOOK_HEADERS = {
|
|
357
362
|
signature: "X-Webhook-Signature-256",
|
package/dist/index.d.cts
CHANGED
|
@@ -584,7 +584,7 @@ declare class BitPalError extends Error {
|
|
|
584
584
|
/**
|
|
585
585
|
* BitPal 이 발송하는 webhook 이벤트 타입 전체 목록.
|
|
586
586
|
*/
|
|
587
|
-
declare const CHECKOUT_WEBHOOK_EVENTS: readonly ["checkout.session.created", "checkout.session.deposit_detected", "checkout.session.paid", "checkout.session.settled", "checkout.session.expired", "checkout.session.unresolved", "checkout.refund.recorded"];
|
|
587
|
+
declare const CHECKOUT_WEBHOOK_EVENTS: readonly ["checkout.session.created", "checkout.session.deposit_detected", "checkout.session.paid", "checkout.session.settled", "checkout.session.expired", "checkout.session.unresolved", "checkout.refund.recorded", "x402.payment.resolved"];
|
|
588
588
|
type CheckoutWebhookEvent = (typeof CHECKOUT_WEBHOOK_EVENTS)[number];
|
|
589
589
|
/**
|
|
590
590
|
* Canonical envelope (HTTP body).
|
package/dist/index.d.ts
CHANGED
|
@@ -584,7 +584,7 @@ declare class BitPalError extends Error {
|
|
|
584
584
|
/**
|
|
585
585
|
* BitPal 이 발송하는 webhook 이벤트 타입 전체 목록.
|
|
586
586
|
*/
|
|
587
|
-
declare const CHECKOUT_WEBHOOK_EVENTS: readonly ["checkout.session.created", "checkout.session.deposit_detected", "checkout.session.paid", "checkout.session.settled", "checkout.session.expired", "checkout.session.unresolved", "checkout.refund.recorded"];
|
|
587
|
+
declare const CHECKOUT_WEBHOOK_EVENTS: readonly ["checkout.session.created", "checkout.session.deposit_detected", "checkout.session.paid", "checkout.session.settled", "checkout.session.expired", "checkout.session.unresolved", "checkout.refund.recorded", "x402.payment.resolved"];
|
|
588
588
|
type CheckoutWebhookEvent = (typeof CHECKOUT_WEBHOOK_EVENTS)[number];
|
|
589
589
|
/**
|
|
590
590
|
* Canonical envelope (HTTP body).
|
package/dist/index.js
CHANGED
|
@@ -292,7 +292,12 @@ var CHECKOUT_WEBHOOK_EVENTS = [
|
|
|
292
292
|
"checkout.session.settled",
|
|
293
293
|
"checkout.session.expired",
|
|
294
294
|
"checkout.session.unresolved",
|
|
295
|
-
"checkout.refund.recorded"
|
|
295
|
+
"checkout.refund.recorded",
|
|
296
|
+
// x402 결제의 **사후** 확정. 정상 경로(/settle 이 그 자리에서 결과를 반환)는 발행되지 않는다 —
|
|
297
|
+
// 이미 아는 결과를 중복으로 받지 않게 하기 위함이다. /settle 이 503 을 반환해 결과를 모른 채
|
|
298
|
+
// 남았을 때, reconciler 가 체인을 보고 종결시키면 이 이벤트가 온다.
|
|
299
|
+
// payload: { payment_id, status: 'confirmed'|'reverted'|'expired', tx_hash, resource, amount, … }
|
|
300
|
+
"x402.payment.resolved"
|
|
296
301
|
];
|
|
297
302
|
var WEBHOOK_HEADERS = {
|
|
298
303
|
signature: "X-Webhook-Signature-256",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitpal/checkout",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "BitPal Checkout SDK — non-custodial crypto checkout: create sessions, issue per-order deposit addresses, poll status, verify signed webhooks, and charge per API call with x402.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|