• Resolved Scholto Bos

    (@scholtobos)


    From today credit card transactions cannot be processed. And I can’t find what the problem is. Can someone take a look and give me some directions of what is going wrong?

    2022-05-12T14:50:18+00:00 DEBUG creditcard: Start process_payment for order 51143
    2022-05-12T14:50:18+00:00 DEBUG mollie_wc_gateway_creditcard: Create Mollie payment object for order 51143
    2022-05-12T14:50:18+00:00 DEBUG  Order 51143 returnUrl: https://www.overeenkomsten.nl/afrekenen/order-received/51143/?key=wc_order_sY0dXVyQsWawQ&order_id=51143&filter_flag=onMollieReturn
    2022-05-12T14:50:18+00:00 DEBUG  Order 51143 webhookUrl: https://www.overeenkomsten.nl/wc-api/mollie_wc_gateway_creditcard?order_id=51143&key=wc_order_sY0dXVyQsWawQ&filter_flag
    2022-05-12T14:50:18+00:00 DEBUG Creating payment object: type Order, first try creating a Mollie Order.
    2022-05-12T14:50:18+00:00 DEBUG {"amount":{"currency":"EUR","value":"8.95"},"redirectUrl":"https:\/\/www.overeenkomsten.nl\/afrekenen\/order-received\/51143\/?key=wc_order_sY0dXVyQsWawQ&order_id=51143&filter_flag=onMollieReturn","webhookUrl":"https:\/\/www.overeenkomsten.nl\/wc-api\/mollie_wc_gateway_creditcard?order_id=51143&key=wc_order_sY0dXVyQsWawQ&filter_flag","method":"creditcard","payment":{"issuer":null,"customerId":null,"cardToken":"tkn_FEGuhBMHBT"},"locale":"nl_NL","metadata":{"order_id":51143,"order_number":"51143"},"orderNumber":"51143"}
    2022-05-12T14:50:18+00:00 DEBUG Creating payment object: type Order, first try failed: [2022-05-12T14:50:18+0000] Error executing API call (422: Unprocessable Entity): The following fields of the billingAddress are missing: streetAndNumber, postalCode, city, country. Documentation: https://docs.mollie.com/overview/handling-errors. Request body: {"status":422,"title":"Unprocessable Entity","detail":"The following fields of the billingAddress are missing: streetAndNumber, postalCode, city, country","field":"billingAddress","_links":{"documentation":{"href":"https://docs.mollie.com/overview/handling-errors","type":"text/html"}}}. Field: billingAddress
    2022-05-12T14:50:18+00:00 DEBUG Creating payment object: type Order, did not fail because of incorrect customerId, so trying Payment now.
    2022-05-12T14:50:18+00:00 DEBUG Creating payment object: type Payment, creating a Payment.
    2022-05-12T14:50:18+00:00 DEBUG  Order 51143 returnUrl: https://www.overeenkomsten.nl/afrekenen/order-received/51143/?key=wc_order_sY0dXVyQsWawQ&order_id=51143&filter_flag=onMollieReturn
    2022-05-12T14:50:18+00:00 DEBUG  Order 51143 webhookUrl: https://www.overeenkomsten.nl/wc-api/mollie_wc_gateway_creditcard?order_id=51143&key=wc_order_sY0dXVyQsWawQ&filter_flag
    2022-05-12T14:50:18+00:00 DEBUG Array
    2022-05-12T14:50:19+00:00 DEBUG [2022-05-12T14:50:19+0000] Error executing API call (422: Unprocessable Entity): The card token cannot be used for this payment. Documentation: https://docs.mollie.com/overview/handling-errors. Request body: {"status":422,"title":"Unprocessable Entity","detail":"The card token cannot be used for this payment","field":"cardToken","_links":{"documentation":{"href":"https://docs.mollie.com/overview/handling-errors","type":"text/html"}}}. Field: cardToken
    2022-05-12T14:50:19+00:00 DEBUG : Failed to create Mollie payment object for order 51143: [2022-05-12T14:50:19+0000] Error executing API call (422: Unprocessable Entity): The card token cannot be used for this payment. Documentation: https://docs.mollie.com/overview/handling-errors. Request body: {"status":422,"title":"Unprocessable Entity","detail":"The card token cannot be used for this payment","field":"cardToken","_links":{"documentation":{"href":"https://docs.mollie.com/overview/handling-errors","type":"text/html"}}}. Field: cardToken

    It says that billing fields are missing, but we only provide digital products so we don’t ask for billing/shipping details other than an emailadress. Until today this was never a problem.

    Thanks in advance.

    • This topic was modified 2 years, 9 months ago by Scholto Bos.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @scholtobosk,

    Apologies for the trouble with the payments.

    The first error in this log (422: Unprocessable Entity): The following fields of the billingAddress are missing: streetAndNumber, postalCode, city, country. is coming from the Mollie Orders API as this is the default API used and it has certain requirements. Through this API, an “order” is created at Mollie with customer details and information about the order.
    If you don’t provide the billing fields in the checkout, then creating an “order” at Mollie will fail. This is not a major issue though as the plugin has a fallback to the Payments API which does not need these details to process a payment. But when you don’t provide the fields, you could also change the default API to Payments since the Orders API wouldn’t work anyway.
    Previously in an earlier Mollie v7 release, this fallback to the Payments API didn’t trigger correctly, which could potentially prevent the Checkout but has been resolved since.

    But this follow-up error "status":422,"title":"Unprocessable Entity","detail":"The card token cannot be used for this payment","field":"cardToken" is rather unusual.
    The best way to deal with this would probably be to clear the transients.
    One way to achieve this would be to manually delete the option mollie-payments-for-woocommerce_profile_merchant_id from the wp_options database table.

    Or alternatively, the latest update 7.1 implemented a feature in the “Mollie advanced settings” section to reset the plugin settings. This will reset all plugin settings back to the default and it will also clear all Mollie transients like the plugin was never installed.
    I hope this helps!

    Kind regards,
    Niklas

    Thread Starter Scholto Bos

    (@scholtobos)

    Thanks for your extensive explanation. Clearing the transients did the trick. Everything is working again.

    Before I switch from Orders API to Payment API, I have two short questions.

    1. I only want to collect Order ID, Customer Name and Mail Address in the Mollie Dashboard. Does the Payment API support these three?
    2. Does the Payment API also support recurring payments via SEPA, or is the Orders API required

    Thanks for your answers. After that you can close the ticket.
    Have a nice evenening.

    Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @scholtobos,

    Since all “attempted orders” are being converted into payments anyway when not all of the required details are provided, everything would be the same at Mollie as it is now when you change the default method in the plugin settings. You would primarily end up reducing the number of API calls and it may slightly improve the checkout speed since the entire checkout flow is shortened.
    An order can only be created when all details are provided otherwise it fails and falls back. If successful, an order would eventually also contain the payment.
    But the payment itself does not contain any details about the customer or the order.

    However, in the latest version 7.1, the API Payment description setting (in Mollie advanced settings) has been expanded and it could be expanded further to provide all of your requested data inside of the payment description.

    For the time being, there are some presets but none for the email address. But it could be added in the code here with a line like this:
    '{customer.email}' => $order->get_billing_email(),
    With this extra line and an API Payment description of {orderNumber} {customer.firstname} {customer.lastname} {customer.email}, it would collect the requested data directly in the payment.

    The only two limitations from the Payments API are the Voucher and (all) Klarna gateways are not compatible with it. Beyond this, it works as usual with recurring payments, etc.

    Kind regards,
    Niklas

    Thread Starter Scholto Bos

    (@scholtobos)

    Ok, great. Then I will switch to the Paymenent API. Thanks.
    Kind regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘422: Unprocessable Entity’ is closed to new replies.