Skip to content

Conversation

@m1aw
Copy link
Contributor

@m1aw m1aw commented Sep 12, 2025

Summary

Add support for a new API field sdkData. Please check internal ticket for the full details. This PR adds sdkData as an encrypted blob in the .data(), this is used both on sessions and advanced flow payment requests.

Tested scenarios

Fixed issue:
COSDK-514

@changeset-bot
Copy link

changeset-bot bot commented Sep 12, 2025

🦋 Changeset detected

Latest commit: 10c117d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adyen/adyen-web Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Sep 12, 2025

Deploy Preview for adyen-web ready!

Name Link
🔨 Latest commit 10c117d
🔍 Latest deploy log https://app.netlify.com/projects/adyen-web/deploys/69455ed648d9fc0008cc0f45
😎 Deploy Preview https://deploy-preview-3511.checkout-web-dev.adyen.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @m1aw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements support for a new sdkData API field, designed to centralize and transmit crucial analytics and risk-related information within payment requests. The sdkData is generated as a base64-encoded JSON blob, containing a schema version, checkout attempt ID, and client risk data. This ensures a standardized and secure way to pass this information for both session-based and advanced payment flows.

Highlights

  • New API Field sdkData: Introduces support for a new sdkData API field, which will be an encrypted blob containing analytics and risk information.
  • Data Encapsulation: The sdkData field consolidates analytics (specifically checkoutAttemptId) and riskData (specifically clientData) into a single, base64-encoded JSON object.
  • Integration into Payment Flows: This new field is integrated into the .data() method of BaseElement, ensuring its inclusion in payment requests for both sessions and advanced flows when relevant data is available.
  • Utility Function: A new utility createSdkData is added to handle the construction and encoding of the sdkData object.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a new sdkData API field, which encapsulates analytics and risk data into a single base64-encoded JSON string. The changes look good overall. I've added a couple of comments: one to prevent sending a 'failed' state value in the sdkData payload, and another to improve maintainability by using a constant for the schema version.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2025

size-limit report 📦

Path Size
UMD 113.96 KB (+0.1% 🔺)
Auto 120.18 KB (-0.01% 🔽)
ESM - Core 25.47 KB (+0.26% 🔺)
ESM - Core + Card 64.72 KB (+0.13% 🔺)
ESM - Core + Dropin with Card 71.24 KB (+0.12% 🔺)

@m1aw m1aw marked this pull request as draft September 23, 2025 12:32
@m1aw m1aw force-pushed the feature/add-sdkdata-support branch from c2aa44b to 9e987e7 Compare September 24, 2025 11:26
@m1aw m1aw force-pushed the feature/add-sdkdata-support branch from 9f6fe0a to 943e76b Compare October 24, 2025 09:21
@sonarqubecloud
Copy link

@m1aw m1aw force-pushed the feature/add-sdkdata-support branch from 943e76b to 14b2719 Compare December 19, 2025 12:45
@m1aw m1aw marked this pull request as ready for review December 19, 2025 14:01
@m1aw m1aw requested a review from a team as a code owner December 19, 2025 14:01
@m1aw
Copy link
Contributor Author

m1aw commented Dec 19, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a new sdkData API field, which will be part of payment requests. The changes look good overall, adding a utility to create the sdkData blob and integrating it into the BaseElement. However, I've found a couple of issues. There's a significant type mismatch that would cause incorrect serialization of the risk data within sdkData. Additionally, there's a missed edge case where a failed checkoutAttemptId could be used, leading to invalid analytics data. I've provided suggestions to fix these issues and also a minor one to improve type safety.

@m1aw m1aw requested a review from sponglord December 19, 2025 14:20
@sonarqubecloud
Copy link

return false;
}

get dataUnencoded(): object | false {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan here of returning either an object or false from the same function. We could make it more singular purpose by just retuning null as the negative case

Suggested change
get dataUnencoded(): object | false {
get dataUnencoded(): Record<string | any> | null {

return { version: RISK_DATA_VERSION, ...this.state.data };
}

return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return false;
return null;

* @param clientData - The client data from risk module
* @returns Base64 encoded JSON string of the SDK data object
*/
export function createSdkData(checkoutAttemptId: string, clientData: object): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function createSdkData(checkoutAttemptId: string, clientData: object): string {
export function createSdkData(checkoutAttemptId: string, clientData: Record<string, any>): string {

Object is also not the most easy to work with in typescript. I propose using Record<> instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants