Paymill - 交易失败 - '' 的长度小于 1 个字符

Paymill - failed transaction - '' is less than 1 characters long

我被这个错误困扰了很长一段时间,我不知道如何解决这个问题。我对传递给事务对象的数据进行了双重甚至三重检查,但仍然无法找出为什么它一直向我抛出“''长度小于 1 个字符”错误消息。我什至无法在互联网上找到该错误消息的文档。

我的代码当前状态的简要概述:

  1. 我的事务对象创建包含在 try..catch 语句中 (\Paymill\Services\PaymillException)

  2. 正确创建了客户端和支付对象。我可以在我的 paymill 控制面板上看到这两个。

  3. 我也将购物车数组传递给交易对象

  4. 正在使用此序列导出项目描述:trim(substr(html_entity_decode($item['description']), 0, 123)) . "..."

  5. 正在通过信用卡付款

  6. 第一次付款成功第二次失败

这是部分异常对象输出:

[__PHP_Incomplete_Class_Name] => Paymill\Services\PaymillException
            [_errorMessage:Paymill\Services\PaymillException:private] => '' is less than 1 characters long
            [_responseCode:Paymill\Services\PaymillException:private] => 
            [_httpStatusCode:Paymill\Services\PaymillException:private] => 400
            [_rawObject:Paymill\Services\PaymillException:private] => 
            [message:protected] => '' is less than 1 characters long
            [string:Exception:private] => 
            [code:protected] => 400
...
[__PHP_Incomplete_Class_Name] => Paymill\Models\Request\Transaction
                                            [_amount:Paymill\Models\Request\Transaction:private] => 6613
                                            [_description:Paymill\Models\Request\Transaction:private] => Order ID: 111111-11111-1111
                                            [_currency:Paymill\Models\Request\Transaction:private] => EUR
                                            [_payment:Paymill\Models\Request\Transaction:private] => pay_1234566789
                                            [_client:Paymill\Models\Request\Transaction:private] => client_123456
                                            [_preauthorization:Paymill\Models\Request\Transaction:private] => 
                                            [_token:Paymill\Models\Request\Transaction:private] => 123456
                                            [_feeAmount:Paymill\Models\Request\Transaction:private] => 
                                            [_feePayment:Paymill\Models\Request\Transaction:private] => 
                                            [_feeCurrency:Paymill\Models\Request\Transaction:private] => 
                                            [_source:Paymill\Models\Request\Transaction:private] => 
                                            [_shippingAddress:Paymill\Models\Request\Transaction:private] => Array
                                                (
                                                    [name] => Full name
                                                    [street_address] => full address
                                                    [street_address_addition] => N/A
                                                    [city] => full city
                                                    [state] => state as well
                                                    [postal_code] => 123456
                                                    [country] => CC
                                                )

                                            [_billingAddress:Paymill\Models\Request\Transaction:private] => Array
                                                (
                                                    [name] => Full name
                                                    [street_address] => full address
                                                    [street_address_addition] => N/A
                                                    [city] => full city
                                                    [state] => state as well
                                                    [postal_code] => 123456
                                                    [country] => CC
                                                    [phone] => 123456
                                                )

                                            [_items:Paymill\Models\Request\Transaction:private] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [name] => full item name
                                                            [amount] => 123456
                                                            [description] => full description
                                                            [quantity] => 1
                                                            [item_number] => 123456-1
                                                            [url] => https://123123.html
                                                        )
...
[_shipping_amount:Paymill\Models\Request\Transaction:private] => 400
                                            [_handling_amount:Paymill\Models\Request\Transaction:private] => 
                                            [_mandateReference:Paymill\Models\Request\Transaction:private] => 
                                            [_id:protected] => 
                                            [_serviceResource:protected] => Transactions/
                                            [_filter:protected] => 
                                        )

                                    [1] => create
                                )

                        )

这是我发起交易的方式

$transaction->setClient($this->getClient()->getId())
                        ->setPayment($this->getPayment()->getId())
                        ->setToken($this->getToken())
                        ->setAmount($this->getBasket('total')*100)
                        ->setBillingAddress($billing_address)
                        ->setShippingAddress($shipping_address)
                        ->setCurrency($this->getConfig('currency'))
                        ->setItems($items)
                        ->setDescription("Order ID: " . $this->getBasket('cart_order_id'))
                        ->setShippingAmount($this->getBasket('shipping')['value']*100);
            $this->d($this->getClient());
            $r = $this->getRequest()->create($transaction);

问题已解决。其中一项的描述字段为空。奇怪的是异常没有包含导致问题的字段名称。