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

I got stuck with this error for quite a while and I can't figure out how to solve this problem. I double, even triple, checked data passed to transaction object and still can't find out why it keeps throwing me this " '' is less than 1 characters long " error message. I couldn't even find documentation for that error message on the internet.
Brief overview of current state of my code:
My transaction object creation is wrapped in try..catch statement (\Paymill\Services\PaymillException)
Client and Payment objects created correctly. I can see those two on my paymill control panel.
I'm passing shopping cart array to Transaction object as well
Item description is being derived using this sequence:trim(substr(html_entity_decode($item['description']), 0, 123)) . "..."
Payment is being made via credit card
First payment was successful second one fails
here's partial exception object output:
[__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
)
)
This is how I initiate transaction
$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);

Problem solved. One of the items was with empty description field. Strange that Exception did not include a field name which was causing problems.

Related

Stripe PHP checkout API : Error: Exception: Received unknown parameter: shipping

Im trying to pass shipping details to the checkout session built with:
\Stripe\Checkout\Session::create
But I guet this error:
Breaking news… Error: Exception: Received unknown parameter: shipping (in /myserver/stripe-php/lib/Exception/ApiErrorException.php line 38)
Except from that part the process works fine. Even if I pass "shipping" => null it doesn't give the error.
In the API reference it just shows the "shipping" data array as an optional attributes.
Here is the complete array I'm passing to the session::create
[billing_address_collection] => required
[payment_method_types] => Array
(
[0] => card
)
[line_items] => Array
(
[0] => Array
(
[price_data] => Array
(
[currency] => eur
[product_data] => Array
(
[name] => MEMBER 004: Dark Storm
[description] => sizes:'S-M'
[images] => Array
(
[0] => http://mywebsite.com/image.jpg
)
)
[unit_amount] => 1995
)
[quantity] => 1
)
)
[mode] => payment
[success_url] => http://mywebsite.com/succes/
[cancel_url] => http://mywebsite.com/cancel/
[shipping_address_collection] => Array
(
[0] => ES
)
[shipping] => Array
(
[address] => Array
(
[city] => Barcelona
[country] => ES
[line1] => Street name 81
[line2] => 12
[postal_code] => 09028
[state] => Catalunya
)
[name] => My name
)
[customer_email] => myname#gmail.com
)
You don't pass a shipping address into a Checkout session like this. It is not a parameter of the create endpoint. The shipping attribute of the session object will be populated with the customer shipping address when you use the shipping_address_collection parameter, as I see in your example.
So, you need to remove the invalid shipping parameter and instead inspect that on the result.

Eror "price must be consistent across all products" etsy

I send "https://openapi.etsy.com/v2/listings/listing_id/inventory" but i received error "price must be consistent across all products"
that's what i give in offerings:
[offerings] => Array
(
[0] => Array
(
[price] => Array
(
[amount] => 14500
[divisor] => 100
[currency_code] => USD
[currency_formatted_short] => $145.00
[currency_formatted_long] => $145.00 USD
[currency_formatted_raw] => 145.00
)
[quantity] => 7
[is_enabled] => 1
[is_deleted] => 0
)
)
I had the same problem, and you also have to add the parameter [price_on_property], even if Etsy Api say it's optional.
When you are trying to update inventory, you don't include the entire Money object as json. The price is supplied as a double value only. (ex. "price=29.99")
It would look more like this
[offerings] => Array
(
[0] => Array
(
[price] => 145.00
[quantity] => 7
[is_enabled] => 1
[is_deleted] => 0
)
)

what is the success response after a transaction with square up php process payment

i am recieveing this response after a transaction but i am not able to find the success or failure response,also i am not aware of the flow please correct me if i am wrong,
we have a sandbox account on square up we have an ecommerce web.
store with buy now option after submitting the form with nounce and
correction location id we are moved to process payments file where.
it displays the response after a transaction is made.
Response
SquareConnect\Model\ChargeResponse Object
(
[errors:protected] =>
[transaction:protected] => SquareConnect\Model\Transaction Object
(
[id:protected] => 1d034209-12cf-5d13-72f4-62247bb49132
[location_id:protected] => CBASEB5G76QcIpEWB0w38Mi2vWUgAQ
[created_at:protected] => 2017-07-27T05:45:34Z
[tenders:protected] => Array
(
[0] => SquareConnect\Model\Tender Object
(
[id:protected] => 675e208b-caf3-5f11-7482-1eacff13da64
[location_id:protected] => CBASEB5G76QcIpEWB0w38Mi2vWUgAQ
[transaction_id:protected] => 1d034209-12cf-5d13-72f4-62247bb49132
[created_at:protected] => 2017-07-27T05:45:34Z
[note:protected] => Online Transaction
[amount_money:protected] => SquareConnect\Model\Money Object
(
[amount:protected] => 100
[currency:protected] => USD
)
[processing_fee_money:protected] =>
[customer_id:protected] =>
[type:protected] => CARD
[card_details:protected] => SquareConnect\Model\TenderCardDetails Object
(
[status:protected] => CAPTURED
[card:protected] => SquareConnect\Model\Card Object
(
[id:protected] =>
[card_brand:protected] => DISCOVER
[last_4:protected] => 9697
[exp_month:protected] =>
[exp_year:protected] =>
[cardholder_name:protected] =>
[billing_address:protected] =>
[fingerprint:protected] =>
)
[entry_method:protected] => KEYED
)
[cash_details:protected] =>
)
)
[refunds:protected] =>
[reference_id:protected] =>
[product:protected] => EXTERNAL_API
[client_id:protected] =>
[order:protected] =>
[shipping_address:protected] =>
)
)
If you get a transaction back, then your request was successful. If you get errors back, your request was not successful.
you ll get Transaction id return to the Redirect URL

SOAP not fetches result in PHP for Mouzenidis travel

I try to get results from http://api.mouzenidis-travel.com/search/ServiceMainSearch.svc?Wsdl
There is some methods to fetch data:
GetCountries // fetch available country data
GetCityDeparture(int countryID) //fetch available departure city data
GetFilter(int countryId, List departureCityId) // fetch others filters
// My PHP code:
$client = new SoapClient("http://api.mouzenidis-travel.com/search/ServiceMainSearch.svc?Wsdl");
$countryList = $client->GetCountries(); // results below
[0] => stdClass Object
(
[Code] => GR
[ID] => 29
[Name] => ГрециÑ
[NameLat] => Greece
)
[1] => stdClass Object
(
[Code] => CZ
[ID] => 6240
[Name] => ЧехиÑ
[NameLat] => Czech Republic
)
$cityDepObj = $client->GetCityDeparture(array('countryID'=>29));
[0] => stdClass Object
(
[Code] => MOW
[GroupName] => РоÑÑиÑ
[GroupNameLat] => РоÑÑиÑ
[GroupOrder] => 4
[ID] => 1
[Name] => МоÑква
[NameLat] => Moscow
[CountryID] => 460
[IsDeparture] => 1
[RegionID] => 0
)
[1] => stdClass Object
(
[Code] =>
[GroupName] => РоÑÑиÑ
[GroupNameLat] => РоÑÑиÑ
[GroupOrder] => 4
[ID] => 299
[Name] => ÐрхангельÑк
[NameLat] => Arkhangelsk
[CountryID] => 460
[IsDeparture] => 1
[RegionID] => 0
)
.
.
.
$client->GetFilter(array(29,array(1)));
Fatal error: Uncaught SoapFault exception: [s:Client] No connections available ...
I wrote to the Mouzendinis Tech Support, no results.
What make I wrong?
In C# this method requires field 'Country' as int, not an array of int. Also, other fields must be initialized as empty array or null.
The last field is a dictionary that caused filter update. For example: if you changed the city of departure, you should set the field to DictionaryEnum.CityDeparture
Can you check their API documentation and check what parameters required to pass to GetFilter method.
as you made $client->GetCityDeparture(array('countryID'=>29));, did you try with $client->GetFilter(array('countryId'=>29,'departureCityId'=>array(1))); ?
otherwise, try a wsdl to php geneator that'll ease you the requests construction and handling the response

PHP - Reach a certain value in array

An API I use sent me back an object/array (not sure).
this is the info i get back using print_out($arr):
Array
(
[0] => Array
(
[callID] => 40
[PairCallLegId] =>
[CallsCount] => 4
[LocalName] => 151204
[RemoteName] => 15740
[type] => 1
[isOut] => 0
[FirstName] => Boris
[lastName] => Ostrovsky
[AvgMos] => 3.7432666239999963
[AvgQoe] =>
[AvgPL] =>
[AvgJitter] =>
[AvgVideoQP] =>
[AvgBDW] => 1200
[AvgFrameRate] =>
[AvgTotalPkt] => 102433.80945757998
[AvgTotalBytes] =>
)
)
Im trying to reach the value inside "CallsCount" (should be 4)
I tried to use
$arr[0]["CallsCount"]
and
$arr["0"]["CallsCount"]
and even
$arr[0]->CallsCount
None works. i get Internal Server Error (500) every time.
What should i do?

Categories