Digital Payments - Changes to transactionCancelled event in Embed
Expected Release Dates:
- Sandbox: July 15, 2025
- Production: July 22, 2025
Summary
Upcoming change Gr4vy will be changing the payload for the transactionCancelled
event raised by Embed to contain more data.
Background
Gr4vy Embed has an event handler called onEvent()
. This parameter allows to listen to transactionCancelled
events, which are raised when the Apple Pay / Google Pay payment sheets are dismissed.
setup({
onEvent: (name, data) => {
if (name === "transactionCancelled") {
// inspect data
}
},
});
Currently, these events include a data payload that is a string.
"Apple Pay: Session cancelled"
"Google Pay: Session cancelled"
This is inconsistent with other payloads where data
is an object.
Changes
With this change, the new data payload will return an object instead of a string.
{
"type": "cancellation",
"method": "apple_pay",
"message": "Session cancelled"
}
{
"type": "cancellation",
"method": "google_pay",
"message": "Session cancelled"
}
Impact
Please check if you are expecting the data property to be a string. For example, your code might perform a check to see if data === 'Apple Pay: Session cancelled'
.
Instead, please check any of the new object’s properties, for example data.method === 'applepay' && data.type === 'cancellation'
.