juspay / juspay/hyperswitch

feat(google-pay): propagate message_id and message_expiration from decrypted GPay payload to UCS

Open
#11,684 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
43.7k
Forks
5.1k
Avg merge
2d 20h
Merged PRs (30d)
205

Description

## Problem

When Hyperswitch decrypts a Google Pay token, it parses `message_id` and `message_expiration` from the raw decrypted payload into `GooglePayPredecryptDataInternal` (`crates/hyperswitch_domain_models/src/router_data.rs`). However, these fields are **dropped** before the data is forwarded downstream — `GPayPredecryptData` (`crates/common_types/src/payments.rs`) only carries:

- `card_exp_month`
- `card_exp_year`
- `application_primary_account_number`
- `cryptogram`
- `eci_indicator`

As a result, UCS never receives `message_id` or `message_expiration`, and connectors that require these fields (e.g. Paysafe's Google Pay decrypted flow) are forced to use a random UUID and a placeholder value respectively.

## Impact

- **`messageId`**: Used by Paysafe (and potentially other PSPs) for **replay detection** — to ensure the same Google Pay cryptogram isn't used more than once. A random UUID defeats this protection in production.
- **`messageExpiration`**: Epoch milliseconds indicating when the token expires. A far-future placeholder is incorrect.

## Fix Required

1. Add `message_id: String` and `message_expiration: String` to `GPayPredecryptData` in `crates/common_types/src/payments.rs`
2. Populate them from `GooglePayPredecryptDataInternal` when constructing `GPayPredecryptData`
3. Add the fields to the gRPC `DecryptedData` proto and the UCS mapping in `crates/types-traits/domain_types/src/types.rs`

## Related

- UCS Paysafe Google Pay implementation: https://github.com/juspay/hyperswitch-prism/pull/680

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.