I am using a paypal plugin, and and for some reason I can't get paypal to go to my callback url when payment is complete. I have used the same plugin before which worked so it must be something stupid I am doing.
Here's a sample array of the data I am passing into the plugin
Array
(
[sandboxMode] => 1
[successUrl] => http://x.x.x.x/safespacesforkids/rebuild/public/payment/success
[cancelUrl] => http://x.x.x.x/safespacesforkids/rebuild/public/assessment/checkout
[backendUrl] => http://x.x.x.x/safespacesforkids/rebuild/public/payment/pp/316e7c50a117c91b392a013a6e1a22e9a4f97b1e
[merchantAccount] => myemail#domain.com
[language] => EN
[currency] => AUD
[invoice] => 55ca0738e638d
[purpose] => Company Name
[amount] => 180.68
[remark] =>
)
When I copy backendUrl in to my browser and go there myself it processes the order just fine. but paypal won't
My code
public function redirect()
{
//My Basket - Info
$basket = Cart::getBasket();
//Make payment hash
$user = User::find(Auth::id());
$user->hash = sha1(rand().time());
$user->save();
$paypalInfo = array(
'sandboxMode' => true,
'successUrl' => URL::route('payment.success'),
'cancelUrl' => URL::route('assessment.checkout'),
'backendUrl' => URL::route('payment.paypal', $user->hash),
'merchantAccount' => System::first()->paypal_email,
'language' => 'EN',
'currency' => 'AUD',
'invoice' => uniqid(),
'purpose' => 'Safe Spaces for Kids',
'amount' => Helper::price($basket['total']),
'remark' => ''
);
Helper::pr($paypalInfo,1);
$adapter = Gateway::driver('Paypal')->initialize($paypalInfo);
$generated = $adapter->render();
return View::make('payment/redirect', ['form' => $generated]);
}
Related
I'm using php and Soapclient. I need send next parameters:
<sch:CodConsulta v="5473"/>
<sch:Parametros>
<sch:Txt n="Agente" v="aaa"/>
<sch:Fec n="Fecha" v="2018-01-24"/>
<sch:Txt n="Sesion" v="0"/>
</sch:Parametros>
I've tried send params like this:
$parametros = array(
"CodConsulta" => array('_' => '',"v" => "5473"),
"Parametros" => array(
"Txt" => array('_' => '',"n" => "Agente","v" => "aaa"),
"Fec" => array('_' => '',"n" => "Fecha","v" => "2018-01-24"),
"Txt" => array('_' => '',"n" => "Sesion","v" => "0")
)
);
Webservice return error, only receive 1 param...
Any help would be much appreciated. Thanks in advance.
Here is my code which is the example I used from here
$createcustomer_api = new \SquareConnect\Api\CustomersApi();
$createcustomer_result = $createcustomer_api->createCustomer(array(
'given_name' => 'Amelia',
'family_name' => 'Earhart',
'email_address' => 'Amelia.Earhart#example.com',
'address' => array(
'address_line_1' => '500 Electric Ave',
'address_line_2' => 'Suite 600',
'locality' => 'New York',
'administrative_district_level_1' => 'NY',
'postal_code' => '10003',
'country' => 'US'
),
'phone_number' => '1-555-555-0122',
'reference_id' => 'YOUR_REFERENCE_ID',
'note' => 'a customer'
));
If I print out the results I get
SquareConnect\Model\CreateCustomerResponse Object
(
[errors:protected] =>
[customer:protected] => SquareConnect\Model\Customer Object
(
[id:protected] => CBASEHtp6YVU8AirkMv1lrVMyoIgAQ
[created_at:protected] => 2017-09-27T23:19:44.62Z
[updated_at:protected] => 2017-09-27T23:19:44.62Z
[cards:protected] =>
[given_name:protected] => Amelia
[family_name:protected] => Earhart
[nickname:protected] =>
[company_name:protected] =>
[email_address:protected] => Amelia.Earhart#example.com
[address:protected] => SquareConnect\Model\Address Object
(
[address_line_1:protected] => 500 Electric Ave
[address_line_2:protected] => Suite 600
[address_line_3:protected] =>
[locality:protected] => New York
[sublocality:protected] =>
[sublocality_2:protected] =>
[sublocality_3:protected] =>
[administrative_district_level_1:protected] => NY
[administrative_district_level_2:protected] =>
[administrative_district_level_3:protected] =>
[postal_code:protected] => 10003
[country:protected] => US
[first_name:protected] =>
[last_name:protected] =>
[organization:protected] =>
)
[phone_number:protected] => 1-555-555-0122
[reference_id:protected] => YOUR_REFERENCE_ID
[note:protected] => a customer
[preferences:protected] => SquareConnect\Model\CustomerPreferences Object
(
[email_unsubscribed:protected] =>
)
[groups:protected] =>
)
)
Now I need to create the customer card to associate with the customer for future recurring payments.
$createcard_api = new \SquareConnect\Api\CustomersApi();
$createcard_result = $createcard_api->createCustomerCard($createcustomer_result->getId(), array(
'card_nonce' => $nonce,
'billing_address' => array(
'address_line_1' => '1455 Market St',
'address_line_2' => 'Suite 600',
'locality' => 'San Francisco',
'administrative_district_level_1' => 'CA',
'postal_code' => '94103',
'country' => 'US'
),
'cardholder_name' => 'Amelia Earhart'
));
From what I understand there is a built-in function with the square SDK that is getId() which according to this is called like $customer->getId(), but according to this I need to just add ->getId() to my createCustomer object.
So I am trying to call the getId() function as
$createcustomer_result->getId()
but in my code I am getting the error
Fatal error: Call to undefined method SquareConnect\Model\CreateCustomerResponse::getId()
How do I properly get the customer id from the createCustomer?
You've only got the response object from the API, a communication device. You need to first extract the created object from the response, then you can query it for the ID.
$customer = $createcustomer_result->getCustomer();
That should get you the actual customer object, then you can:
$customer_id = $customer->getId();
This is pretty common for API libraries. You can also query the response object for errors if they occur. When using these kinds of libraries, have a look inside the various classes and read through the functions, you can get a better idea of how you use them that way.
I'm adding a new order using WHMCS local API. Everything works fine except custom fields.
$command = 'AddOrder';
$postData = array(
'clientid' => $client_id,
'pid' => array($product_id),
'billingcycle' => array('monthly'),
'customfields' => array(base64_encode(serialize(array(1 => $site_id)))),
'paymentmethod' => 'stripe',
);
return localAPI($command, $postData);
My custom field ID is 53 but I set the key to 1 because of tutorials. Also I tried 53 as key array(base64_encode(serialize(array(53 => $site_id)))) but nothing changed.
Do you have any suggestion?
Try this:
$command = 'AddOrder';
$postData = array(
'clientid' => $client_id,
'pid' => array($product_id),
'billingcycle' => array('monthly'),
'customfields[0]' => array(base64_encode(serialize(array(1 => $site_id)))),//changes here
'paymentmethod' => 'stripe',
);
return localAPI($command, $postData);ode here
I'm using a hipay wallet test account and used there webservices to integrate. Transaction is working fine but problem is that i'm not getting the response in the page, it is suppossed to get in $_POST['xml'] on the response page
$setUrlAck =show_page_link("payment/hipay_new/response.php",true);
Below is my code
if ($PaymentDetails['sel_payment_env'] == 1) {
$wsdl = 'https://ws.hipay.com/soap/subscription?wsdl'; //for live
} else {
$wsdl = 'https://test-ws.hipay.com/soap/subscription?wsdl';//for testing
}
// If the payment is accepted, the user will be redirected to this page
$setURLOk= show_page_link(FILE_THANKS."?add=success&OrderNo=".$orderid,true);
// If the payment is refused, the user will be redirected to this page
$setUrlNok=show_page_link(FILE_THANKS."?cancleMsg=true",true);
// If the user cancels the payment, he will be redirected to this page
$setUrlCancel=show_page_link(FILE_THANKS."?cancleMsg=true",true);
// The merchant?s site will be notified of the result of the payment by a call to the script
$setUrlAck =show_page_link("payment/hipay_new/response.php",true);
$initArray = array(
'wsLogin' => $wsLogin, // Your wsLogin
'wsPassword' => $wspassword, // Your wsPassword
'websiteId' => $txt_Merchant, // Your webSiteId
'categoryId' => $PaymentDetails['txt_category_id'], // Your website category ID (https://test-payment.hipay.com/order/list-categories/id/(websiteId))
'customerEmail' => $customer_email, // Your customers' email
);
$options = array(
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
'cache_wsdl' => WSDL_CACHE_NONE,
);
$client = new SoapClient($wsdl, $options);
$data = array(
'currency' => $currency_code,
'rating' => 'ALL',
'locale' => 'fr_FR',
'manualCapture' =>1,
'label' => 'My label is a Manged Subscrption Test Service ',
'customerIpAddress' => $_SERVER["REMOTE_ADDR"],
'merchantReference' => 'AZERTY',
'urlCallback' => $setUrlAck, // Here in this page i'm suppossed to get the response in $_POST
'urlAccept' => $setURLOk,
'urlCancel' =>$setUrlCancel,
'payments' => array(
'initial' => array(
'name' => 'Payment',
'description' => 'Payment for printing products',
'amount' => $price,
'subscriptionId' => 'QWERTY',
'periodType' => 'normal',
'recurrence' => array(
'frequency' => 0,
'duration' => 'managed'
),
),
),
);
Kindly guide me if anyone got through the same issues
The issue is solved, problem was that my firewall setting was blocking the response
I Am trying to update tenders table in my db but for some reasons its updating the table with zeros.
After getting the last_query() string and running it from phpmyadmin window it updates successfully but using active records it does not.
Other queries are working properly apart from this.
What might be the problem with my code?
Here is my code
$data=array(
'tender_type_type_id' => $this->input->post('tender_type_id'),
'Description' => $this->input->post('tdescription'),
'obtaining_documents' => $this->input->post('obtaining_docs'),
'submission_process' => $this->input->post('submission_proc'),
'obtaining_documents' => $this->input->post('obtaining_docs'),
'applicationfee' => $this->input->post('applicationfee'),
'Location' => $this->input->post('location'),
'WebLink' => $this->input->post('url'),
'clossing_date' => $this->input->post('endson'),
'opening_date' => $this->input->post('openedon'),
'title' => $this->input->post('title'),
'publication_date' => date('Y-m-d H:i:s', time()),
'attachments' => $this->input->post('upload'),
'Organization_OrganizationID' => $this->input->post('organizationid'),
'tender_category_category_id' => $this->input->post('categoryid'),
'Towns_TownID' => $this->input->post('townid'),
'Accounts_AccountID' =>$this->input->post('accountid'),
'tender_status_status_id' => $this->input->post('tender_status_id'),
'Location' => $this->input->post('location'),
'clossing_date' => $this->input->post('endson'),
'opening_date' => $this->input->post('openedon'));
$id=$this->uri->segment(3);
$this->db->where('TenderID',$id);
$this->db->update('tenders',$data);
return print_r($this->db->last_query());