Import ppplus-library for rendering payment wall v

2019-08-20 06:38发布

问题:

Is it possible to import a given JS-Library (in my case it would be https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js from this .pdf file chapter 8.1 - "Integrating the payment wall")?

The text tells me the following:

1) Include JS library:

<script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js"
type="text/javascript"></script>

2) Define a placeholder DIV:

<div id="ppplus"> </div>

3) Render Payment wall:

<script type="application/javascript">
 var ppp = PAYPAL.apps.PPP({
 "approvalUrl": "'.$approval_url.'",
 "placeholder": "ppplus",
 "mode": "sandbox",
"country": "DE"
 });
</script>

Since I want to use this in a NativeScript application I cannot use the script-Tag. My workaround would be to import this (if possible) like an usual module.

What I tried:

import * as "https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js"

but he can't find the given module (which seems kinda obvious, since it is no installed module itself). Is there any other way to do this?

PS: If you know any other way to include the wall, feel free to tell me, it might be a better idea than mine :).

回答1:

You need to find SDK for android/ios as this library is browser dependant, it will not work for you as Nativescript don't have DOM objects like browsers as i see many mouse events and other thinng