php - Laravel Omnipay 2checkout "Bad request - parameter error" -
i'm using laravel, omnipay integrate 2checkout , checkout controller code.
<?php namespace app\http\controllers; use illuminate\http\request; use omnipay\omnipay; class checkoutcontroller extends controller { public function order(request $request) { $gateway = omnipay::create('twocheckoutplus_token'); $gateway->setaccountnumber('xxxxxx'); $gateway->settestmode(true); $gateway->setprivatekey('xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); $gateway->setcart( [ [ "name" => "demo item", "price" => "4.99", "type" => "product", "quantity" => "1", "recurrence" => "4 year", "startupfee" => "9.99" ] ] ); $formdata = [ 'firstname' => 'test', 'lastname' => 'test', 'email' => 'test@example.com', 'billingaddress1' => 'test', 'billingaddress2' => 'test', 'billingcity' => 'test', 'billingpostcode' => '77500', 'billingstate' => 'test', 'billingcountry' => 'usa', ]; $purchase_request_data = [ 'card' => $formdata, 'token' => $request->token, 'transactionid' => '18617', 'currency' => 'usd', 'amount' => '200.00', ]; $response = $gateway->purchase($purchase_request_data)->send(); //dd($response); if ($response->issuccessful()) { $transaction_ref = $response->gettransactionreference(); } else { $error = $response->getmessage(); dd($error); } } }
i keep getting error "bad request - parameter error" , have passed parameters
this package i'm using https://github.com/collizo4sky/omnipay-2checkout
note: account sandbox
Comments
Post a Comment