Run on device with HTTPS

I need to use a third-party payment script, and it required a https connection.

It’s possible to set a SSL certificate and run application on device with https://localhost?

I’m using Ionic + Cordova.


@Tommertom suggestion is as far as I know only for using non native development.
In this case when u are setting up the script I presume you need to give a return URl (which in your case would result in https://localhost/?queryparam) These things are not always accessible, and makes it difficult to accept returning calls. In this case I would recommend using Deeplinking on android and Universal links on iOS. What this means is that when u use the paymentportal you could refer to and then hook it back. In order to use this you would still need a HTTPS connection (which I would run by an external proxy).

There are plugins which make SSL running on the localhost, but true SSL pinning on cordova is not a big supported feature when I used it. Good luck!

1 Like

In fact, what I need is to run the app natively via an HTTPS address.

I’m using an eternal library of online payment, which requires calls to be made from an HTTPS address.

Is it possible? I have no idea how to do this.

@Tommertom thanks, but I need run on device, not serve application.


I know what you need, but I am asking why. If you use cordova your app is being hosted from either cordova:// or ionic:// or http://localhost depending on what version you are using. When you use cordova 10+ I think you can use a HTTPS serving of localhost by adding a config.xml this is not honored by iOS. since they do not allow serving files from HTTPS in their webview (this is a gist, you can read more about it here.

So if you really need HTTPS to connect to that library (maybe naming it would help in your ask for advice) should probably be done by a backend, that proxies your request.