Title: Patch Custom note change (PayPal API)
Last modified: October 8, 2019

---

# Patch Custom note change (PayPal API)

 *  Resolved [borish1](https://wordpress.org/support/users/borish1/)
 * (@borish1)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/patch-custom-note-change-paypal-api/)
 * Hi I need this code modified from this:
 *     ```
       /**
            * @return Patch
            * @throws InvalidArgumentException
            */
           public function custom()
           {
               $custom_patch = new Patch();
               $custom_patch
                   ->setOp('add')
                   ->setPath('/transactions/0/custom')
                   ->setValue($this->order->get_order_key());
   
               return $custom_patch;
           }
       ```
   
 * to this:
 *     ```
       /**
            * @return Patch
            * @throws InvalidArgumentException
            */
           public function custom()
           {
               $custom_patch = new Patch();
               $custom_patch
                   ->setOp('add')
                   ->setPath('/transactions/0/custom')
                   ->setValue(wp_json_encode([
                       'order_id' => $this->order->get_id(),
                       'order_key' => $this->order->get_order_key(),
                   ]));
   
               return $custom_patch;
           }
       ```
   
 * Is there an easy way to do? Maybe you have some hooks that I could attach to?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [Andreas W.](https://wordpress.org/support/users/aweissinpsyde/)
 * (@aweissinpsyde)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/patch-custom-note-change-paypal-api/#post-12009237)
 * Hello [@borish1](https://wordpress.org/support/users/borish1/)
 * how I see you already modified it. Can you give me more information about it 
   please?
 *  Thread Starter [borish1](https://wordpress.org/support/users/borish1/)
 * (@borish1)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/patch-custom-note-change-paypal-api/#post-12014565)
 * Hey Andreas,
 * Yep, I modified it but directly inside the files (only on my development server
   to test it). The file is located inside /src/payment/ folder by the name of patchProvider.
   php.
 * The key part of the functions is this one
    `->setValue($this->order->get_order_key());`
 * Currently, your plugin, upon successful creation of the invoice is sending custom
   data which in this case is wc_order_key.
 * Now if we go back to 1.1.1 version of this plugin it actually sent both the wc_order_key
   and and order_id which is this part of code that I changed into:
 *     ```
       ->setValue(wp_json_encode([
                       'order_id' => $this->order->get_id(),
                       'order_key' => $this->order->get_order_key(),
                   ]));
       ```
   
 * Now my client is using third party software which pulls data via PayPal API from
   his PayPal account to double-check the order_key and order_id from the invoices
   but in 2.0.4 version we only have now order_key.
 * That is the main reason why I needed that order_id.
 * It would be good if you can put filter there so we can then add additional data
   without need to edit the core files of the plugin.
 *  Thread Starter [borish1](https://wordpress.org/support/users/borish1/)
 * (@borish1)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/patch-custom-note-change-paypal-api/#post-12014591)
 * Some additional notes:
 * [https://ibb.co/VDwCZ1Y](https://ibb.co/VDwCZ1Y)
 * On the image, you can preview part of the invoice from the PayPal dashboard.
   
   The part that is important is the CUSTOM row which is basically a “Note” by the
   PayPal API documentation.
 * That functions of yours custom() is passing only order_key but I need order_id
   as well.
 * I hope this helps :).
 *  Plugin Support [Andreas W.](https://wordpress.org/support/users/aweissinpsyde/)
 * (@aweissinpsyde)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/patch-custom-note-change-paypal-api/#post-12020174)
 * Hello [@borish1](https://wordpress.org/support/users/borish1/)
 * right now we can’t simply change code because new code will be revied and approved
   by PayPal. I’ll talk to our developer next Wednesday because currently, he is
   on holiday.
 *  Plugin Support [Andreas W.](https://wordpress.org/support/users/aweissinpsyde/)
 * (@aweissinpsyde)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/patch-custom-note-change-paypal-api/#post-12038329)
 * Hello [@borish1](https://wordpress.org/support/users/borish1/)
 * we create an internal issue for it. The reference number is PPP-384 and it should
   be fixed with the next update.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Patch Custom note change (PayPal API)’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woo-paypalplus_a2c4dd.svg)
 * [PayPal Plus for WooCommerce](https://wordpress.org/plugins/woo-paypalplus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-paypalplus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-paypalplus/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-paypalplus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-paypalplus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-paypalplus/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Andreas W.](https://wordpress.org/support/users/aweissinpsyde/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/patch-custom-note-change-paypal-api/#post-12038329)
 * Status: resolved