• Resolved unisonosoftworks

    (@unisonosoftworks)


    Hi,

    in class-paypal-express-request-builder.php (add_payment_params) you add shipping data to the request data by checking for empty fields and skip any shipping field if ONE field is empty from checkout.

    1. You include “SHIPTOPHONENUM” (which is billing_phone in woo). If a shop doesn’t collect or require customers phone numbers, this will always trigger and will remove all shipment data from the request.
    2. You are missing SHIPTOSTREET2 in the second check (within the foreach).
    3. Both #1+#2 combined result into a bug if a shop uses the shipping_address_2 field:
      a) phone is empty, so all shipping fields are skipped
      b) SHIPTOSTREET2 is not removed, because it’s not part of the loop
      c) this leads to validation error, plugin / paypal expecting now a full address / country code etc.

    Latest plugin, woo and wordpress version btw.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @unisonosoftworks,

    Thank you for taking the time to share these detailed observations.

    We appreciate you pointing out the behavior around the SHIPTOPHONENUM and SHIPTOSTREET2 fields in the class-paypal-express-request-builder.php file.

    Let me review this further with the team. We’ll get back to you shortly with an update.

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @unisonosoftworks,

    Thanks for your patience.

    We’ve reviewed the behavior with our development team, and here’s what we found:

    1. Shipping Fields & PayPal Validation
      PayPal requires all essential shipping fields like name, address line 1, city, and postal code to be present. To prevent validation errors, our plugin is designed to send shipping data only when all required shipping fields are available. You can refer to PayPal’s documentation for the required fields here.
    2. SHIPTOSTREET2 Handling
      If any of the required shipping fields are missing, this field should also be excluded. We’ve acknowledged this oversight, and our team will investigate this and provide an update.

    Thread Starter unisonosoftworks

    (@unisonosoftworks)

    Thanks for your reply. Following the paypal docs, phone number shouldn’t be part of the first check in the function. This field is optional. (PAYMENTREQUEST_n_SHIPTOPHONENUM)

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @unisonosoftworks,

    Thanks for your patience. We’ve reviewed the implementation in line with PayPal’s documentation and have made the following adjustments:

    • Refined the logic to ensure optional fields like SHIPTOPHONENUM do not interfere with shipping data.
    • Ensured SHIPTOSTREET2 is properly handled when required shipping fields are incomplete.

    These updates have been added to the plugin and will be included in the upcoming plugin release.

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

The topic ‘Review add_payment_params function – breaking’ is closed to new replies.