@economist/web-apple-pay 1.7.2 → 1.7.4

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.
@@ -192,7 +192,8 @@ async function handleMerchantValidation(event, session, config) {
192
192
  return;
193
193
  }
194
194
  session.completeMerchantValidation(response.merchantSession);
195
- } catch {
195
+ } catch (err) {
196
+ console.error("[web-apple-pay] onvalidatemerchant: error during validation", err);
196
197
  session.abort();
197
198
  redirectToFallbackCheckout(config);
198
199
  }
@@ -225,7 +226,8 @@ function startApplePaySession(config) {
225
226
  };
226
227
  trackWalletPaymentSheetOpen(config.skuId);
227
228
  session.begin();
228
- } catch {
229
+ } catch (err) {
230
+ console.error("[web-apple-pay] startApplePaySession: failed to create session", err);
229
231
  redirectToFallbackCheckout(config);
230
232
  }
231
233
  }
@@ -34,7 +34,8 @@ var isApplePayAvailable = async () => {
34
34
  );
35
35
  return false;
36
36
  }
37
- return await applePaySession.canMakePaymentsWithActiveCard(merchantId);
37
+ const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
38
+ return hasActiveCard;
38
39
  } catch (error) {
39
40
  console.error("Error checking Apple Pay active card status:", error);
40
41
  return false;
@@ -17,6 +17,7 @@ import type { SessionResponse } from './types';
17
17
  export type PaymentHandlerConfig = {
18
18
  skuId: string;
19
19
  country: string;
20
+ currency: string;
20
21
  returnUrl: string;
21
22
  /**
22
23
  * Optional `&country=` query param captured from the page URL at the moment
@@ -338,6 +338,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
338
338
  const result = await performPurchase({
339
339
  applePayToken: event.payment.token,
340
340
  skuId: config.skuId,
341
+ currency: config.currency,
341
342
  billingContact: event.payment.billingContact,
342
343
  ...event.payment.shippingContact && {
343
344
  shippingContact: event.payment.shippingContact
@@ -87,6 +87,7 @@ export type PurchaseRequest = {
87
87
  * only provide a `skuId`. Frontend uses `skuId` directly — BFF must be aligned.
88
88
  */
89
89
  skuId: string;
90
+ currency: string;
90
91
  billingContact: ApplePayPaymentContact;
91
92
  /** Required if loggedIn: false — contains emailAddress from Apple Pay sheet. */
92
93
  shippingContact?: ApplePayPaymentContact;