Saturday, 22 September 2018

Paypal Plus success data

I'm using Paypal Plus in my angular Project. Everything thing works fine.

How can I recognize that the payment was made successfully? Which data must I save in my database. In short which data am I waiting for in success?

<div id="payments-container"></div>


export class PaypalComponent implements OnInit {
  paypalConfig = {
    env: 'sandbox',
    client: {
      sandbox: 'ATvgtyEZznsHf...',
      production: '<insert production client id>'
    },
    style: {
      layout: 'vertical',
      label: 'pay',
      size: 'responsive',
      shape: 'rect',
      color: 'gold'
    },
    commit: true,
    payment: (data, actions) => {
      return actions.payment.create({
        payment: {
          transactions: [{
            amount: {
              total: 10.5,
              currency: "EUR",
            }
          }]
        }
      });
    },
    onAuthorize: (data, actions) => {
      return actions.payment.execute().then((response) => {
        console.log('response', response);
        console.log('data', data);
        console.log('actions', actions);
      });
    },
    onCancel: (data, actions) => {
      console.log('Canceled!');
    }
  };

  ngOnInit() {
    paypal.Button.render(this.paypalConfig, '#payments-container');
  }
}



from Paypal Plus success data

No comments:

Post a Comment