Customer Events: Access Denied to redirect on checkout complete

Customer Events: Access Denied to redirect on checkout complete

apatuka
Shopify Partner
3 0 1

Greetings,

 

I want to attach a js script inside the thank you page, i want to redirect the user to a custom payment gateway.
This is the snippet:

analytics.subscribe('checkout_completed', (event) => {
  const checkout = event.data.checkout;
  console.log(event);
  console.log(checkout);
  console.log(checkout.transactions[0].gateway);
  if(checkout.transactions[0].gateway == 'bogus') {
      parent.document.location = URL_HERE;
  }
});

It says: Uncaught (in promise) DOMException: Permission denied to access property "document" on cross-origin object

How can i achieve what i want ? Thank you

Replies 0 (0)