Using Craft 3.4.9 and Commerce Pro 3.0.11

What's the best way to get more information onto a Paypal invoice so that I can match Paypal data with a Craft Commerce order? Does anyone have some success doing this?

At the very least, I would love to be able to pass the item SKU over into the Paypal invoice. Getting the Order Number from Craft onto a Paypal invoice would also be very useful.

There was this similar question back for Commerce 1: How do I send PayPal the Craft Commerce Order Number?

So in Commerce 3, I think a custom plugin with Event hook needs to be used, correct? https://docs.craftcms.com/commerce/api/v3/craft-commerce-services-payments.html#events

probably using the EVENT_BEFORE_PROCESS_PAYMENT event?

But Paypal is javascript based, so looking at the paymentForm.js file, there is the code:

// Copy over all the data to simulate a form being submitted
var postData = {};
var $formElements = $form.find('input[type=hidden]');

for (var i = 0; i < $formElements.length; i++) {
  if ($formElements[i].name === 'action') {
  postData[$formElements[i].name] = $formElements.get(i).value;

So can I pass acceptable Paypal express items as hidden inputs? It doesn't seem to work.

If I look at: https://developer.paypal.com/docs/archive/checkout/integrate/#2-set-up-a-payment it list there are possible variables which I tried to submit like:

<input type="hidden" name="invoice_number" value="{{ cart.id }}" />
<input type="hidden" name="description" value="{{ cart.id }}" />
<input type="hidden" name="soft_descriptor" value="{{ cart.id }}" />
<input type="hidden" name="note_to_payer" value="{{ cart.id }}" />

But that didn't seem to do anything.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.