Linkpoint API Payment Module

Contrib type: 
Module
Status: 
Complete and working
Compatibility: 
Ubercart Alpha 7e

This is a current working version of the Linkpoint API module that was posted on the forums awhile back.

To install this module, extract the uc_linkpoint_api.zip file to your modules/ubercart/payment folder. After, go to the modules section in drupal admin (http://www.yoursite.com/admin/build/modules) and scroll down to the "Ubercart - Payment" modules section. Enable "Linkpoint API".

In order to communicate with your linkpoint account, you will need to get a file called a PEM file from linkpoint. To get it, go to Linkpoint Central -> Support -> Download Center. Save that file to your modules/ubercart/payment/uc_linkpoint_api folder.

Once you've done that, navigate over to the Payment settings in ubercart (http://www.yoursite.com/admin/store/settings/payment/edit/gateways). Click on "Linkpoint API settings" and where it says PEM file, fill in the absolute path to your PEM file (example: /home/domain/public_html/modules/ubercart/payment/uc_linkpoint_api/123456.pem).

The Linkpoint API module submits the following information to Linkpoint Central:

    Billing Address:

    • Name
    • Company
    • Address 1
    • Address 2
    • City
    • State/Province
    • Zip/Postal Code
    • Country

    Shipping Address:

    • Name
    • Address 1
    • Address 2
    • City
    • State/Province
    • Zip/Postal Code
    • Country

    Contact Information:

    • Phone
    • E-Mail
    • IP Address

    Credit Card Information:

    • Card Number
    • Card Expiration Month
    • Card Expiration Year in 2 digits (00, 01, 02, etc)
    • CVM Value

    Payment Information

    • Total Amount

It will also pass all of the item descriptions and attributes to the Linkpoint Central comments section. To disable this, scroll down to line 191 and comment it out so it looks like this:

  //$xml .="<comments>" . $description . "</comments>";

All issues addressed in my old post and the post by guest have been addressed and corrected.

AttachmentSize
uc_linkpoint_api.zip3.81 KB

Re: Linkpoint API Payment Module

I was getting an error telling me the Credit Card Expiration Year was incorrect when I tried to process credit cards. I did a little more research and found linkpoint needs the years to be in 2 digits instead of 4 digits.

In the linkpoint module there is a line that is supposed to truncate the year down to 2 digits:

$xml .="<cardexpyear>" . date('y', $order->payment_details['cc_exp_year']) . "</cardexpyear> ";

This wasn't working for me so I removed that line and replaced it with:

$cardexpyr = substr($order->payment_details['cc_exp_year'], 2, 2);
$xml .="<cardexpyear>" . $cardexpyr . "</cardexpyear> ";

As of 10/8/2007 this module appears to be fully functioning for me.

Country problem

Another issue with Linkpoint is the country code is supposed to be 2 letters. For example:

US for USA
CA for Canada.

The problem is Ubercart stores the countries as numbers. For example:

USA is 840
CA is 124

For the time being, I devised a ghetto little rig to convert these numbers to the 2 letters needed by Linkpoint.

Add the lines to the uc_linkpoint_api.module file:

Original file:

$description = substr($description, 0, 255);
*/

  $xml ="<order>";

Modified file:

$description = substr($description, 0, 255);
*/

$countrybill = $order->billing_country;
  if ($countrybill == 840) {
    $countrybill = "US";
  } else if ($countrybill == 124) {
    $countrybill = "CA";
  }

  $xml ="<order>";

After you do that, find the line that says:

$xml .="<country>" . $order->billing_country . "</country>";

and replace it with:

  $xml .="<country>" . $countrybill . "</country>";

Copyright issue

This module contains some code from the linkpoint lphp.php file decodeXML function. This file has a copyright notice on it.

I have a rewritten module without copyright code I will post soon.

Godaddy and others

Some non-dedicated hosting companies do not give cURL access to certain ports.

This means that GoDaddy will NOT work with this module if you have a shared hosting server.

help needed

I posted this in the general forum in error as I thought I was adding it to this thread of nick's.
http://www.ubercart.org/forum/general_discussion/3064/linkpoint_yourpay_...

Question as posted:

Ubercart tells me "Your order is complete!" I get no other feedback. And there is nothing in watchdog indicating any errors. This is LIVE Production mode.
When I check for the transaction on the linkpoint/yourpay site there is none.

Linkpoint_api_module here:
/home/xxx/www/mydomain.com/sites/all/modules/ubercart/payment/uc_linkpoint_api/uc_linkpoint_api.module

pem file here:
/home/xxx/www/mydomain.com/sites/all/modules/ubercart/payment/uc_linkpoint_api/1234567890.pem

What is the best way to debug this? How to see what is being passed to linkpoint?

apologies for the "double" post

Re: help needed

What I did to see more debug info was edit the following lines:

'message' => t('Credit card payment declined: !text', array('!text' => $x_response_text)),

'message' => t('Credit card payment processed successfully. Approval code: !code', array('!code' => $approved_text)),

to

'message' => t('x_response_code:'. $x_response_code .'<br />x_approval_code:'.$x_approval_code.'<br />xml: '.$xml.'<br />Credit card payment declined: !text', array('!text' => $x_response_text)),

'message' => t('x_response_code:'. $x_response_code .'<br />x_approval_code:'.$x_approval_code.'<br />xml: '.$xml.'<br />Credit card payment processed successfully. Approval code: !code', array('!code' => $approved_text)),

thanks for the code

Thanks for the code, Nick. Assuming I installed it correctly I still get no feed back except the standard "Order complete."
So I don't know if linkpoint is receiving anything or not.
I am using the standard test number 4111111111111111. (Linkpoint tech told me it is not a problem using that number)
Any ideas on how I can tell if my server is shaking hands with theirs?

Another issue in looking at the order report under the admin/store/orders/69/payments there is no info recorded regarding the payment. It's all blank. This indicates to me something is not being completed even though the cart says it is.

screen goes blank

Hi,

I keep trying to process a card (i'm going through ubercarts backend) and it keeps going blank after i go to charge card.

Does nayone know why this is?

I cant seem to get this to work =/

FIXED

I transfered servers and now the module works...SO it mustve been something with my server configuration.

Thanks nick for the great module

Issues with linkpoint (invalid XML)

Just wanted to toss this out to whomever is using this API. I'm using linkpnt via YourPay and found an issue with this where I'd get errors: SGS-020003.
This is an invalid XML error. After much lack of help from their support,
I found this in their manual:

SGS-020003: Invalid XML

There are a couple different things that will cause this error.

1. Make sure the amount for chargetotal is not blank.
2. Make sure expiration year is only 2 digits
3. Make sure there is no dollar sign for the amount.
4. Make sure there are no symbols like an ampersand,
apostrophe, or letters with accents
5. If there is no shipping make sure you pass zero for the amount
6. Make sure there are no commas in the amount for chargetotal

The issue I have is a LOT of my commercial customers have an & or an
apostrophe in their company names.

I had to add the following to the module:

/* remove ampersand and appostrophes from text */
$xml = str_replace("&", "and", $xml);
$xml = str_replace("'", " ", $xml);
/* end scrub */

Now things are happier.

R. Marc