Post Message

Post messsge events are sent to client side using the browser API.

Code example:

const childWindow = document.getElementById('sensepass-iframe').contentWindow;
window.addEventListener('message', message => {
    // Handle message
});

Payload Example - Approved Transaction

{
    "type": "transaction",
    "payload": {
        "transaction": {
            "TransactionNumber": "6736b8abd2faa15d7f4137a64d45e62a486f2fdc5238c5eda3a8bf38",
            "date": "2024-10-22T09:03:26.906Z",
            "amount": "2",
            "baseAmount": "2",
            "currency": "USD",
            "status": 5,
            "statusName": "Transaction Approved",
            "timeoutDate": "2024-10-29T10:03:27.124Z",
            "maxInstallments": 1,
            "reason": null,
            "methodType": 0,
            "businessName": "Barak .inc",
            "pos": "Barak .inc",
            "businessOwnerPhone": "888888",
            "businessCountry": "UNITED STATES",
            "businessCity": "Pan",
            "businessState": "QC",
            "businessStreet": "St.Peter",
            "businessHouseNumber": 5,
            "businessAddress": "Pan, St.Peter 5",
            "businessLocaleName": "IL",
            "branchNumber": "888",
            "products": [],
            "productsSum": {
                "allAmountSum": "0.00",
                "allTipSum": "NaN",
                "allVatSum": "0.00",
                "allTotalSum": "0.00",
                "allDiscountSum": "0.00",
                "allDiscountedAmountSum": "0.00"
            },
            "isNativeApp": false,
            "isSensePassPCI": true,
            "confirmation": {
                "approvedBy": "Klarna Sandbox",
                "dateApproval": "2024-10-22T09:03:44.405Z",
                "approvalDate": "2024-10-22T09:03:44.405Z",
                "paymentType": "Regular",
                "sensePassReferenceId": "2yqrlzxnmddfxjz5gq0l",
                "paymentMethodCode": 26,
                "paymentMethodName": "Klarna",
                "paymentMethodLogo": "https://pay.sandbox.sensepass.com/publicAssets/payment-method/klarna-white.png",
                "providerId": "r2ywtY+rigPVLZj0Bay7Qe+d03tHJk8lEzfdzonj7Hs=",
                "requestID": "2acdcfcb-8c63-4841-8426-cededd311f99",
                "amount": 2,
                "confirmationNumber": "273-2acdcfcb-8c63-4841-8426-cededd311f99",
                "fullConfirmationCode": "273-2acdcfcb-8c63-4841-8426-cededd311f99",
                "cardType": null,
                "lastFourDigits": null,
                "expiration": null,
                "cardExpiration": null,
                "paymentMethod": "Klarna",
                "Klarna": {},
                "extraDetails": {},
                "providerName": "Klarna Sandbox"
            },
            "paymentProcessRequestID": "2acdcfcb-8c63-4841-8426-cededd311f99",
            "confirmationNumber": "273-2acdcfcb-8c63-4841-8426-cededd311f99",
            "confirmations": [
                {
                    "approvedBy": "Klarna Sandbox",
                    "dateApproval": "2024-10-22T09:03:44.405Z",
                    "approvalDate": "2024-10-22T09:03:44.405Z",
                    "paymentType": "Regular",
                    "sensePassReferenceId": "2yqrlzxnmddfxjz5gq0l",
                    "paymentMethodCode": 26,
                    "paymentMethodName": "Klarna",
                    "paymentMethodLogo": "https://pay.sandbox.sensepass.com/publicAssets/payment-method/klarna-white.png",
                    "providerId": "r2ywtY+rigPVLZj0Bay7Qe+d03tHJk8lEzfdzonj7Hs=",
                    "requestID": "2acdcfcb-8c63-4841-8426-cededd311f99",
                    "amount": 2,
                    "confirmationNumber": "273-2acdcfcb-8c63-4841-8426-cededd311f99",
                    "fullConfirmationCode": "273-2acdcfcb-8c63-4841-8426-cededd311f99",
                    "cardType": null,
                    "lastFourDigits": null,
                    "expiration": null,
                    "cardExpiration": null,
                    "paymentMethod": "Klarna",
                    "Klarna": {},
                    "extraDetails": {},
                    "providerName": "Klarna Sandbox"
                }
            ],
            "hasAccountingProcessor": true,
            "balance": 2,
            "clientPhoneNumber": null,
            "clientEmail": null
        }
    }
}

Payload Example - Cancelled Transaction

{
    "type": "transaction",
    "payload": {
        "transaction": {
            "TransactionNumber": "8921dc842847880d08a30e11a4784ffae59933a3674b2dce9e84d00d",
            "date": "2024-10-22T09:04:59.369Z",
            "amount": "5",
            "baseAmount": "5",
            "currency": "USD",
            "status": 9,
            "statusName": "Canceled",
            "timeoutDate": "2024-10-29T10:04:59.617Z",
            "maxInstallments": 1,
            "reason": null,
            "methodType": 0,
            "businessName": "Barak .inc",
            "pos": "Barak .inc",
            "businessOwnerPhone": "888888",
            "businessCountry": "UNITED STATES",
            "businessCity": "Pan",
            "businessState": "QC",
            "businessStreet": "St.Peter",
            "businessHouseNumber": 5,
            "businessAddress": "Pan, St.Peter 5",
            "businessLocaleName": "IL",
            "branchNumber": "888",
            "products": [],
            "productsSum": {
                "allAmountSum": "0.00",
                "allTipSum": "NaN",
                "allVatSum": "0.00",
                "allTotalSum": "0.00",
                "allDiscountSum": "0.00",
                "allDiscountedAmountSum": "0.00"
            },
            "isNativeApp": false,
            "isSensePassPCI": true,
            "clientPhoneNumber": null,
            "clientEmail": null
        }
    }
}

Last updated