-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onAdditionalDetails callback sometimes receives undefined 'actions' parameter #3004
Comments
Hi @FilipSvozil , The You mentioned What is the tech stack of your app? And which payment methods are you currently offering? |
Hi @ribeiroguilherme , thanks for the confirmation. Yes,
And by callbacks, I mean the ones we pass in as configuration:
Tech stack is react 18, typescript, vite. We support the following methods (all imported from |
Hi @FilipSvozil , Your flow seems alright. Is there any specific reason that you are using the Can't you use the |
Thanks for the pointer and sorry for the delayed response. We've been using We'll release a version without |
@FilipSvozil thanks for the update. In the meanwhile, do you have a code snippet showcasing your |
@ribeiroguilherme sure, below is the relevant code, with some context. Regarding our planned solution: We intend to remove both the Current code: async function onSubmit(submitData, _component, actions) {
if (!submitData.isValid) {
return;
}
setState(state => ({
...state,
loading: true,
}));
const result = await request({
method: 'POST',
url: '/payments', // forwarded to Adyen's `/payments` endpoint through our BE
data: {
...submitData.data,
origin: window.location.origin,
},
});
if (!result.ok) {
actions?.reject?.();
setState(state => ({
...state,
loading: false,
resultCode: getResultCodeFromError(result),
}));
return;
}
if (result.data.action) {
setState(state => ({
...state,
loading: false,
adyenAction: result.data.action, // leads to the `createFromAction` on next render
}));
} else {
setState(state => ({
...state,
loading: false,
resultCode: getResultCode(result),
}));
}
actions?.resolve?.({
...result.data,
action: undefined, // have to remove action here for `createFromAction` to work
});
} Setting if (state.adyenAction) {
return <Our3DS />;
} else {
return <OurPaymentMethodList />;
} Where <div ref={divRef} /> And does the following one-time setup (on initial render): const component = state.checkout.createFromAction(state.adyenAction, {
challengeWindowSize: '05',
});
component.mount(divRef.current); Where |
Describe the bug
AdyenCheckout
'sonAdditionalDetails
callback sometimes receiveundefined
as the third parameter, i.e. we cannotresolve
, norreject
.This occurs approximately 50% of the time (very rough estimate), both in live and test environments.
I noticed it at least with card and google pay.
Is this intended behavior - does it indicate an issue on our side? How should we act when we don't get
actions
?If this is unexpected even for you, please let me know what additional information would be helpful, and I will extend our logging to gather more data.
To Reproduce
I didn't find a sure way to reproduce it. It sometimes happens with 3DSChallenge action, sometimes with 3DSFingerprint action.
Expected behavior
According to the types,
onAdditionalDetails
callback should always get anactions
object.And the documentation also shows that
onAdditionalDetails
takes 3 parameters, and the code example callsactions.resolve
unconditionally.Desktop (please complete the following information):
According to our logging, it happens at least on following browsers (random selection):
Smartphone (please complete the following information):
According to our logging, it happens at least on following browsers (random selection):
Additional context
We are using npm package:
@adyen/[email protected]
The text was updated successfully, but these errors were encountered: