Advertisement
Guest User

Untitled

a guest
May 20th, 2019
767
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2.  
  3. @Component({
  4. selector: 'app-paypal',
  5. templateUrl: 'paypal.page.html',
  6. styleUrls: ['paypal.page.scss'],
  7. })
  8. export class PaypalPage {
  9. paymentAmount: string = '3.33';
  10. currency: string = 'USD';
  11. currencyIcon: string = '$';
  12. constructor() {
  13. let _this = this;
  14. setTimeout(() => {
  15. // Render the PayPal button into #paypal-button-container
  16. window.paypal.Buttons({
  17.  
  18. // Set up the transaction
  19. createOrder: function (data, actions) {
  20. return actions.order.create({
  21. purchase_units: [{
  22. amount: {
  23. value: _this.paymentAmount
  24. }
  25. }]
  26. });
  27. },
  28.  
  29. // Finalize the transaction
  30. onApprove: function (data, actions) {
  31. return actions.order.capture()
  32. .then(function (details) {
  33. // Show a success message to the buyer
  34. alert('Transaction completed by ' + details.payer.name.given_name + '!');
  35. })
  36. .catch(err => {
  37. console.log(err);
  38. })
  39. }
  40. }).render('#paypal-button-container');
  41. }, 500)
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement