@waffo/pancake-ts 0.4.2 → 0.5.1
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/CHANGELOG.md +24 -0
- package/README.md +17 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js.map +1 -1
- package/docs/webhook-guide.md +61 -8
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -875,13 +875,59 @@ declare enum WebhookEventType {
|
|
|
875
875
|
*/
|
|
876
876
|
interface WebhookEventData {
|
|
877
877
|
orderId: string;
|
|
878
|
+
/** Order status (e.g., "completed", "active", "canceling") */
|
|
879
|
+
orderStatus?: string;
|
|
878
880
|
buyerEmail: string;
|
|
881
|
+
/** Merchant-provided buyer identity from checkout session */
|
|
882
|
+
merchantProvidedBuyerIdentity?: string;
|
|
879
883
|
currency: string;
|
|
884
|
+
/** Billing/shipping address (structured object) */
|
|
885
|
+
billingDetail?: Record<string, unknown>;
|
|
886
|
+
/** Order-level metadata from checkout session (flat key-value pairs) */
|
|
887
|
+
orderMetadata?: Record<string, string>;
|
|
880
888
|
/** Amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
881
889
|
amount: string;
|
|
882
890
|
/** Tax amount as display string (e.g., "0.91" for USD) */
|
|
883
891
|
taxAmount: string;
|
|
892
|
+
/** Tax rate as decimal (e.g., 0.1 for 10%) */
|
|
893
|
+
taxRate?: number;
|
|
894
|
+
/** Tax name (e.g., "Consumption Tax") */
|
|
895
|
+
taxName?: string;
|
|
896
|
+
/** Subtotal as display string (before tax) */
|
|
897
|
+
subtotal?: string;
|
|
898
|
+
/** Total as display string (after tax) */
|
|
899
|
+
total?: string;
|
|
884
900
|
productName: string;
|
|
901
|
+
/** Product description */
|
|
902
|
+
productDescription?: string;
|
|
903
|
+
/** Product-level metadata set when creating/updating the product */
|
|
904
|
+
productMetadata?: Record<string, string>;
|
|
905
|
+
/** Payment ID */
|
|
906
|
+
paymentId?: string;
|
|
907
|
+
/** Payment status (e.g., "succeeded", "failed") */
|
|
908
|
+
paymentStatus?: string;
|
|
909
|
+
/** Payment method type (e.g., "card") */
|
|
910
|
+
paymentMethod?: string;
|
|
911
|
+
/** Last 4 digits of payment instrument */
|
|
912
|
+
paymentLast4?: string;
|
|
913
|
+
/** Payment failure reason (present when payment failed) */
|
|
914
|
+
paymentFailureReason?: string;
|
|
915
|
+
/** Payment date (ISO 8601 date, e.g., "2026-04-18") */
|
|
916
|
+
paymentDate?: string;
|
|
917
|
+
/** Billing period: "weekly", "monthly", "quarterly", "yearly" */
|
|
918
|
+
billingPeriod?: string;
|
|
919
|
+
/** Current billing period start date (ISO 8601, e.g., "2026-04-01") */
|
|
920
|
+
currentPeriodStart?: string;
|
|
921
|
+
/** Current billing period end date (ISO 8601, e.g., "2026-05-01") */
|
|
922
|
+
currentPeriodEnd?: string;
|
|
923
|
+
/** Subscription cancellation timestamp (ISO 8601, present when canceled) */
|
|
924
|
+
canceledAt?: string;
|
|
925
|
+
/** Refund status (e.g., "succeeded", "failed") */
|
|
926
|
+
refundStatus?: string;
|
|
927
|
+
/** Refund reason */
|
|
928
|
+
refundReason?: string;
|
|
929
|
+
/** Refund creation timestamp (ISO 8601) */
|
|
930
|
+
refundCreatedAt?: string;
|
|
885
931
|
}
|
|
886
932
|
/**
|
|
887
933
|
* Webhook event payload.
|
|
@@ -895,8 +941,9 @@ interface WebhookEventData {
|
|
|
895
941
|
* eventType: "order.completed",
|
|
896
942
|
* eventId: "PAY_5xK9mRtYvWnPqLsJ3hBfDe",
|
|
897
943
|
* storeId: "STO_2aUyqjCzEIiEcYMKj7TZtw",
|
|
944
|
+
* storeName: "My Store",
|
|
898
945
|
* mode: "prod",
|
|
899
|
-
* data: { orderId: "...", buyerEmail: "...", currency: "USD", amount: "29.00", taxAmount: "2.90", productName: "Pro Plan" }
|
|
946
|
+
* data: { orderId: "...", buyerEmail: "...", currency: "USD", amount: "29.00", taxAmount: "2.90", productName: "Pro Plan", orderMetadata: { planId: "pro" } }
|
|
900
947
|
* }
|
|
901
948
|
*/
|
|
902
949
|
interface WebhookEvent<T = WebhookEventData> {
|
|
@@ -910,6 +957,8 @@ interface WebhookEvent<T = WebhookEventData> {
|
|
|
910
957
|
eventId: string;
|
|
911
958
|
/** Store ID the event belongs to */
|
|
912
959
|
storeId: string;
|
|
960
|
+
/** Store name */
|
|
961
|
+
storeName: string;
|
|
913
962
|
/** Environment identifier */
|
|
914
963
|
mode: `${Environment}`;
|
|
915
964
|
/** Event data */
|
package/dist/index.d.ts
CHANGED
|
@@ -875,13 +875,59 @@ declare enum WebhookEventType {
|
|
|
875
875
|
*/
|
|
876
876
|
interface WebhookEventData {
|
|
877
877
|
orderId: string;
|
|
878
|
+
/** Order status (e.g., "completed", "active", "canceling") */
|
|
879
|
+
orderStatus?: string;
|
|
878
880
|
buyerEmail: string;
|
|
881
|
+
/** Merchant-provided buyer identity from checkout session */
|
|
882
|
+
merchantProvidedBuyerIdentity?: string;
|
|
879
883
|
currency: string;
|
|
884
|
+
/** Billing/shipping address (structured object) */
|
|
885
|
+
billingDetail?: Record<string, unknown>;
|
|
886
|
+
/** Order-level metadata from checkout session (flat key-value pairs) */
|
|
887
|
+
orderMetadata?: Record<string, string>;
|
|
880
888
|
/** Amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
881
889
|
amount: string;
|
|
882
890
|
/** Tax amount as display string (e.g., "0.91" for USD) */
|
|
883
891
|
taxAmount: string;
|
|
892
|
+
/** Tax rate as decimal (e.g., 0.1 for 10%) */
|
|
893
|
+
taxRate?: number;
|
|
894
|
+
/** Tax name (e.g., "Consumption Tax") */
|
|
895
|
+
taxName?: string;
|
|
896
|
+
/** Subtotal as display string (before tax) */
|
|
897
|
+
subtotal?: string;
|
|
898
|
+
/** Total as display string (after tax) */
|
|
899
|
+
total?: string;
|
|
884
900
|
productName: string;
|
|
901
|
+
/** Product description */
|
|
902
|
+
productDescription?: string;
|
|
903
|
+
/** Product-level metadata set when creating/updating the product */
|
|
904
|
+
productMetadata?: Record<string, string>;
|
|
905
|
+
/** Payment ID */
|
|
906
|
+
paymentId?: string;
|
|
907
|
+
/** Payment status (e.g., "succeeded", "failed") */
|
|
908
|
+
paymentStatus?: string;
|
|
909
|
+
/** Payment method type (e.g., "card") */
|
|
910
|
+
paymentMethod?: string;
|
|
911
|
+
/** Last 4 digits of payment instrument */
|
|
912
|
+
paymentLast4?: string;
|
|
913
|
+
/** Payment failure reason (present when payment failed) */
|
|
914
|
+
paymentFailureReason?: string;
|
|
915
|
+
/** Payment date (ISO 8601 date, e.g., "2026-04-18") */
|
|
916
|
+
paymentDate?: string;
|
|
917
|
+
/** Billing period: "weekly", "monthly", "quarterly", "yearly" */
|
|
918
|
+
billingPeriod?: string;
|
|
919
|
+
/** Current billing period start date (ISO 8601, e.g., "2026-04-01") */
|
|
920
|
+
currentPeriodStart?: string;
|
|
921
|
+
/** Current billing period end date (ISO 8601, e.g., "2026-05-01") */
|
|
922
|
+
currentPeriodEnd?: string;
|
|
923
|
+
/** Subscription cancellation timestamp (ISO 8601, present when canceled) */
|
|
924
|
+
canceledAt?: string;
|
|
925
|
+
/** Refund status (e.g., "succeeded", "failed") */
|
|
926
|
+
refundStatus?: string;
|
|
927
|
+
/** Refund reason */
|
|
928
|
+
refundReason?: string;
|
|
929
|
+
/** Refund creation timestamp (ISO 8601) */
|
|
930
|
+
refundCreatedAt?: string;
|
|
885
931
|
}
|
|
886
932
|
/**
|
|
887
933
|
* Webhook event payload.
|
|
@@ -895,8 +941,9 @@ interface WebhookEventData {
|
|
|
895
941
|
* eventType: "order.completed",
|
|
896
942
|
* eventId: "PAY_5xK9mRtYvWnPqLsJ3hBfDe",
|
|
897
943
|
* storeId: "STO_2aUyqjCzEIiEcYMKj7TZtw",
|
|
944
|
+
* storeName: "My Store",
|
|
898
945
|
* mode: "prod",
|
|
899
|
-
* data: { orderId: "...", buyerEmail: "...", currency: "USD", amount: "29.00", taxAmount: "2.90", productName: "Pro Plan" }
|
|
946
|
+
* data: { orderId: "...", buyerEmail: "...", currency: "USD", amount: "29.00", taxAmount: "2.90", productName: "Pro Plan", orderMetadata: { planId: "pro" } }
|
|
900
947
|
* }
|
|
901
948
|
*/
|
|
902
949
|
interface WebhookEvent<T = WebhookEventData> {
|
|
@@ -910,6 +957,8 @@ interface WebhookEvent<T = WebhookEventData> {
|
|
|
910
957
|
eventId: string;
|
|
911
958
|
/** Store ID the event belongs to */
|
|
912
959
|
storeId: string;
|
|
960
|
+
/** Store name */
|
|
961
|
+
storeName: string;
|
|
913
962
|
/** Environment identifier */
|
|
914
963
|
mode: `${Environment}`;
|
|
915
964
|
/** Event data */
|