skip to Main Content

I added the Paypal Smart Buttons API to my website, with the following code:

paypal.Buttons({
  createOrder: function(data, actions) {
    return actions.order.create({
      purchase_units: [{ amount: { value: 0.01 } }],
    });
  },
  onApprove: function(data, actions) {},
  onClick: function(){
    //HERE I WANT TO GET THE PAYPAL’S BUTTON WHICH HAS BEEN CLICKED.
},
}).render('#paypal-button-container');

Is there any way to get the clicked button?

2

Answers


  1. Which funding source a payer has used within PayPal is kept private by design. All you see is whether they have completed a PayPal payment.

    Login or Signup to reply.
  2. I think you cannot know the clicked button. However, after completing the payment, you can know which button has been clicked based on the payment. After approving the payment, you can access the payer details like this,

    details.payer
    

    You can see the attributes of the payer from this link:
    PayPal API, Orders, Payer Definition
    For example you can check payment_source_response like this,

    details.payer.payment_source_response
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search