How to Integrate Razorpay in Angular 2?

前端 未结 4 657
情歌与酒
情歌与酒 2020-12-17 01:22

I\'m using angular 2. I\'ve tried below URL\'s to integrate Razorpay [https://docs.razorpay.com/docs/checkout-form][1]

When i follow this URL, i got these errors lik

4条回答
  •  时光说笑
    2020-12-17 01:57

    Add anywhere in your component html file:

    
    

    and update your your component.ts file like so:

    import { Component } from '@angular/core';
    
    declare var Razorpay: any; 
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.css']
    })
    export class AppComponent {
        title = 'client';
        options = {
            "key": 'your app id', // Enter the Key ID generated from the Dashboard
            "amount": "50000", // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise or INR 500.
            "currency": "INR",
            "name": "Acme Corp",
            "description": "A Wild Sheep Chase is the third novel by Japanese author  Haruki Murakami",
            "image": "https://example.com/your_logo",
            "handler": function (response) {
                alert(response.razorpay_payment_id);
            },
            "prefill": {
                "name": "amin uddin",
                "email": "amidenf9701@gmail.com",
                "contact": "7992239847"
            },
            "notes": {
                "address": "note value"
            },
            "theme": {
                "color": "#F37254"
            }
        };
        initPay() {
            var rzp1 = new Razorpay(this.options);
            rzp1.open();
            console.log("works");
        }
    }
    

提交回复
热议问题