Support » Plugin: Checkout with Vipps for WooCommerce » The transaction text is too long!

  • The express buttons don’t work and give me the following error in the logs:
    WOO-VIPPS The transaction text is too long! We are using a shorter transaction text to allow the transaction text to go through, but please check the 'woo_vipps_transaction_text_shop_id' filter so that you can use a shorter name for your store.

    What can cause such an issue? And how to hill it?

    I’ve found the definition of ‘woo_vipps_transaction_text_shop_id’:

    This is used to identify your shop in the transaction texts sent to Vipps (and shown to the user). Default is home_url(), but there is a length limit, so this filter allows you to keep it short.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author iverok

    (@iverok)

    The transaction text can be a maximum of 100 characters. The filter you found can help with that, there is also another filter
    apply_filters('woo_vipps_transaction_text', $transactionText, $order);

    – the default will be “Confirm your order from <shop id>” in your local language.

    However, it’s probably not that which causes your transactions to fail, because as the error states, if your text is more than 100 chars, it will in fact be truncated so as to be less than 100 chars.

    Is there any other errors in the logs?

    (You should also probably try to use the filter above to eliminate the “too long transaction text” error – try with this in your child-themes functions.php or in a plugin:

    add_filter('woo_vipps_transaction_text', function ($transactionText, $order) {
     return "Confirm your order";
    }, 10, 2);

    (modify the string to be any text at all less than 100 chars).

    zderekh

    (@zderekh)

    I’ve tried the filter you’ve mentioned, but without any luck. I’m getting actually 2 logs for each failed transaction:

    2020-06-17T18:16:10+00:00 WOO-VIPPS The transaction text is too long! We are using a shorter transaction text to allow the transaction text to go through, but please check the 'woo_vipps_transaction_text_shop_id' filter so that you can use a shorter name for your store
    2020-06-17T18:16:15+00:00 ERROR #!trpst#trp-gettext data-trpgettextoriginal=3047#!trpen#Kunne ikke opprette Vipps-betaling#!trpst#/trp-gettext#!trpen# 500 cURL error 28: Operation timed out after 5001 milliseconds with 0 bytes received
    Plugin Author iverok

    (@iverok)

    Yes, the first is just a warning (probably due to a very long store name or something like that). The second however seems to be a failure to contact Vipps’ servers in that a transport layer times out after five seconds with no response. If the call actually made it through to Vipps, but with the response failing (and therefore the initiate_payment call) it may be that that order number has been “used up” without Woo being aware of this. However, the error message looks wrong – all the “#!trps” stuff is not normal.

    Unfortunately it looks like there is a configuration problem on your local server which makes this hard to debug without access to the environment. It is possible to up the default timeout to say 10s, but that should really not be neccessary, which indicates that there is probably something else going on.

    If you want to test with a longer timeout, you will currently have to modify the VippsApi.class.php file. Add this to line 425, right before the call to wp_remote_request

    $args['timeout'] = 10;

    Incidentally, the filter I added in the last post was actually tested in my local functions.php (in my child-theme on a dev site), and when tested, worked. Therefore you have probably added the filter somewhere where it isn’t read. But it isn’t terribly important: It should not cause the kind of problems you see.

    I’ve figured that the issue is caused by using TranslatePress plugin in combination with Vipps payment. It seems like the TranslatePress attempt to translate strings that are related to the payment.

    I’ve turned on debugger mode in TranslatePress and now get another record in my WooCommerce logs:

    2020-07-02T20:00:33+00:00 ERROR #!trpst#trp-gettext data-trpgettextoriginal=#!trpen#Kunne ikke opprette Vipps-betaling#!trpst#/trp-gettext#!trpen# 400 {merchantInfo.consentRemovalPrefix.invalid}

    Could you assist me to figure out what string causes the issue?

    Link to the localized version of the product page with a Vipps button: https://www.amfium.no/no/produkt/baseus-adjustable-laptop-stand/

    Plugin Author iverok

    (@iverok)

    How did you determine TranslatePress was the problem? The strings involved are supposed to be translated.

    The actual error here is

    {merchantInfo.consentRemovalPrefix.invalid}

    which is a message from Vipps that one of the callback urls to your site is invalid. When I try a purchase, the initate-payment link works however, so I don’t see how you should have gotten this error. Unless somehow this string was translated?

    Normally you will see these when a site is set up with an invalid domain or certificate, or when permalinks aren’t set to the standard Woo settings.

    It seems like the GEO setting on TranslatePress was enabled, so you’ve been redirected to the English (original) site version. In order to reproduce the issue, you’d need to click on the “NORSK BOKMÅL” link in the footer and then try to place an order.

    The weird part is that it indeed works on the original version of the site (English) and doesn’t on the localized, that’s why I assumed the issue caused by TranslatePress.

    Plugin Author iverok

    (@iverok)

    Ok – I would guess then that unfortunately there is some incompatibility between translatepress and the express checkout button in general, probably caused by the way these ‘special’ pages are handled.

    Unfortunately, I don’t have TranslatePress available for testing this; but there is a small chance that the problem can be helped a bit by going to your Vipps settings page (/wp-admin/admin.php?page=wc-settings&tab=checkout&section=vipps) and finding the setting with the title “Use a real page ID for the special Vipps pages.”. You will need to create a blank, normal page as well, and then choose that page here.

    I can’t guarantee that this will help, but it may work better with plugins that don’t work with simulated pages.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.