Paypal client-side REST: how to notify server?

With Paypal Client-Side REST:

How does paypal notify server that a user has paid, so I can do some post-processing, write to database, etc.. is there a webhook i can attach?



Turns out they support hybrid, client-side to server-side and vice versa integrations:

With that you can create a payment on the client side, and using the server side SDK (paypal-rest-sdk), execute it on the server side.


  env: 'sandbox', // Or 'production',
  commit: true, // Show a 'Pay Now' button
  client: {
    sandbox: CLIENT_ID,
    production: CLIENT_ID
  payment: function(data, actions) {        
    return actions.payment.create({
  onAuthorize: function(data, actions) {
      type: 'POST',
      url: '',
      dataType: 'json',
      contentType: "application/json",
      data: JSON.stringify({
        payment_id: data.paymentID,
        payer_id: data.payerID
    }).done(function(data) {
      console.log('Payment received!');
  onCancel: function(data) {
    console.log('The payment was cancelled!');
}, '#paypal-button');


const paypal = require('paypal-rest-sdk');

let paymentId = req.params.payment_id;
let payerId = { payer_id: req.params.payer_id };

paypal.payment.execute(paymentId, payerId, function(err, payment){
        return error.errorHandler(err, null, null, reject, null);
      } else {
        if (payment.state == 'approved'){
          console.log('payment completed successfully');
        } else {
          console.log('payment not successful');


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.