how to render Amazon Pay API V2 button from typescript

86 views Asked by At

Here I am trying to integrate Amazon Pay Button in my angular application. Situation is that on which element I want to render button is inside an markup component, where I can't add script. So i have added it using another service FYI:Sucessfully. But still I got an error:Property 'Pay' does not exist on type 'amazon'.ts(2339) How can I resolve it?

Edit: I found out that it was using wrong typings.d.ts file which was for old widget. Now I have removed it. And getting another error: Cannot find name 'amazon'.ts(2304). I want to know how can I add type for Pay With Amazon API-v2?

<div id="AmazonPayButton"></div>

renderAmazonPayButton(){
    amazon.Pay.renderButton('#AmazonPayButton', {
      // set checkout environment
      merchantId: environment.awsClientId,
      publicKeyId: environment.publicKeyId,
      ledgerCurrency: 'USD',
      // customize the buyer experience
      checkoutLanguage: 'en_US',
      productType: 'PayAndShip',
      placement: 'Product',
      buttonColor: 'Gold',
      // configure Create Checkout Session request
      createCheckoutSessionConfig: {
        payloadJSON: JSON.stringify(this.payload),
        signature: this.signature,
        algorithm: this.algorithm
      }
    });
  }
0

There are 0 answers