@paykit-sdk/stripe 1.1.104 → 1.1.105
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 +31 -8
- package/dist/index.js +496 -4228
- package/dist/index.mjs +497 -4229
- package/dist/stripe-provider.d.mts +27 -25
- package/dist/stripe-provider.d.ts +27 -25
- package/dist/stripe-provider.js +494 -4227
- package/dist/stripe-provider.mjs +495 -4228
- package/package.json +8 -9
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
import { PaykitProviderOptions, AbstractPayKitProvider, PayKitProvider, CreateCheckoutSchema, Checkout, UpdateCheckoutSchema, CreateCustomerParams, Customer, UpdateCustomerParams, CreateSubscriptionSchema, Subscription, UpdateSubscriptionSchema, CreatePaymentSchema, Payment, UpdatePaymentSchema, CapturePaymentSchema, CreateRefundSchema, Refund,
|
|
1
|
+
import { PaykitProviderOptions, AbstractPayKitProvider, PayKitProvider, ProviderMetadataRegistry, CreateCheckoutSchema, Checkout, UpdateCheckoutSchema, CreateCustomerParams, Customer, UpdateCustomerParams, CreateSubscriptionSchema, Subscription, UpdateSubscriptionSchema, CreatePaymentSchema, Payment, UpdatePaymentSchema, CapturePaymentSchema, CreateRefundSchema, Refund, WebhookHandlerConfig, WebhookEventPayload } from '@paykit-sdk/core';
|
|
2
2
|
import Stripe from 'stripe';
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
interface StripeMetadata extends ProviderMetadataRegistry {
|
|
5
|
+
customer: Stripe.CustomerCreateParams;
|
|
6
|
+
checkout: Stripe.Checkout.SessionCreateParams;
|
|
7
|
+
payment: Stripe.PaymentIntentCreateParams;
|
|
8
|
+
subscription: Stripe.SubscriptionCreateParams;
|
|
9
|
+
refund: Stripe.RefundCreateParams;
|
|
10
|
+
}
|
|
11
|
+
interface StripeOptions extends PaykitProviderOptions, Stripe.StripeConfig {
|
|
5
12
|
apiKey: string;
|
|
6
13
|
}
|
|
7
|
-
|
|
14
|
+
type StripeRawEvents = {
|
|
15
|
+
[K in Stripe.Event.Type as `stripe.${K}`]: Extract<Stripe.Event, {
|
|
16
|
+
type: K;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
declare class StripeProvider extends AbstractPayKitProvider implements PayKitProvider<StripeMetadata, Stripe, StripeRawEvents> {
|
|
8
20
|
private stripe;
|
|
9
21
|
private opts;
|
|
22
|
+
readonly isSandbox: boolean;
|
|
10
23
|
constructor(opts: StripeOptions);
|
|
11
24
|
readonly providerName = "stripe";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
createCheckout: (params: CreateCheckoutSchema) => Promise<Checkout>;
|
|
25
|
+
get _native(): Stripe;
|
|
26
|
+
createCheckout: (params: CreateCheckoutSchema<StripeMetadata["checkout"]>) => Promise<Checkout>;
|
|
16
27
|
retrieveCheckout: (id: string) => Promise<Checkout>;
|
|
17
28
|
updateCheckout: (id: string, params: UpdateCheckoutSchema) => Promise<Checkout>;
|
|
18
29
|
deleteCheckout: (id: string) => Promise<null>;
|
|
19
30
|
/**
|
|
20
31
|
* Customer management
|
|
21
32
|
*/
|
|
22
|
-
createCustomer: (params: CreateCustomerParams) => Promise<Customer>;
|
|
23
|
-
updateCustomer: (id: string, params: UpdateCustomerParams) => Promise<Customer>;
|
|
33
|
+
createCustomer: (params: CreateCustomerParams<StripeMetadata["customer"]>) => Promise<Customer>;
|
|
34
|
+
updateCustomer: (id: string, params: UpdateCustomerParams<StripeMetadata["customer"]>) => Promise<Customer>;
|
|
24
35
|
deleteCustomer: (id: string) => Promise<null>;
|
|
25
36
|
retrieveCustomer: (id: string) => Promise<Customer | null>;
|
|
26
|
-
|
|
27
|
-
* Subscription management
|
|
28
|
-
*/
|
|
29
|
-
createSubscription: (params: CreateSubscriptionSchema) => Promise<Subscription>;
|
|
37
|
+
createSubscription: (params: CreateSubscriptionSchema<StripeMetadata["subscription"]>) => Promise<Subscription>;
|
|
30
38
|
cancelSubscription: (id: string) => Promise<Subscription>;
|
|
31
|
-
updateSubscription: (id: string, params: UpdateSubscriptionSchema) => Promise<Subscription>;
|
|
39
|
+
updateSubscription: (id: string, params: UpdateSubscriptionSchema<StripeMetadata["subscription"]>) => Promise<Subscription>;
|
|
32
40
|
retrieveSubscription: (id: string) => Promise<Subscription>;
|
|
33
41
|
deleteSubscription: (id: string) => Promise<null>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* Create a payment intent or checkout session for a payment
|
|
37
|
-
*/
|
|
38
|
-
createPayment: (params: CreatePaymentSchema) => Promise<Payment>;
|
|
39
|
-
updatePayment: (id: string, params: UpdatePaymentSchema) => Promise<Payment>;
|
|
42
|
+
createPayment: (params: CreatePaymentSchema<StripeMetadata["payment"]>) => Promise<Payment>;
|
|
43
|
+
updatePayment: (id: string, params: UpdatePaymentSchema<StripeMetadata["payment"]>) => Promise<Payment>;
|
|
40
44
|
retrievePayment: (id: string) => Promise<Payment | null>;
|
|
41
45
|
deletePayment: (id: string) => Promise<null>;
|
|
42
46
|
capturePayment: (id: string, params: CapturePaymentSchema) => Promise<Payment>;
|
|
@@ -44,11 +48,9 @@ declare class StripeProvider extends AbstractPayKitProvider implements PayKitPro
|
|
|
44
48
|
/**
|
|
45
49
|
* Refund management
|
|
46
50
|
*/
|
|
47
|
-
createRefund: (params: CreateRefundSchema) => Promise<Refund>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*/
|
|
51
|
-
handleWebhook: (params: HandleWebhookParams) => Promise<Array<WebhookEventPayload>>;
|
|
51
|
+
createRefund: (params: CreateRefundSchema<StripeMetadata["refund"]>) => Promise<Refund>;
|
|
52
|
+
handleWebhook1: (params: WebhookHandlerConfig, webhookSecret: string | null) => Promise<Array<WebhookEventPayload>>;
|
|
53
|
+
handleWebhook: (params: WebhookHandlerConfig, webhookSecret: string | null) => Promise<Array<WebhookEventPayload<StripeRawEvents>>>;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export { type StripeOptions, StripeProvider };
|
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
import { PaykitProviderOptions, AbstractPayKitProvider, PayKitProvider, CreateCheckoutSchema, Checkout, UpdateCheckoutSchema, CreateCustomerParams, Customer, UpdateCustomerParams, CreateSubscriptionSchema, Subscription, UpdateSubscriptionSchema, CreatePaymentSchema, Payment, UpdatePaymentSchema, CapturePaymentSchema, CreateRefundSchema, Refund,
|
|
1
|
+
import { PaykitProviderOptions, AbstractPayKitProvider, PayKitProvider, ProviderMetadataRegistry, CreateCheckoutSchema, Checkout, UpdateCheckoutSchema, CreateCustomerParams, Customer, UpdateCustomerParams, CreateSubscriptionSchema, Subscription, UpdateSubscriptionSchema, CreatePaymentSchema, Payment, UpdatePaymentSchema, CapturePaymentSchema, CreateRefundSchema, Refund, WebhookHandlerConfig, WebhookEventPayload } from '@paykit-sdk/core';
|
|
2
2
|
import Stripe from 'stripe';
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
interface StripeMetadata extends ProviderMetadataRegistry {
|
|
5
|
+
customer: Stripe.CustomerCreateParams;
|
|
6
|
+
checkout: Stripe.Checkout.SessionCreateParams;
|
|
7
|
+
payment: Stripe.PaymentIntentCreateParams;
|
|
8
|
+
subscription: Stripe.SubscriptionCreateParams;
|
|
9
|
+
refund: Stripe.RefundCreateParams;
|
|
10
|
+
}
|
|
11
|
+
interface StripeOptions extends PaykitProviderOptions, Stripe.StripeConfig {
|
|
5
12
|
apiKey: string;
|
|
6
13
|
}
|
|
7
|
-
|
|
14
|
+
type StripeRawEvents = {
|
|
15
|
+
[K in Stripe.Event.Type as `stripe.${K}`]: Extract<Stripe.Event, {
|
|
16
|
+
type: K;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
declare class StripeProvider extends AbstractPayKitProvider implements PayKitProvider<StripeMetadata, Stripe, StripeRawEvents> {
|
|
8
20
|
private stripe;
|
|
9
21
|
private opts;
|
|
22
|
+
readonly isSandbox: boolean;
|
|
10
23
|
constructor(opts: StripeOptions);
|
|
11
24
|
readonly providerName = "stripe";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
createCheckout: (params: CreateCheckoutSchema) => Promise<Checkout>;
|
|
25
|
+
get _native(): Stripe;
|
|
26
|
+
createCheckout: (params: CreateCheckoutSchema<StripeMetadata["checkout"]>) => Promise<Checkout>;
|
|
16
27
|
retrieveCheckout: (id: string) => Promise<Checkout>;
|
|
17
28
|
updateCheckout: (id: string, params: UpdateCheckoutSchema) => Promise<Checkout>;
|
|
18
29
|
deleteCheckout: (id: string) => Promise<null>;
|
|
19
30
|
/**
|
|
20
31
|
* Customer management
|
|
21
32
|
*/
|
|
22
|
-
createCustomer: (params: CreateCustomerParams) => Promise<Customer>;
|
|
23
|
-
updateCustomer: (id: string, params: UpdateCustomerParams) => Promise<Customer>;
|
|
33
|
+
createCustomer: (params: CreateCustomerParams<StripeMetadata["customer"]>) => Promise<Customer>;
|
|
34
|
+
updateCustomer: (id: string, params: UpdateCustomerParams<StripeMetadata["customer"]>) => Promise<Customer>;
|
|
24
35
|
deleteCustomer: (id: string) => Promise<null>;
|
|
25
36
|
retrieveCustomer: (id: string) => Promise<Customer | null>;
|
|
26
|
-
|
|
27
|
-
* Subscription management
|
|
28
|
-
*/
|
|
29
|
-
createSubscription: (params: CreateSubscriptionSchema) => Promise<Subscription>;
|
|
37
|
+
createSubscription: (params: CreateSubscriptionSchema<StripeMetadata["subscription"]>) => Promise<Subscription>;
|
|
30
38
|
cancelSubscription: (id: string) => Promise<Subscription>;
|
|
31
|
-
updateSubscription: (id: string, params: UpdateSubscriptionSchema) => Promise<Subscription>;
|
|
39
|
+
updateSubscription: (id: string, params: UpdateSubscriptionSchema<StripeMetadata["subscription"]>) => Promise<Subscription>;
|
|
32
40
|
retrieveSubscription: (id: string) => Promise<Subscription>;
|
|
33
41
|
deleteSubscription: (id: string) => Promise<null>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* Create a payment intent or checkout session for a payment
|
|
37
|
-
*/
|
|
38
|
-
createPayment: (params: CreatePaymentSchema) => Promise<Payment>;
|
|
39
|
-
updatePayment: (id: string, params: UpdatePaymentSchema) => Promise<Payment>;
|
|
42
|
+
createPayment: (params: CreatePaymentSchema<StripeMetadata["payment"]>) => Promise<Payment>;
|
|
43
|
+
updatePayment: (id: string, params: UpdatePaymentSchema<StripeMetadata["payment"]>) => Promise<Payment>;
|
|
40
44
|
retrievePayment: (id: string) => Promise<Payment | null>;
|
|
41
45
|
deletePayment: (id: string) => Promise<null>;
|
|
42
46
|
capturePayment: (id: string, params: CapturePaymentSchema) => Promise<Payment>;
|
|
@@ -44,11 +48,9 @@ declare class StripeProvider extends AbstractPayKitProvider implements PayKitPro
|
|
|
44
48
|
/**
|
|
45
49
|
* Refund management
|
|
46
50
|
*/
|
|
47
|
-
createRefund: (params: CreateRefundSchema) => Promise<Refund>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*/
|
|
51
|
-
handleWebhook: (params: HandleWebhookParams) => Promise<Array<WebhookEventPayload>>;
|
|
51
|
+
createRefund: (params: CreateRefundSchema<StripeMetadata["refund"]>) => Promise<Refund>;
|
|
52
|
+
handleWebhook1: (params: WebhookHandlerConfig, webhookSecret: string | null) => Promise<Array<WebhookEventPayload>>;
|
|
53
|
+
handleWebhook: (params: WebhookHandlerConfig, webhookSecret: string | null) => Promise<Array<WebhookEventPayload<StripeRawEvents>>>;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export { type StripeOptions, StripeProvider };
|