Following a hyperlink from an event


I’m trying to implement Gov.UK Pay and when running the API I get a next_url for payments. Currently I can only follow it after saving it to a link then clicking on it. Is there a way to follow the URL straight up (I have a return URL so I can already get back to Netcall). I have tried window in code studio event actions but it’s coming out as undefined


Hi. Try


in a Code Studio event action instead. You will need to ensure that the rule which triggers the action is not set to run in the background.

For reference the “window” class will not be available in Event Actions as the code is run server-side rather than in your browser. The same applies for any other browser specific features, including the DOM.

1 Like

Hey Bob,
Tried that in 2 different ways

var n_url = params.custom.next_url;




neither worked

the examples seemed to imply you use a reference which can’t get an external page.

Apologies, it appears cs.redirect() is only for other pages within the app, not external URLs.

Another option would be to create a Presenter in Code Studio, which just displays the link, but you can then have frontend JS code that runs in the browser that automatically redirects you to that link when shown. So it could be shown like you often see on other payment pages:

Please click this link if not redirected in 5 seconds…

Morning Robin,

We have an operational Gov UK Pay integration working in a Citizen Hub Environment as part of a Bulky Waste application.

We are looking to document and convert this into a Module which will be shared on AppShare in the near future.

If you have any further questions please let me know.