Payment callback url
-
Hello,
Currently this plugin uses the value of
get_bloginfo('wpurl')
to build Paysera payment request callback url. Please refer toPayseraPaymentRequest::buildParameters
method.The call to
get_bloginfo('wpurl')
is basically and equivalent of callingget_site_url()
function which is not the best function to use for any frontend urls, including API endpoints. This value is mostly used in admin area, whileget_home_url()
is used for any front-facing urls.WooCommerce itself uses
get_home_url()
to build it’s ownwc-api
urls. Please refer to it’s source code: https://github.com/woocommerce/woocommerce/blob/3c9d1353e5b0b30c4613b158ce471cd7b9933472/plugins/woocommerce/includes/wc-core-functions.php#L1070We are using custom multilingual solution for some websites which appends language code to all frontend urls. This is done via
home_url
filter because this is the only correct way to do it.We also redirect user from root url to default language. I.e. https://example.com is redirected to https://example.com/en/.
Since this plugin uses
site_url
option to build it’s callback url, the callback is being sent to root url (i.e. https://example.com/?wc-api=wc_gateway_paysera) which is then redirected to https://example.com/en/?wc-api=wc_gateway_paysera which might not be the language version that user used during checkout. For example if user placed an order via estonian version, the callback will be sent to root url without language code and then redirected to english version. This might cause some inconsistencies in our custom workflow and that tiny redirect is also bothering me.Please consider using
home_url
orget_home_url
functions for building callback requests instead ofget_bloginfo('wpurl')
or please makecallbackurl
value filterable via WordPress hooks so we can adjust the value ourselves.Best Regards,
Roman
- The topic ‘Payment callback url’ is closed to new replies.