Skip to content

PayPal Payflow Pro performs delayed capture with incorrect parent transaction ID #30870

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

Closed
1 of 5 tasks
aaronsilber opened this issue Nov 10, 2020 · 16 comments · Fixed by #30885
Closed
1 of 5 tasks

PayPal Payflow Pro performs delayed capture with incorrect parent transaction ID #30870

aaronsilber opened this issue Nov 10, 2020 · 16 comments · Fixed by #30885
Assignees
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.3.6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.

Comments

@aaronsilber
Copy link
Contributor

aaronsilber commented Nov 10, 2020

Shortly after updating to Magento 2.3.6, our client had a large volume of customers report they had been "charged twice." After investigating this, we found these customers had a lingering authorization (pending transaction) on their cards, in addition to a charge for the full amount of the order. The authorization remains until it expires, typically 30 days.

We found that changes to the Magento_Paypal module introduced in Magento 2.3.6 caused the incorrect parent transaction ID to be used when performing a delayed capture. Instead of using the order's authorization as the parent transaction ID (behavior prior to Magento 2.3.6), the $0.00 vault token authorization for the payment is used as the parent transaction ID.

This causes the authorization to remain open until it expires, and the transaction sent to Payflow is not associated to the original order authorization. Additionally, the transaction displays in Payflow as "Capture" instead of "Delayed Capture".

Merchants with "Payment Action" set to "Sale" are likely not impacted, but we have not tested this.

Preconditions (*)

  1. Magento Open Source >= 2.3.6
  2. magento/module-paypal >= 100.3.6

Steps to reproduce (*)

  1. Set up PayPal Payflow Pro gateway with "Payment Action" set to "Authorization"
  2. Place an order with a credit card
  3. Capture the order's payment by creating an invoice and choosing to Capture Online

Expected result (*)

payflow-transaction-correct-delayed-capture

  1. Magento Transaction is created with parent transaction ID of the authorization created at checkout
  2. A "Delayed Capture" transaction is sent to Payflow with a parent transaction ID of the authorization created at checkout
  3. Customer observes a new charge on their credit card for the amount of the invoice
  4. Customer observes pending transaction disappear from their card immediately, or within several days

Actual result (*)

payflow-transaction-incorrect-capture

  1. Magento Transaction is created with parent transaction ID of the authorization created at checkout
  2. A "Sale" transaction is sent to Payflow with a parent transaction ID of the vault token created at checkout
  3. Customer observes a new charge on their credit card for the amount of the invoice
  4. Customer observes pending transaction remain on their card for over a week, and until it expires, typically in 30 days
  5. Customer contacts merchant and reports they have been "charged twice"

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Nov 10, 2020

Hi @aaronsilber. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

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

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@aaronsilber
Copy link
Contributor Author

To fix this for our client, we created a Composer patch that partially reverts the modifications to the parent transaction IDs used in authorize and capture. This patch can be applied by creating a directory "patches", and extracting the attached file to patches/MAGENTO-TWO-30870.patch, and adding the following to composer.json:

        "patches": {
            "magento/module-paypal": {
                "Prevent duplicate authorizations when using Payflow with Delayed Capture": "patches/MAGENTO-TWO-30870.patch"
            }
        }

I'm working on reformatting this as a PR and will attach it once it's ready.

MAGENTO-TWO-30870.zip

@aaronsilber
Copy link
Contributor Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

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

@aaronsilber
Copy link
Contributor Author

Reproduced this issue on fresh 2.4-develop instance in Payflow Test Mode.

Note how the Magento Transaction displays the correct parent transaction ID for the invoice capture, but reviewing the actual transaction data in Payflow shows the incorrect parent transaction ID was used when submitting the transaction data to Payflow.

Magento transaction data after placing an order:
m2_30870_1_order_auth_tx

Payflow transaction data after placing an order:
m2_30870_2_order_auth_tx_payflow

Magento transaction list after capturing with an invoice:
m2_30870_3_order_capture_tx_list

Magento transaction data for the capture (shows expected parent transaction ID):
m2_30870_4_order_capture_tx

Payflow transaction data for the capture; shows incorrect parent transaction ID as well as transaction type "Sale" instead of expected "Delayed Capture":
m2_30870_5_order_capture_tx_payflow

@aaronsilber
Copy link
Contributor Author

@magento I am working on this

@m2-assistant
Copy link

m2-assistant bot commented Nov 11, 2020

Hi @aaronsilber! 👋
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

@aaronsilber
Copy link
Contributor Author

@magento add to contributors team

@m2-assistant
Copy link

m2-assistant bot commented Nov 11, 2020

Hi @aaronsilber! 👋
Thank you for joining. Please accept team invitation 👉 here 👈 and add your comment one more time.

@aaronsilber
Copy link
Contributor Author

@magento I am working on this

@aaronsilber aaronsilber removed their assignment Nov 12, 2020
@m2-community-project m2-community-project bot added Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Severity: S1 Affects critical data or functionality and forces users to employ a workaround. labels Nov 26, 2020
@engcom-Delta engcom-Delta self-assigned this Nov 30, 2020
@m2-assistant
Copy link

m2-assistant bot commented Nov 30, 2020

Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@sdzhepa sdzhepa added Reported on 2.3.6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jun 4, 2021
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @sdzhepa
Thank you for verifying the issue. Based on the provided information internal tickets MC-42279 were created

Issue Available: @sdzhepa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@gabrieldagama
Copy link
Contributor

@gabrieldagama gabrieldagama added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jun 16, 2021
@0xMatt
Copy link

0xMatt commented Nov 17, 2021

Not fixed in 2.4.3-p1.

When I capture a payment, a sales transaction is made. This doesn't close out the authorization and results in a double charge.

@0xMatt
Copy link

0xMatt commented Nov 17, 2021

To fix this for our client, we created a Composer patch that partially reverts the modifications to the parent transaction IDs used in authorize and capture. This patch can be applied by creating a directory "patches", and extracting the attached file to patches/MAGENTO-TWO-30870.patch, and adding the following to composer.json:

        "patches": {
            "magento/module-paypal": {
                "Prevent duplicate authorizations when using Payflow with Delayed Capture": "patches/MAGENTO-TWO-30870.patch"
            }
        }

I'm working on reformatting this as a PR and will attach it once it's ready.

MAGENTO-TWO-30870.zip

Confirmed this patch fixes the issue on 2.4.3-p1.

@engcom-Hotel engcom-Hotel moved this to Pull Request In Progress in High Priority Backlog Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.3.6 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Status: Pull Request In Progress
Development

Successfully merging a pull request may close this issue.

6 participants