From 1b28696cc18a6aed537923a300a42be51bd0afd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jasi=C5=84ski?= Date: Fri, 13 Mar 2026 09:49:55 +0100 Subject: [PATCH 1/3] feat: add reason to payment cancelled for dc --- src/dynamic-checkout/payment-methods/apm.ts | 1 + src/dynamic-checkout/utils/events.ts | 1 + src/processout/actionhandler.ts | 2 +- src/processout/exception.ts | 8 +++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dynamic-checkout/payment-methods/apm.ts b/src/dynamic-checkout/payment-methods/apm.ts index ced0cdf1..c8fc0839 100644 --- a/src/dynamic-checkout/payment-methods/apm.ts +++ b/src/dynamic-checkout/payment-methods/apm.ts @@ -177,6 +177,7 @@ module ProcessOut { payment_method_name: apm.gateway_name, invoice_id: this.paymentConfig.invoiceId, return_url: this.paymentConfig.invoiceDetails.return_url || null, + tab_closed: error.metadata?.reason === "tab_closed", }) } else { this.resetContainerHtml().appendChild( diff --git a/src/dynamic-checkout/utils/events.ts b/src/dynamic-checkout/utils/events.ts index f8098afc..67852592 100644 --- a/src/dynamic-checkout/utils/events.ts +++ b/src/dynamic-checkout/utils/events.ts @@ -238,6 +238,7 @@ module ProcessOut { payment_method_name: string invoice_id: string return_url: string | null + tab_closed?: boolean }) { const event = DynamicCheckoutEventsUtils.createEvent( DYNAMIC_CHECKOUT_EVENTS.PAYMENT_CANCELLED, diff --git a/src/processout/actionhandler.ts b/src/processout/actionhandler.ts index 70b2b22a..0ae2b3f1 100644 --- a/src/processout/actionhandler.ts +++ b/src/processout/actionhandler.ts @@ -347,7 +347,7 @@ module ProcessOut { // The payment window was closed clearInterval(timer) timer = null - error(new Exception("customer.canceled")) + error(new Exception("customer.canceled", undefined, { reason: "tab_closed" })) // Temporary just to investigate the issue telemetryClient.reportWarning({ diff --git a/src/processout/exception.ts b/src/processout/exception.ts index 0f634ea8..afe80019 100644 --- a/src/processout/exception.ts +++ b/src/processout/exception.ts @@ -5,15 +5,20 @@ */ module ProcessOut { + export interface ExceptionMetadata { + [key: string]: any; + } + /** * ProcessOut Exception class */ export class Exception extends Error { public code: string; public message: string; + public metadata: ExceptionMetadata; public stack: string; - constructor(code: string, message?: string) { + constructor(code: string, message?: string, metadata?: ExceptionMetadata) { if (! message) message = Translator.translateError(code); @@ -21,6 +26,7 @@ module ProcessOut { this.code = code; this.message = message; + this.metadata = metadata; this.name = "ProcessOutException"; this.stack = ( new Error()).stack; From 119f6b4655cabf73d99ec30f24e38e9755445fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jasi=C5=84ski?= Date: Fri, 13 Mar 2026 10:02:45 +0100 Subject: [PATCH 2/3] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fa6b9869..d11a81a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "processout.js", - "version": "1.8.1", + "version": "1.8.2", "description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.", "scripts": { "build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js", From c639e3e8f233227cd50c711ad6ea3609cfef5975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jasi=C5=84ski?= Date: Mon, 16 Mar 2026 09:09:07 +0100 Subject: [PATCH 3/3] fix types --- src/processout/exception.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/processout/exception.ts b/src/processout/exception.ts index afe80019..b693c450 100644 --- a/src/processout/exception.ts +++ b/src/processout/exception.ts @@ -6,7 +6,7 @@ module ProcessOut { export interface ExceptionMetadata { - [key: string]: any; + [key: string]: string | boolean | number; } /**