INVALID_PARAMETER_SYNTAX on application_context/cancel_url
-
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?
- The topic ‘INVALID_PARAMETER_SYNTAX on application_context/cancel_url’ is closed to new replies.