@paykit-sdk/stripe 1.1.100 → 1.1.101
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/index.js +4 -37
- package/dist/index.mjs +5 -38
- package/dist/stripe-provider.js +4 -37
- package/dist/stripe-provider.mjs +5 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4415,44 +4415,11 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4415
4415
|
method: "createPayment"
|
|
4416
4416
|
});
|
|
4417
4417
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4418
|
-
if (typeof customer === "object"
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
[core.PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4423
|
-
});
|
|
4424
|
-
const checkoutSession = await this.stripe.checkout.sessions.create({
|
|
4425
|
-
mode: "payment",
|
|
4426
|
-
customer_email: customer.email,
|
|
4427
|
-
line_items: [
|
|
4428
|
-
{
|
|
4429
|
-
price_data: {
|
|
4430
|
-
currency: rest.currency,
|
|
4431
|
-
product_data: {
|
|
4432
|
-
name: `Payment for ${data.item_id || "item"}`
|
|
4433
|
-
},
|
|
4434
|
-
unit_amount: rest.amount
|
|
4435
|
-
},
|
|
4436
|
-
quantity: 1
|
|
4437
|
-
}
|
|
4438
|
-
],
|
|
4439
|
-
metadata: checkoutMetadata,
|
|
4440
|
-
payment_intent_data: {
|
|
4441
|
-
capture_method,
|
|
4442
|
-
setup_future_usage: "off_session"
|
|
4443
|
-
}
|
|
4418
|
+
if (typeof customer === "object") {
|
|
4419
|
+
throw new core.InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4420
|
+
provider: this.providerName,
|
|
4421
|
+
method: "createPayment"
|
|
4444
4422
|
});
|
|
4445
|
-
return {
|
|
4446
|
-
id: checkoutSession.id,
|
|
4447
|
-
amount: rest.amount,
|
|
4448
|
-
currency: rest.currency,
|
|
4449
|
-
customer: customer.email,
|
|
4450
|
-
status: "requires_action",
|
|
4451
|
-
metadata: core.omitInternalMetadata(checkoutMetadata),
|
|
4452
|
-
item_id: data.item_id ?? null,
|
|
4453
|
-
requires_action: true,
|
|
4454
|
-
payment_url: checkoutSession.url
|
|
4455
|
-
};
|
|
4456
4423
|
}
|
|
4457
4424
|
const paymentMetadata = core.stringifyMetadataValues({
|
|
4458
4425
|
...rest.metadata,
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { schema, validateRequiredKeys, AbstractPayKitProvider, createCheckoutSchema, ValidationError, stringifyMetadataValues, InvalidTypeError, updateCheckoutSchema, ResourceNotFoundError, createCustomerSchema, createSubscriptionSchema, updateSubscriptionSchema, retrieveSubscriptionSchema, createPaymentSchema, PAYKIT_METADATA_KEY,
|
|
1
|
+
import { schema, validateRequiredKeys, AbstractPayKitProvider, createCheckoutSchema, ValidationError, stringifyMetadataValues, InvalidTypeError, updateCheckoutSchema, ResourceNotFoundError, createCustomerSchema, createSubscriptionSchema, updateSubscriptionSchema, retrieveSubscriptionSchema, createPaymentSchema, PAYKIT_METADATA_KEY, updatePaymentSchema, retrievePaymentSchema, tryCatchAsync, deletePaymentSchema, capturePaymentSchema, createRefundSchema, WebhookError, paykitEvent$InboundSchema, billingModeSchema, omitInternalMetadata, invoiceStatusSchema } from '@paykit-sdk/core';
|
|
2
2
|
import Stripe from 'stripe';
|
|
3
3
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -4409,44 +4409,11 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4409
4409
|
method: "createPayment"
|
|
4410
4410
|
});
|
|
4411
4411
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4412
|
-
if (typeof customer === "object"
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
[PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4417
|
-
});
|
|
4418
|
-
const checkoutSession = await this.stripe.checkout.sessions.create({
|
|
4419
|
-
mode: "payment",
|
|
4420
|
-
customer_email: customer.email,
|
|
4421
|
-
line_items: [
|
|
4422
|
-
{
|
|
4423
|
-
price_data: {
|
|
4424
|
-
currency: rest.currency,
|
|
4425
|
-
product_data: {
|
|
4426
|
-
name: `Payment for ${data.item_id || "item"}`
|
|
4427
|
-
},
|
|
4428
|
-
unit_amount: rest.amount
|
|
4429
|
-
},
|
|
4430
|
-
quantity: 1
|
|
4431
|
-
}
|
|
4432
|
-
],
|
|
4433
|
-
metadata: checkoutMetadata,
|
|
4434
|
-
payment_intent_data: {
|
|
4435
|
-
capture_method,
|
|
4436
|
-
setup_future_usage: "off_session"
|
|
4437
|
-
}
|
|
4412
|
+
if (typeof customer === "object") {
|
|
4413
|
+
throw new InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4414
|
+
provider: this.providerName,
|
|
4415
|
+
method: "createPayment"
|
|
4438
4416
|
});
|
|
4439
|
-
return {
|
|
4440
|
-
id: checkoutSession.id,
|
|
4441
|
-
amount: rest.amount,
|
|
4442
|
-
currency: rest.currency,
|
|
4443
|
-
customer: customer.email,
|
|
4444
|
-
status: "requires_action",
|
|
4445
|
-
metadata: omitInternalMetadata(checkoutMetadata),
|
|
4446
|
-
item_id: data.item_id ?? null,
|
|
4447
|
-
requires_action: true,
|
|
4448
|
-
payment_url: checkoutSession.url
|
|
4449
|
-
};
|
|
4450
4417
|
}
|
|
4451
4418
|
const paymentMetadata = stringifyMetadataValues({
|
|
4452
4419
|
...rest.metadata,
|
package/dist/stripe-provider.js
CHANGED
|
@@ -4415,44 +4415,11 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4415
4415
|
method: "createPayment"
|
|
4416
4416
|
});
|
|
4417
4417
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4418
|
-
if (typeof customer === "object"
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
[core.PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4423
|
-
});
|
|
4424
|
-
const checkoutSession = await this.stripe.checkout.sessions.create({
|
|
4425
|
-
mode: "payment",
|
|
4426
|
-
customer_email: customer.email,
|
|
4427
|
-
line_items: [
|
|
4428
|
-
{
|
|
4429
|
-
price_data: {
|
|
4430
|
-
currency: rest.currency,
|
|
4431
|
-
product_data: {
|
|
4432
|
-
name: `Payment for ${data.item_id || "item"}`
|
|
4433
|
-
},
|
|
4434
|
-
unit_amount: rest.amount
|
|
4435
|
-
},
|
|
4436
|
-
quantity: 1
|
|
4437
|
-
}
|
|
4438
|
-
],
|
|
4439
|
-
metadata: checkoutMetadata,
|
|
4440
|
-
payment_intent_data: {
|
|
4441
|
-
capture_method,
|
|
4442
|
-
setup_future_usage: "off_session"
|
|
4443
|
-
}
|
|
4418
|
+
if (typeof customer === "object") {
|
|
4419
|
+
throw new core.InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4420
|
+
provider: this.providerName,
|
|
4421
|
+
method: "createPayment"
|
|
4444
4422
|
});
|
|
4445
|
-
return {
|
|
4446
|
-
id: checkoutSession.id,
|
|
4447
|
-
amount: rest.amount,
|
|
4448
|
-
currency: rest.currency,
|
|
4449
|
-
customer: customer.email,
|
|
4450
|
-
status: "requires_action",
|
|
4451
|
-
metadata: core.omitInternalMetadata(checkoutMetadata),
|
|
4452
|
-
item_id: data.item_id ?? null,
|
|
4453
|
-
requires_action: true,
|
|
4454
|
-
payment_url: checkoutSession.url
|
|
4455
|
-
};
|
|
4456
4423
|
}
|
|
4457
4424
|
const paymentMetadata = core.stringifyMetadataValues({
|
|
4458
4425
|
...rest.metadata,
|
package/dist/stripe-provider.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { schema, AbstractPayKitProvider, createCheckoutSchema, ValidationError, stringifyMetadataValues, InvalidTypeError, updateCheckoutSchema, ResourceNotFoundError, createCustomerSchema, createSubscriptionSchema, updateSubscriptionSchema, retrieveSubscriptionSchema, createPaymentSchema, PAYKIT_METADATA_KEY,
|
|
1
|
+
import { schema, AbstractPayKitProvider, createCheckoutSchema, ValidationError, stringifyMetadataValues, InvalidTypeError, updateCheckoutSchema, ResourceNotFoundError, createCustomerSchema, createSubscriptionSchema, updateSubscriptionSchema, retrieveSubscriptionSchema, createPaymentSchema, PAYKIT_METADATA_KEY, updatePaymentSchema, retrievePaymentSchema, tryCatchAsync, deletePaymentSchema, capturePaymentSchema, createRefundSchema, WebhookError, paykitEvent$InboundSchema, billingModeSchema, omitInternalMetadata, invoiceStatusSchema } from '@paykit-sdk/core';
|
|
2
2
|
import Stripe from 'stripe';
|
|
3
3
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -4409,44 +4409,11 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4409
4409
|
method: "createPayment"
|
|
4410
4410
|
});
|
|
4411
4411
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4412
|
-
if (typeof customer === "object"
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
[PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4417
|
-
});
|
|
4418
|
-
const checkoutSession = await this.stripe.checkout.sessions.create({
|
|
4419
|
-
mode: "payment",
|
|
4420
|
-
customer_email: customer.email,
|
|
4421
|
-
line_items: [
|
|
4422
|
-
{
|
|
4423
|
-
price_data: {
|
|
4424
|
-
currency: rest.currency,
|
|
4425
|
-
product_data: {
|
|
4426
|
-
name: `Payment for ${data.item_id || "item"}`
|
|
4427
|
-
},
|
|
4428
|
-
unit_amount: rest.amount
|
|
4429
|
-
},
|
|
4430
|
-
quantity: 1
|
|
4431
|
-
}
|
|
4432
|
-
],
|
|
4433
|
-
metadata: checkoutMetadata,
|
|
4434
|
-
payment_intent_data: {
|
|
4435
|
-
capture_method,
|
|
4436
|
-
setup_future_usage: "off_session"
|
|
4437
|
-
}
|
|
4412
|
+
if (typeof customer === "object") {
|
|
4413
|
+
throw new InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4414
|
+
provider: this.providerName,
|
|
4415
|
+
method: "createPayment"
|
|
4438
4416
|
});
|
|
4439
|
-
return {
|
|
4440
|
-
id: checkoutSession.id,
|
|
4441
|
-
amount: rest.amount,
|
|
4442
|
-
currency: rest.currency,
|
|
4443
|
-
customer: customer.email,
|
|
4444
|
-
status: "requires_action",
|
|
4445
|
-
metadata: omitInternalMetadata(checkoutMetadata),
|
|
4446
|
-
item_id: data.item_id ?? null,
|
|
4447
|
-
requires_action: true,
|
|
4448
|
-
payment_url: checkoutSession.url
|
|
4449
|
-
};
|
|
4450
4417
|
}
|
|
4451
4418
|
const paymentMetadata = stringifyMetadataValues({
|
|
4452
4419
|
...rest.metadata,
|