1. Home
  2. Setup
  3. Integrations
  4. Payment Providers
  5. Generic Integration – Payment Providers

Generic Integration – Payment Providers

Integrating a 3rd party payment system or shopping cart with WishList member is now possible with WishList Member v2.18 and higher. The integration process can be accomplished in four (4) steps, namely:

POST Values

WishList Member expects a certain set of variables and a hash key to be sent to it via HTTP POST. These variables are:

VariableValue
cmd
CREATE – creates a new account
DEACTIVATE – deactivates the membership levels of the specified transaction ID
ACTIVATE – reactivates the membership levels fo the specified transaction ID
lastnameMember’s lastname
firstnameMember’s firstname
emailMember’s email address
levelMembership Level SKU
transaction_idTransaction ID. When deactivating or reactivating membership levels, this variable
has to contain the value that was used when the membership level was created
hashHash key. View instructions below on how to create the hash key.

Generating the Hash Key

The hash key is just an MD5 hash of the following string:

cmd__secretkey__UppercasePipeDelimitedPostdata

Example:

 secretkey : MysecretKEY
cmd : CREATE
lastname : Baggins
firstname : Frodo
email : frodo@shire.com
level : 1234567890
transaction_id : XYZ123456

The string to hash would be:

CREATE__MYsecretKEY__BAGGINS|FRODO|FRODO@SHIRE.COM|1234567890|XYZ123456

The MD5 hash of the above string is:

63b8040b5407eac097b86b73e2fe4523

Return Value

Upon a succesful transaction, WishList member will return a plain text message that will have the same value as the cmd variable that was passed. If the cmd variable’s value is CREATE then the return value will have a second line containing the URL to which your script must send your customer to.

If the first line of the return value is not the same as the cmd variable that was passed, then the either the hash was incorrect or cmd contains an invalid value.

Sample PHP Code

Below is a set of sample PHP code that shows how easy it is to integrate with WishList Member:

Creating an Account

// the post URL
$postURL = 'http://www.domain.com/index.php/register/GJMYz7';

// the Secret Key
$secretKey = 'MYsecretKEY';

// prepare the data
$data = array ();
$data['cmd'] = 'CREATE';
$data['transaction_id'] = 'XYZ123456';
$data['lastname'] = 'Baggins';
$data['firstname'] = 'Frodo';
$data['email'] = 'frodo@shire.com';
$data['level'] = '1234567890';

// generate the hash
$delimiteddata = strtoupper (implode ('|', $data));
$hash = md5 ($data['cmd'] . '' . $secretKey . '' . $delimiteddata);

// include the hash to the data to be sent
$data['hash'] = $hash;

// send data to post URL
$ch = curl_init ($postURL);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returnValue = curl_exec ($ch);

// process return value
list ($cmd, $url) = explode ("\n", $returnValue);

// check if the returned command is the same as what we passed
if ($cmd == 'CREATE') {
header ('Location:' . $url);
exit;
} else {
die ('Error');
}

Deactivating an Account

// the post URL
$postURL = 'http://www.domain.com/index.php/register/GJMYz7';

// the Secret Key
$secretKey = 'MYsecretKEY';

// prepare the data
$data = array ();
$data['cmd'] = 'DEACTIVATE';
$data['transaction_id'] = 'XYZ123456';

// generate the hash
$delimiteddata = strtoupper (implode ('|', $data));
$hash = md5 ($data['cmd'] . '' . $secretKey . '' . $delimiteddata);

// include the hash to the data to be sent
$data['hash'] = $hash;

// send data to post URL
$ch = curl_init ($postURL);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returnValue = curl_exec ($ch);

// process return value
list ($cmd, $url) = explode ("\n", $returnValue);

// check if the returned command is the same as what we passed
if ($cmd == 'DEACTIVATE') {
die ('Success');
} else {
die ('Error');
}

Activating an Account

// the post URL
$postURL = 'http://www.domain.com/index.php/register/GJMYz7';

// the Secret Key
$secretKey = 'MYsecretKEY';

// prepare the data
$data = array ();
$data['cmd'] = 'ACTIVATE';
$data['transaction_id'] = 'XYZ123456';

// generate the hash
$delimiteddata = strtoupper (implode ('|', $data));
$hash = md5 ($data['cmd'] . '' . $secretKey . '' . $delimiteddata);

// include the hash to the data to be sent
$data['hash'] = $hash;

// send data to post URL
$ch = curl_init ($postURL);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returnValue = curl_exec ($ch);

// process return value
list ($cmd, $url) = explode ("\n", $returnValue);

// check if the returned command is the same as what we passed
if ($cmd == 'ACTIVATE') {
die ('Success');
} else {
die ('Error');
}
Updated on April 17, 2019

Was this article helpful?

Related Articles

Not the solution you were looking for?
Click the link below to submit a support ticket
Submit Ticket