Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public sendPaypal(price: string): void {
  2.     this.reservation();
  3.     this.hidden = true;
  4.     this.loadExternalScript('https://www.paypalobjects.com/api/checkout.js').then(() => {
  5.       paypal.Button.render({
  6.         env: 'sandbox',
  7.         client: {
  8.           production: '',
  9.           sandbox: 'AcUXHundjcOxwZFDFGU2rluWl9nSUtB_J83azAMEWyU7vPEcG56hsZzTCuO4Hqx1GNADkTMjc5ObWJsi'
  10.         },
  11.         locale: 'fr_FR',
  12.         style: {
  13.           color: 'blue',
  14.           shape: 'rect',
  15.           size: 'medium'
  16.         },
  17.         commit: true,
  18.         payment: function (data, actions) {
  19.           return actions.payment.create({
  20.             'intent': 'sale',
  21.             'payer': {
  22.               'payment_method': 'paypal'
  23.             },
  24.             'transactions': [
  25.               {
  26.                 'amount': {
  27.                   'total': price,
  28.                   'currency': 'EUR',
  29.                 },
  30.                 'description': 'Réservation de places de cinéma',
  31.                 'payment_options': {
  32.                   'allowed_payment_method': 'INSTANT_FUNDING_SOURCE'
  33.                 }
  34.               }
  35.             ],
  36.             'redirect_urls': {
  37.               'return_url': 'http://imagix-api20171119050303.azurewebsites.net/home',
  38.               'cancel_url': 'http://imagix-api20171119050303.azurewebsites.net/home'
  39.             }
  40.           })
  41.         },
  42.         onAuthorize: function(data, actions) {
  43.           return actions.payment.execute().then(function(payment) {
  44.  
  45.           })
  46.         }
  47.       }, '#paypal-button');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement