@funnelsgrove/payments 0.78.0 → 0.79.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.
@@ -1 +1 @@
1
- export declare const PAYMENTS_PACKAGE_VERSION = "0.78.0";
1
+ export declare const PAYMENTS_PACKAGE_VERSION = "0.79.0";
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/generate-package-version.mjs.
2
- export const PAYMENTS_PACKAGE_VERSION = "0.78.0";
2
+ export const PAYMENTS_PACKAGE_VERSION = "0.79.0";
@@ -23,8 +23,11 @@ type Props = ComponentProps<typeof ExpressCheckoutElement> & {
23
23
  };
24
24
  /** The sheet shows the Checkout Session's amount and currency. Renders nothing until the session has loaded. */
25
25
  export declare function ManualWalletExpressCheckoutElement({ checkout, stripePromise, walletRef, ...element }: Props): import("react/jsx-runtime").JSX.Element | null;
26
- /** Creates the PaymentMethod from the confirmed wallet sheet, which closes the sheet. */
27
- export declare function createManualWalletPaymentMethod({ elements, stripe }: ManualWallet): Promise<{
26
+ /**
27
+ * Creates the PaymentMethod from the confirmed wallet sheet, which closes the sheet.
28
+ * Confirming a Checkout Session with a PaymentMethod requires the email on the PaymentMethod.
29
+ */
30
+ export declare function createManualWalletPaymentMethod({ elements, stripe }: ManualWallet, email: string): Promise<{
28
31
  paymentMethodId: string;
29
32
  } | {
30
33
  error: StripeError | undefined;
@@ -40,13 +40,16 @@ export function ManualWalletExpressCheckoutElement(_a) {
40
40
  return null;
41
41
  return (_jsxs(Elements, { stripe: stripePromise, options: options, children: [_jsx(ManualWalletBridge, { walletRef: walletRef }), _jsx(ExpressCheckoutElement, Object.assign({}, element))] }));
42
42
  }
43
- /** Creates the PaymentMethod from the confirmed wallet sheet, which closes the sheet. */
44
- export async function createManualWalletPaymentMethod({ elements, stripe }) {
43
+ /**
44
+ * Creates the PaymentMethod from the confirmed wallet sheet, which closes the sheet.
45
+ * Confirming a Checkout Session with a PaymentMethod requires the email on the PaymentMethod.
46
+ */
47
+ export async function createManualWalletPaymentMethod({ elements, stripe }, email) {
45
48
  if (!elements || !stripe)
46
49
  return { error: undefined };
47
50
  const submitted = await elements.submit();
48
51
  if (submitted.error)
49
52
  return { error: submitted.error };
50
- const created = await stripe.createPaymentMethod({ elements });
53
+ const created = await stripe.createPaymentMethod({ elements, params: { billing_details: { email } } });
51
54
  return created.paymentMethod ? { paymentMethodId: created.paymentMethod.id } : { error: created.error };
52
55
  }
@@ -271,7 +271,7 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
271
271
  await (onPaymentInfoSubmitted === null || onPaymentInfoSubmitted === void 0 ? void 0 : onPaymentInfoSubmitted());
272
272
  let paymentMethodId = null;
273
273
  if (stripePromise) {
274
- const created = await createManualWalletPaymentMethod(manualWalletRef.current);
274
+ const created = await createManualWalletPaymentMethod(manualWalletRef.current, preparedCustomerEmail.trim());
275
275
  if ('error' in created) {
276
276
  const message = ((_d = created.error) === null || _d === void 0 ? void 0 : _d.message) || 'Wallet checkout is not ready yet.';
277
277
  reportFailure(message, 'wallet_payment_method', event.expressPaymentType, created.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.78.0",
3
+ "version": "0.79.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",