Import ppplus-library for rendering payment wall via given Link in TypeScript

◇◆丶佛笑我妖孽 提交于 2019-12-12 04:47:52

问题


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



来源:https://stackoverflow.com/questions/45609151/import-ppplus-library-for-rendering-payment-wall-via-given-link-in-typescript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!