Php Paymill-交易失败-'';长度小于1个字符
我被这个错误困扰了很长一段时间,我不知道如何解决这个问题。我对传递给transaction对象的数据进行了两倍甚至三倍的检查,但仍然无法找出它为什么不断向我抛出这个“''长度小于1个字符”的错误消息。我甚至在互联网上找不到该错误消息的文档 我的代码当前状态的简要概述:Php Paymill-交易失败-'';长度小于1个字符,php,api,transactions,paymill,Php,Api,Transactions,Paymill,我被这个错误困扰了很长一段时间,我不知道如何解决这个问题。我对传递给transaction对象的数据进行了两倍甚至三倍的检查,但仍然无法找出它为什么不断向我抛出这个“''长度小于1个字符”的错误消息。我甚至在互联网上找不到该错误消息的文档 我的代码当前状态的简要概述: 我的事务对象创建被包装在try..catch语句中(\Paymill\Services\PaymillException) 正确创建客户端和支付对象。我可以在我的paymill控制面板上看到这两个 我还将购物车数组传递给事务对象
trim(substr(html\u entity\u decode($Item['description')),0,123))。“…”
[__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);
问题解决了。其中一个项目的描述字段为空。奇怪的是,异常不包括导致问题的字段名