• Resolved Edd92

    (@edd92)


    I have two questions:

    1:
    I cannot set up recurring payments. The payment handler gives an error:

    
    paymenthandler: API call failed: Error executing API call (422: Unprocessable Entity): The payment method is not activated on your account. Field: method. Documentation: https://docs.mollie.com/guides/handling-errors0
    

    However the payment method is activated. The reason this message occurs may be because the call that was made to the API isn’t correct.

    The form data post to admin-ajax.php (along with name etc) is the following:

    
    paymenttype: recurring
    paymentoption: directdebit
    frequency: NULL
    chargedate: NULL
    

    2: I want a recurring payment yearly, the current option is X months, Is there a posibility to add year functionality, or can i adjust the source code myself to set it to years?

    Maybe it is a good idea to have a “debug mode” setting so that API calls are logged in Javascript console so we can see what is being sent to Mollie?

    Please let me know if my question is clear and if i can help you solve the problem.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author tsjippy

    (@tsjippy)

    yearly possibility does not exist see the API

    feel free to help on github

    Thread Starter Edd92

    (@edd92)

    Thank you for your quick responce.

    I have a workaround, 12 months interval would also be a year.
    To make the form user-friendly i would like to let them pick between month, quarter, half a year or a full year.

    <label> <b>How Frequent?</b>
    Once per [select frequency "year|12" "half year|6" "quarter year|4" "month|1"]
    </label>

    The Contact form 7 will show only the first part before the pipe “|”
    see: https://contactform7.com/selectable-recipient-with-pipes/

    The expected behavior is that the value after the pipe is picked to send as frequency.

    {name: “amount”, value: “15”}
    {name: “frequency”, value: “year”}

    But the text “year” is taken instead.

    I looked into the HTML But saw that the value was the same as the name, e.g. it is an CF7 issue.

    
    <select name="frequency" class="wpcf7-form-control wpcf7-select" aria-invalid="false">
    <option value="jaar">jaar</option>
    <option value="half jaar">half jaar</option>
    <option value="kwart jaar">kwart jaar</option>
    <option value="maand">maand</option></select>
    

    I resolved it by using the following snippet in functions.php in child theme

    
    #https://stackoverflow.com/questions/48515097/cant-set-values-for-select-option-in-contact-form-7
    #made to have name|value pipes work in combination with Mollie recurring payment
    function so48515097_cf7_select_values($tag)
    {
        if ($tag['basetype'] != 'select') {
            return $tag;
        }
    
        $values = [];
        $labels = [];
        foreach ($tag['raw_values'] as $raw_value) {
            $raw_value_parts = explode('|', $raw_value);
            if (count($raw_value_parts) >= 2) {
                $values[] = $raw_value_parts[1];
                $labels[] = $raw_value_parts[0];
            } else {
                $values[] = $raw_value;
                $labels[] = $raw_value;
            }
        }
        $tag['values'] = $values;
        $tag['labels'] = $labels;
    
        // Optional but recommended:
        //    Display labels in mails instead of values
        //    You can still use values using [_raw_tag] instead of [tag]
        $reversed_raw_values = array_map(function ($raw_value) {
            $raw_value_parts = explode('|', $raw_value);
            return implode('|', array_reverse($raw_value_parts));
        }, $tag['raw_values']);
        $tag['pipes'] = new \WPCF7_Pipes($reversed_raw_values);
    
        return $tag;
    }
    add_filter('wpcf7_form_tag', 'so48515097_cf7_select_values', 10);
    

    Now the Dropdown HTML looks like this:

    
    <select name="frequency" class="wpcf7-form-control wpcf7-select" aria-invalid="false">
    <option value="12">jaar </option>
    <option value="6">half jaar </option>
    <option value="4">kwart jaar </option>
    <option value="1">maand </option>
    </select>
    

    And it made the frequency picker super userfriendly!

    I don’t need any further action from your side, just wanted to post it here in case anyone else is having the same problem

    • This reply was modified 4 years, 6 months ago by Edd92.
    • This reply was modified 4 years, 6 months ago by Edd92.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Recurring payments error and interval field’ is closed to new replies.