• Resolved knochenmann

    (@knochenmann)


    hey,

    im trying to integrate this plugin but everytime i want to test sandbox or regular payments i get the following error:

    Response Body: {"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"8e6454835b52","details":[{"field":"/application_context/cancel_url","value":"/checkout/","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."}],"links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_PARAMETER_SYNTAX","rel":"information_link","encType":"application/json"}]}

    Okay so i guess paypal is checking the cancel_url and sees that its not a full url but only a relative part. So my question is: how can I change this cancel url?

    I tried to change with suggested filter in plugins github within my themes functions.php (is this right?):

    add_filter('ppcp_create_order_request_body_data', static function (array $data): array {
        $data['application_context']['cancel_url'] = 'https://FULLURL/checkout/';
        return $data;
    });

    but it stays the same in the request.

    Whereas when i use this snippet:

    add_filter('ppcp_create_order_request_body_data', 'changeCancelUrl' );
          
    function changeCancelUrl() {
        $data['application_context']['cancel_url'] = 'https://FULLURL/checkout/';
        return $data;
    };

    It works perfectly! But i can not think of this is the right way in getting this to work. Whats the problem, is it theme related what cancel_url gives back? where can i set this url manually without code?

    • This topic was modified 2 years, 10 months ago by knochenmann.
    • This topic was modified 2 years, 10 months ago by knochenmann.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter knochenmann

    (@knochenmann)

    Okay, after further testing, neither option works reliable and i have no clue why. I am absolutely at a loss why only “/checkout/” is returned.

    I could probably solve the problem now by adding the following filter:

    add_filter( 'woocommerce_get_checkout_url', 'custom_checkout_url', 30 );
    
    function custom_checkout_url( $checkout_url ) {
        return 'https://FULLURL/checkout/';
    }

    If someone has an answer to the question why my instance only returns /checkout/ instead of the whole URL I would be glad to know it

    • This reply was modified 2 years, 10 months ago by knochenmann.
    • This reply was modified 2 years, 10 months ago by knochenmann.
    Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @knochenmann,

    Potential plugin or theme conflicts usually cause issues like this.
    We have seen similar issues in other contexts with multilingual plugins, for example, as these tend to affect how the return URL might be generated.

    To rule out eventual issues with the theme or a different plugin, we recommend temporarily activating the default theme Storefront and disabling all other plugins except for?WooCommerce and?PayPal Payments to see if the behavior persists.

    Here’s a guide that explains the steps in more detail:
    How to test for conflicts
    It shouldn’t be needed to make any custom modifications to get the correct return URL, so the focus should not be on finding a workaround but on what’s originally causing the behavior. I hope this helps with isolating the cause!

    Kind regards,
    Niklas

    Plugin Support Femi

    (@femiyb)

    Hello

    We have not heard back from you in a while, so I’m marking this thread as resolved.
    We’ll be here to assist when you are ready to continue looking into this with us.
    If you have any further questions, please feel free to reopen this topic or create a new one.

    Cheers! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘INVALID_PARAMETER_SYNTAX on application_context/cancel_url’ is closed to new replies.