PayU Typescript types definition does not work in Angular project

56 Views Asked by At

I'm trying to implement PayU payments in my project by following their documentation https://developers.payu.com/en/card_tokenization.html. It says "If you use Typescript in your project, just add a types definition to your project." So I did

npm install --save @types/payu-emea-sdk

It also says "Add JS SDK script to every page you want to use Secure Form on". Here I added https://secure.payu.com/javascript/sdk as script tag in my index.html file. I also added types definition to tsconfig.json "compilerOptions"

"types": [ "node", "payu-emea-sdk" ]

Now when I try to use example

var payu = PayU('393823');

compiler says "Cannot find name 'PayU'."

I was chatting with GPT for a couple of hours, but it gave up and sent me to support. I asked support, but they don't have a working example of Secure Forms in Angular. How can I use the provided type definitions in my project? Or, at least, how can I use the SDK without type definitions?

0

There are 0 best solutions below