PayPal Angular Integration

Viewed 588

I have an Angular application, where I need to integrate a PayPal payment process. I've been following some tutorials, but now I am stuck with this.

What I've done until now?

  1. run 'npm install xcomponent'
  2. run 'npm instal paypal-checkout'
  3. add <scriptsrc="https://www.paypalobjects.com/api/checkout.js"></script> to index.html
  4. add <paypal-button [props]="{ payment: payment, onAuthorize: onAuthorize }"></paypal-button> to the page I need the button to be rendered
  5. At app.module.ts, exported and imported (in NgModule imports list) a new Module like this:

    declare const paypal:any; export const PayPalButtonModule = paypal.Button.driver('angular2',{Component,NgModule,ElementRef,NgZone});

  6. Add to the component (lets call it MyPayPalComponent.ts) I need to render the button:

    payment() { console.log('payment'); } onAuthorize() { console.log("onAuthorize"); }

And the button is being rendered, but what is the next step? How to, at MyPayPalComponent.ts, "overload" the functions payment, onAuthorize and onCancel, to make everything work?

0 Answers
Related