Skip to content

PayPal Payflow iframe not showing up on second try #10110

@epson121

Description

@epson121

Preconditions

  1. Magento CE 2.1.5 (probably 2.1.7 as well), Linux, nginx, Varnish, PHP 7.0, MySQL 5.6
  2. Paypal Payflow pro payment method is enabled (with iframe)

Steps to reproduce

  1. Customer adds a product to cart, and goes to checkout
  2. On second step, customer selects Payflow Pro method
  3. iframe is displayed, and customer enters wrong data
  4. iframe is removed, and message is displayed asking to try again
  5. customer selects the same payment method again

Expected result

Iframe should be displayed

Actual result

Iframe is not displayed

Overview of the issue:

Second time the iframe is to be displayed, vendor/magento/module-paypal/view/frontend/web/js/view/payment/method-renderer/iframe-methods.js afterPlaceOrder method is triggerred, and the following code executed:

if (this.iframeIsLoaded) {
        document.getElementById(this.getCode() + '-iframe')
        	     .contentWindow.location.reload();
}

However, this fails because the source of the iframe is no longer on the stores domain - it is on paypal - and we have a cross-domain request which is blocked.

Workaround:

change the code above to the following:

 if (this.iframeIsLoaded) {
    var iframe = document.getElementById(this.getCode() + '-iframe');
    iframe.src = this.getActionUrl();
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions