Skip to content

[Backport] Fix the invalid currency error in credit card payment of PayPal Payflow Pro or Payments Pro #22557

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

Merged

Conversation

niravkrish
Copy link
Contributor

Original Pull Request

#22399
Needs to provide the currency code explicitly in the $0.00 verification call, otherwise the payment would fail when store's default currency is not USD.

Description (*)

When the store default currency is not USD, the credit card payment with Payflow Pro or Payments Pro would fail with an error complaining "invalid currency code"

My store's default currency is set to CAD, the Payflow Pro payment didn't go through. By PayPal support team's investigation, they found the "$0.00 verification call" is with USD currency, but the following non zero call was with CAD currency, in which condition PayPal doesn't accept the payment.

But I don't find our API calls to PayPal ever explicitly added USD, so that I can guess without a currency code is actually default to USD.

Back to the two calls from Magento to PayPal, the second one is using store default for currency code, so the change is to also add store default currency code to the first one. And by changing that, my transaction went through successfully.

Here is the original comments from PayPal support guys:

Thanks for reaching out today. Happy to help.

It looks as though this is an issue with the currency code you're passing. Right now it appears you're trying to pass USD in on the $0.00 verification call, but CAD on the actual 2.20 transaction itself. When you verify a card, the transaction you attempt against that verification must use the same currency. Try passing the subsequent transaction with USD, or create the verification in CAD and then run the transaction against it using CAD. See https://developer.paypal.com/docs/classic/payflow/integration-guide/#submitting-account-verifications for more on verifications. That's a great resource for Payflow in general as well.

That should resolve the issue you're seeing, but please let us know if you run into any other issues.

I hope that helps. Let us know if you have any questions.

Regards,
Eric B.

Fixed Issues (if relevant)

n/a

Manual testing scenarios (*)

  1. Setup PayPal Payflow payment for credit card
  2. Set store default currency to CAD
  3. Credit card payment fails

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

…ation call, otherwise the payment would fail when store's default currency is not USD.
@m2-assistant
Copy link

m2-assistant bot commented Apr 30, 2019

Hi @niravkrish. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.2-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch, thank you for the review.
ENGCOM-4858 has been created to process this Pull Request

@VasylShvorak
Copy link
Contributor

@magento-engcom-team give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @VasylShvorak. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @VasylShvorak, here is your new Magento instance.
Admin access: https://pr-22557.instances.magento-community.engineering/admin
Login: admin Password: 123123q

@sdzhepa
Copy link
Contributor

sdzhepa commented May 15, 2019

✔️ QA Passed

@m2-assistant
Copy link

m2-assistant bot commented May 17, 2019

Hi @niravkrish, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

magento-engcom-team pushed a commit that referenced this pull request May 17, 2019
@magento-engcom-team magento-engcom-team added this to the Release: 2.2.10 milestone May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants