Skip to content

Commit

Permalink
Allow possibility to uss sessions (which will lead to a redirect 3DS2…
Browse files Browse the repository at this point in the history
… flow)
  • Loading branch information
sponglord committed Aug 28, 2024
1 parent 6a28354 commit eb2c200
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ export const createPayButton = (parent, component, attribute) => {

payBtn.addEventListener('click', e => {
e.preventDefault();
startPayment(component);

if (!contextArgs.useSessions) {
// If not using sessions, explicitly make a payment that will have the data necessary to force a native flow
startPayment(component);
} else {
// If using sessions, you can just use the regular submit flow, although, currently, this will always redirect
window.customCard.submit();
}
});

document.querySelector(parent).appendChild(payBtn);
Expand All @@ -36,9 +43,10 @@ const startPayment = component => {

makePayment(component.data, {
amount: { value: contextArgs.amount, currency: getCurrency(contextArgs.countryCode) },
// Force a native flow, if possible
authenticationData: {
attemptAuthentication: allow3DS2,
// comment out below if you want to force MDFlow
// Comment out below if you want to force the redirect/MDFlow
threeDSRequestData: {
nativeThreeDS: 'preferred'
}
Expand Down

0 comments on commit eb2c200

Please sign in to comment.