Closed umutm closed 10 years ago
Just realized that lineItems has to be a multi-dimensional array and things worked that way :).
Can you supply the code you used I'm having the same problem.
Here it is:
$lineItemsArray = array("name" => $productName, "type" => 'product', "quantity" => $quantity, "price" => $productPrice);
try {
$charge = Twocheckout_Charge::auth(array(
"merchantOrderId" => $uniqueID,
"token" => $twoCheckoutToken,
"currency" => $paymentCurrency,
"lineItems" => array(
$lineItemsArray
),
"billingAddr" => array(
"name" => $userBillingName,
"addrLine1" => $userBillingAddress,
and so..
Hope it helps.
Hey thanks. That's what I've been doing, but I can't get it to send or the response just isn't reflecting it.
I can at least tell that 2CO's system (live system.. not sure about the dev. system) is working fine and there shall be something with the code.
I'll suggest sending very realistic data (in the address) with all the fields as I remember "bla bla data, addresses without zip" was causing issues.
You have to use lineItem under two arrays. Please find below example. You replace lineItem with this. It will work. "lineItems" => array( array( "type" => 'product', "price" => "5.00", "productId" => "123", "name" => "Test Product", "quantity" => "1", "tangible" => "N", "startupFee" => "1.00", "recurrence" => "1 Month", "description" => "This is a test" ) ),
Hi
Can i remove this is it mandatory or not.
"billingAddr" => array( "name" => 'Testing Tester', "addrLine1" => '123 Test St', "city" => 'Columbus', "state" => 'OH', "zipCode" => '43123', "country" => 'USA', "email" => 'testingtester@2co.com', "phoneNumber" => '555-555-5555' )
The billing address is mandatory. More information on the required data can be found in the payment API documentation.
It should be
"lineItems" => array( array( "type" => "product", "name" => "Tet", "price" => "10.00", "tangible" => "Y", "recurrence" => "1 Week", "duration" => "1 Week", "quantity" => 1, "startupFee" => "1.00", "productId" => "123", "description" => "This is a test" ) )
lineItems not lineItem ;)
We use the 2CO PHP library and can not pass the orders successfully (in the sandbox) using the lineItems object. Without lineItems, things work ok but we need lineItems for using the recurring payments feature.
But get a "Unable to process the request" request with HTTP 400 status. It seems like we send the request as expected but it fails. Are we missing anything?
The complete code is as:
Once we remove this part:
it works (but we need that part).