How to integrate PayPal express checkout into angular2 typescript project

后端 未结 4 1430
说谎
说谎 2021-02-19 08:57

Paypal provides an easy way to integrate its express checkout solution but what is the best solution to use this solution in an angular2 project working written in typescript?

4条回答
  •  借酒劲吻你
    2021-02-19 09:47

    you can implement paypal checkout with angular 4 like this :

    import { Component, OnInit } from '@angular/core';
    
    declare let paypal: any;
    
    @Component({
        selector: 'app-page-offers',
        templateUrl: './page-offers.component.html',
        styleUrls: ['./page-offers.component.sass']
    })
    
    export class PageOffersComponent implements OnInit {
    
        constructor() {}
    
        ngOnInit() {
            $.getScript( 'https://www.paypalobjects.com/api/checkout.js', function() {
                paypal.Button.render({
                 [...]
                })
        [...]
    

    Enjoy :)

提交回复
热议问题