A client of mine wanted to use OpenCart for a shopping cart website and was using PayPal pro to handle the e-commerce. The problem was that the only information OpenCart passed to PayPal was the information needed to process the credit card. This makes sense if you are handling all your shipping things in OpenCart, however in my clients situation, they needed someone else on PayPal to be able to see the shipping information for fulfilling the orders.
Solution:
The PHP file handling the connection to PalPay was only passing some of the data, not all of it. If you look at the file: root/catalog/controller/payment/pp_pro.php, you will see a PHP associative array handling all the data that will be passed to PayPal. (Note: an associative array is where you can hold a lot of data in one container and by using what are called key/value pairs. For instance a key might be something like shoe_size and the value may be something like 12 written in PHP with key => value). I looked into the object holding on the user data and found that just like payment_*** you can use shipping_***. So my setup ended up looking similar to this:
$payment_data = array(
'METHOD' => 'DoDirectPayment',
'VERSION' => '51.0',
'USER' => html_entity_decode($this->config->get('pp_pro_username'), ENT_QUOTES, 'UTF-8'),
'PWD' => html_entity_decode($this->config->get('pp_pro_password'), ENT_QUOTES, 'UTF-8'),
'SIGNATURE' => html_entity_decode($this->config->get('pp_pro_signature'), ENT_QUOTES, 'UTF-8'),
'CUSTREF' => $order_info['order_id'],
'PAYMENTACTION' => $payment_type,
'AMT' => $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE),
'CREDITCARDTYPE' => $this->request->post['cc_type'],
'ACCT' => str_replace(' ', '', $this->request->post['cc_number']),
'CARDSTART' => $this->request->post['cc_start_date_month'] . $this->request->post['cc_start_date_year'],
'EXPDATE' => $this->request->post['cc_expire_date_month'] . $this->request->post['cc_expire_date_year'],
'CVV2' => $this->request->post['cc_cvv2'],
'CARDISSUE' => $this->request->post['cc_issue'],
'FIRSTNAME' => $order_info['payment_firstname'],
'LASTNAME' => $order_info['payment_lastname'],
'EMAIL' => $order_info['email'],
'PHONENUM' => $order_info['telephone'],
'IPADDRESS' => $this->request->server['REMOTE_ADDR'],
'STREET' => $order_info['payment_address_1'],
'CITY' => $order_info['payment_city'],
'STATE' => ($order_info['payment_iso_code_2'] != 'US') ? $order_info['payment_zone'] : $order_info['payment_zone_code'],
'ZIP' => $order_info['payment_postcode'],
'COUNTRYCODE' => $order_info['payment_iso_code_2'],
'CURRENCYCODE' => $order_info['currency'],
'DESC' => 'items being ordered - 127 char limit',
'SHIPTONAME' => $order_info['shipping_firstname'] . $order_info['shipping_lastname'],
'SHIPTOSTREET' => $order_info['shipping_address_1'],
'SHIPTOCITY' => $order_info['shipping_city'],
'SHIPTOSTATE' => ($order_info['shipping_iso_code_2'] != 'US') ? $order_info['shipping_zone'] : $order_info['shipping_zone_code'],
'SHIPTOZIP' => $order_info['shipping_postcode'],
'SHIPTOCOUNTRY' => $order_info['shipping_iso_code_2'],
'SHIPTOPHONENUM' => $order_info['telephone']
);Hopefully this will help out some who have had issues with this.
No comments:
Post a Comment