WooCommerce + WooCommerce Stripe Payment Gateway で「Sorry, we are unable to process your payment at this time. Please retry later.」というエラー出たら

WordPressでECサイトに変えてしまうWooCommerce

WooCommerceでstripe決済を可能にするのが、 WooCommerce Stripe Payment Gatewayです。

プラグインをWooCommerceが公式プラグインとしてリリースしてくれているので簡単に導入することができます。また、世界中のフィードバックを受けながら進化・改善されているので運用面でも安心して利用できそうです。

stripeのテストモードを使って決済をすると以下のようなエラーに出くわしました。

Sorry, we are unable to process your payment at this time. Please retry later.

WooCommerce Stripe Payment Gatewayのログ出力を有効にして、WooCommerce – [ステータス] – [ログ] より確認してみると以下のようなログファイルが作成されていました。

woocommerce-gateway-stripe-20XX-XX-XX-xxxxxxxxxxxxxxxx

ログファイルには以下のような内容が記録されていました。

====Stripe Version: 4.1.9====
====Start Log====
charges request: Array
(
[currency] => jpy
[amount] => 1000
[description] => [文字化けしてる]
[statement_descriptor] => [文字化けしてる]
[capture] => true
[expand[]] => balance_transaction
[metadata] => Array
(
[customer_name] => test tarou
[customer_email] => test@example.com
[order_id] => 10
)
[source] => src_xxxxxxxxxxxxxxxxxxxxxxxx
)

====End Log====

descriptionstatement_descriptorあたりが文字化けしているのが気になります。

エラー内容でプラグインのフォーラムを検索してみるとドンピシャの内容がヒットしました。

https://wordpress.org/support/topic/sorry-we-are-unable-to-process-your-payment-at-this-time-please-retry-later/

解決策はこちらに書かれていました。

https://wordpress.org/support/topic/sorry-we-are-unable-to-process-your-payment-at-this-time-please-retry-later/page/2/#post-10212383

Thanks!! Now strip check-out got to work!
As you say, I checked statement discriptor, and changed to only alphabets, now it works.
And I tried to have Japanese letters, it also works.
But, when I have a special letter “|” in statement descriptor that maybe only Japanese has, the error massage appears. It seemed to be a cause of the error.

Anyway, thank you very much for your help and taking your time!!

to Japanese users
今回の原因は、woocommerce>設定>購入手続き>Stripe
の中の設定で、「ステートメント記述子」の箇所に「|」という記号を入れていたことが
原因だったと思われます。
アルファベットと日本語のみの記載にしたところ、エラーが消え、決済できるようになりました。

[ステートメント記述子] の設定を確認してみると、以下のように「クレジットカード」としていました。

これを以下のように「stripe」とすることでエラーなく決済ができるようになりました。

<追記>ステートメント記述子はカスタマーのクレジット明細に載るようなので、実際には会社名やサービス名の英字表記がよいかと思います。(5〜22文字)

 

こちらも参考:WooCommerceでStripe決済を導入する時のエラーの解決方法

これはStripeのステートメント記述子をアルファベットにしろということです。Stripeの設定画面から該当の箇所を見ると日本語で入力されていたため、こちらをアルファベットに変更したところ無事決済ができました。

ただし、WooCommerce Stripe Payment Gateway 4.1.9では上記記事のエラーは出ませんでした。

 

ちなみに、これはstripeのAPIの仕様なのでしょうがない。

stripeのAPI仕様ではステートメント記述子「」は以下のように定義されている。

Statement descriptors are limited to between 5 and 22 characters. They must contain at least 5 letters and cannot use the special characters <, >, \, ‘, or “.

https://stripe.com/docs/connect/statement-descriptors

つまり、5〜22文字で「 <, >, \, ‘, or “.」などの特殊文字は使えない。

同じく日本語も使えないようなので「クレジットカード」とするとエラーとなる。

しかし、画面の表示上、「stripe」と表記してもカスタマーがどのような決済方法か分からず購入に至らない可能性がある。

そのような場合、以下のコードを使うことでステートメント記述子を「クレジットカード」としつつ、内部的には「stripe」としてAPI送信することが可能。

https://gist.github.com/mt8/05c5d0cf1a2267adcf6e60ff773a0cdf

 

職人工房さんのブログにも紹介してもらいました。ありがとうございます。

https://wc.artws.info/2018/09/05/woocommerce-stripe-payment-gateway-statement-descriptor-error/