• Resolved marketwo

    (@marketwo)


    hello,
    on my woocommerce I have noticed a bug regarding special characters in the image url sent to stripe checkout.

    I have the brand Levi’s?
    and wordpress generates the image url with this character: ?

    Orders with stripe checkout have this error:
    url_invalid – line_items[0][price_data][product_data][images][0]
    Invalid URL: Non-ASCII characters in URLs must be percent-encoded in order for the URL to be valid.

    I tried editing your plugin file
    wp-content\plugins\payment-gateway-stripe-and-woocommerce-integration\includes\class-stripe-checkout.php
    line 315

    from:
    $session_data[‘line_items’][$index][‘price_data’][‘product_data’][‘images’][] = array(($featured_image[0]);

    to:
    $session_data[‘line_items’][$index][‘price_data’][‘product_data’][‘images’][] = array(url_encode($featured_image[0]));

    sending to stripe this url:
    https%3A%2F%2Fgoccia.shop%2Fwp-content%2Fuploads%2F2023%2F01%2Fjeans-regular-loose-levis%C2%AE-denim-501-levis-original-00501-3261-1673274958-1-150×150.jpeg

    the error is no longer generated but stripe is no longer able to display the image preview in the checkout.

    I therefore FINALLY SOLVED it by encoding only that specific character:

    $entities = array(‘?’,);
    $session_data[‘line_items’][$index][‘price_data’][‘product_data’][‘images’][] = array(str_replace($entities, ‘%C2%AE’,$featured_image[0]));

    I hope you can use this to fix this in a future update.

    • This topic was modified 1 year, 9 months ago by marketwo.
Viewing 1 replies (of 1 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @marketwo,

    Greetings from WebToffee support.

    Thank you for taking the time and effort in bringing this issue to our notice. We will certainly look into it and add this fix in the upcoming releases of the plugin.

    Thanks again for your valuable contribution.

Viewing 1 replies (of 1 total)
  • The topic ‘url image encoding bug’ is closed to new replies.