2Checkout / 2checkout-php

2Checkout PHP Library
MIT License
83 stars 66 forks source link

Unable to process the request #32

Open wiloke opened 7 years ago

wiloke commented 7 years ago

Hi, I always get this message if lineItems is enabled Unable to process the request Here is my code

`
$charge = Twocheckout_Charge::auth(array(

    "merchantOrderId" => "123",
    "token"      => $_POST['token'],
    "currency"   => 'USD',
    // "total"      => '10.00',
    "billingAddr" => array(
        "name" => 'Testing Tester 1',
        "addrLine1" => '123 Test St',
        "city" => 'Columbus',
        "state" => 'OH',
        "zipCode" => '43123',
        "country" => 'USA',
        "email" => 'example@2co.com',
        "phoneNumber" => '555-555-5555'
    ),
    "lineItems" => array(
        "type" => "product",
        "name" => "Tet",
        "price" => "10.00",
        // "tangible" => "Y",
        "recurrence" => "1 Month",
        "duration" => "1 Week",
        // "quantity" => 1,
        "startupFee" => "1.00",
        // "productId" => "123",
        "description" => "This is a test"
    )
));`

Could you please light me what's wrong with my code?

arvindkalbhor commented 7 years ago

if you are using lineitems please use this code

$charge = Twocheckout_Charge::auth(array(

    "merchantOrderId" => "123",
    "token"      => $_POST['token'],
    "currency"   => 'USD',
    // "total"      => '10.00',
    "billingAddr" => array(
        "name" => 'Testing Tester 1',
        "addrLine1" => '123 Test St',
        "city" => 'Columbus',
        "state" => 'OH',
        "zipCode" => '43123',
        "country" => 'USA',
        "email" => 'example@2co.com',
        "phoneNumber" => '555-555-5555'
    ),
    "lineItems" => array(
                    array(
                "type" => "product",
                "name" => "Tet",
               "price" => "10.00",
              // "tangible" => "Y",
              "recurrence" => "1 Month",
             "duration" => "1 Week",
             // "quantity" => 1,
            "startupFee" => "1.00",
            // "productId" => "123",
            "description" => "This is a test"
    )
)
));`

use array inside array for lineitems