Martin Joiner
Martin Joiner

Reputation: 3657

Include a message/note field in a PayPal API payment

I am building a really simple payment form where the user can enter an amount and a thank you message. I have got it successfully working with just the amount but I cannot get add a message field and get it to come through!

enter image description here

Here is just the payment function of my JavaScript:

payment: function(data, actions) {
    return actions.payment.create({
        payment: {
            transactions: [
                {
                    amount: { 
                        total: window.transactionAmount, 
                        currency: 'GBP' 
                    },
                    note_to_payee: document.getElementById('custom-message').value,
                    description: 'A gift to Martin.',
                    custom: 'This is a test custom field',
                    payee: {
                        "email": "martin@[hidden].com"
                    }
                }
            ]
        },
        experience: {
            input_fields: {
                no_shipping: 1,
                allow_note: true
            }
        }
    });
},

I have tried setting custom and note_to_payee but neither seem to be recorded on either the notification email or the data that is logged in the recipient's account.

I have also tried turning on the ability for the payer to add a note by setting allow_note: true in the experience config but that does nothing!

Please help, just any way of passing through a little message with the payment is all I need.

Upvotes: 1

Views: 2681

Answers (3)

Australopythecus
Australopythecus

Reputation: 67

https://developer.paypal.com/sdk/js/reference/#onapprove

paypal.Buttons({
  createOrder: function(data, actions) {
    ...
  },
  onApprove: function(data, actions) {
    // This function captures the funds from the transaction.
    return actions.order.capture().then(function(details) {
      // This function shows a transaction success message to your buyer 
      alert('Transaction ' + transaction.status + transaction.id);                          
     window.location.href = 'https://www.yoursite.com/page.php?trnsid='+ transaction.id;
    });
  }
}).render('#paypal-button-container');

You can do a redirect onApprove.

If the transaction was completed redirect the user to a page with a FORM THAT GET/capture the transactionID (associate the message with a transaction) and ADD a MESSAGE TEXTAREA so user can send some notes after payment.

Upvotes: 0

James Osguthorpe
James Osguthorpe

Reputation: 171

A workaround for this would be to use an "option variable" to create a textbox in your checkout flow. An example of an option variable would be "os0" and "on0".

Here is an example on our website on how you would implement this: https://www.paypal.com/us/cgi-bin/webscr?cmd=_pdn_xclick_options_help_outside

Upvotes: 1

Martin Joiner
Martin Joiner

Reputation: 3657

It took PayPal Support team 4 days to come back with the answer that No, it cannot be done.

Here's their full response:

With regard to your request, I have to inform you that "note to seller" (allow_note:true) field is only available in the older PayPal payment experience, and is not available in the newer payment experience.

Unfortunately, there's nothing the caller can do at this time to force an old or new experience and we recommend to collect this information in your website where possible.

So it looks like they've dropped one of the nicest and most simple features of the PayPal checkout which was the ability to include a friendly little note.

Now, my only option is to build a whole back-end system with API end-points and extend my JavaScript just to record my payer's note. Meanwhile, every email notification I receive will continue to contain that annoying lie: "The buyer hasn't entered any instructions".

PayPal: Please, either implement a feature in your new process or remove/hide the feature! Don't do a half-way job. You take 10% of all my transactions, I expect better.

Upvotes: 9

Related Questions