question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with displaying stored payment information for cards

See original GitHub issue

Describe the bug It is no longer possible with the newest api to display stored card informations correctly.

The issue is the following one, the call to https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v53/post/paymentMethods returns the following result (reducted to relevant part):

{
  ....
  "storedPaymentMethods": [
    {
      ....
      "id": "8315980248.....",
      ....
      "type": "scheme"
    }
  ]
}

The adyen web components are expecting the following format to work tho:

{
  ....
  "storedPaymentMethods": [
    {
      ....
      "storedPaymentMethodId": "8315980248.....",
      ....
      "type": "scheme"
    }
  ]
}

So by using the newest api with the adyen components it is no longer possible without replacing the raw id with the storedPaymentMethodId to get the stored payment method properly displayed. Passing the information in the raw format is actually defined in the documentation here: https://docs.adyen.com/payment-methods/cards/web-component#show-a-stored-card-in-your-payment-form

To Reproduce Steps to reproduce the behavior:

  1. Inititialize a checkout via the following code and use the exact response you get for the request from with a shopperId https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v53/post/paymentMethods
if (paymentMethodsResponse != null && paymentMethodsResponse.storedPaymentMethods.length > 0) {
        const storedPaymentMethod = paymentMethodsResponse.storedPaymentMethods[0];
        const oneClick = checkout.create('card', storedPaymentMethod).mount('#component-container-one-click');
}
  1. The user has to enter the credit card data again

Expected behavior

  1. Initialize request as mentioned above
  2. User only has to enter the cvc from the stored payment method again

Screenshots If applicable, add screenshots to help explain your problem.

Expected result:

image

Actual result:

image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome

Hope i have written down the issue clear enough. 😃

best regards, David

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcperezcommented, Dec 7, 2020

Hi @denic, happy it’s all working for you now!

1reaction
marcperezcommented, Aug 24, 2020

Hi @Loktor,

In the case of stored payment methods, we process that response data when initializing a new checkout instance. Here you can find the detailed steps: https://docs.adyen.com/payment-methods/cards/web-component#show-a-stored-card-in-your-payment-form

These are the key points:

When creating an instance of the AdyenCheckout, pass the full /paymentMethods response to the paymentMethodsResponse object

const storedPaymentMethod = checkout.paymentMethodsResponse.storedPaymentMethods[0]; // This comes from the main instance, not the raw response itself
const card = checkout.create("card", storedPaymentMethod).mount("#stored-card");

Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix issues with saved payment info & passwords - Android
Tap Addresses and more or Payment methods. To add info: At the bottom, tap Add address or Add card. When you've entered your...
Read more >
The Do's & Don'ts of Storing Credit Card Information Safely
Some SaaS companies opt to store their customers' credit card information in-house. This is a risky choice. Find out why.
Read more >
Autofill credit card info in Safari on Mac - Apple Support
If you can't autofill credit card info​​ Try the following: In the Safari app on your Mac, choose Safari > Settings, click AutoFill,...
Read more >
6 Tips to Handle & Store Credit Card Information Securely
While you may have a business reason for storing credit card information, processing regulations specifically forbid the storage of a card's security code ......
Read more >
Enabling Stored Payment Methods - BigCommerce Support
Having a payment method saved on their account allows your customers to safely and securely complete future purchases faster. It's a convenient way...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found