Jump to content

powerman

New Members
  • Posts

    1
  • Joined

  • Last visited

powerman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Have a problem with setting up a payment gateway for my shopping card. I have manage to get almost all right except where the sum is going to be calculated and sent to the payment processor. From the payment processor I got the following coding example: <?php $AgentID="???"; $Key="??????????"; $Description = "Description of item or service"; $SellerEmail = "seller@email.com"; $BuyerEmail = "buyer@email.com"; $Cost = "4"; //Cost of item or service $ExtraCost = "0"; //Shipping $OkUrl = "http://www.yoursite.com/verify.php"; $CancelUrl = "http://www.yoursite.com/error.php"; $RefNr = "123"; //Merchant reference number $GuaranteeOffered = "1"; $MD5string = $SellerEmail . ":" . $Cost . ":" . $ExtraCost . ":" . $OkUrl . ":" . $GuaranteeOffered . $Key; $MD5Hash = md5($MD5string); ?> <form action="https://www.payson.se/merchant/default.aspx" method="post"> <input type="hidden" name="BuyerEmail" value="<?php echo $BuyerEmail ?>"> <input type="hidden" name="AgentID" value="<?php echo $AgentID ?>"> <input type="hidden" name="Description" value="<?php echo $Description ?>"> <input type="hidden" name="SellerEmail" value="<?php echo $SellerEmail ?>"> <input type="hidden" name="Cost" value="<?php echo $Cost ?>"> <input type="hidden" name="ExtraCost" value="<?php echo $ExtraCost ?>"> <input type="hidden" name="OkUrl" value="<?php echo $OkUrl ?>"> <input type="hidden" name="CancelUrl" value="<?php echo $CancelUrl ?>"> <input type="hidden" name="RefNr" value="<?php echo $RefNr ?>"> <input type="hidden" name="MD5" value="<?php echo $MD5Hash ?>"> <input type="hidden" name="GuaranteeOffered" value="<?php echo $GuaranteeOffered ?>"> <input type="submit" value="Send request"> </form> Here is my code: <form method="post" action="https://www.payson.se/testagent/default.aspx" name="gateway_payson" id="gateway_payson"> <input type="hidden" name="SellerEmail" value="<?php echo get_option('gateway_payson_email'); ?>"/> <input type="hidden" name="AgentId" value="<?php echo get_option('gateway_payson_agentid'); ?>"/> <input type="hidden" name="GuaranteeOffered" value="<?php echo get_option('gateway_payson_guaranteeoffered'); ?>"/> <input type="hidden" name="OkUrl" value="<?php echo get_option('gateway_payson_callback'); ?>"/> <input type="hidden" name="RefNr" value="<?php echo $data['orderid']; ?>"/> <input type="hidden" name="Description" value="<?php echo strip_tags($data['description']); ?>"/> <input type="hidden" name="Cost" value="<?php echo $data['price']['total']; ?>"/> <input type="hidden" name="ExtraCost" value="0"> <input type="hidden" name="MD5" value="<?php echo get_option('gateway_payson_receiver');('SellerEmail'); ('OkUrl'); ('GuaranteeOffered'); ('ExtraCost'); ('Cost'); ?>"/> <input type="hidden" name="opt_name" value="<?php echo get_user_meta($userdata->ID, 'first_name', true).' '.get_user_meta($userdata->ID, 'last_name', true); ?>"/> <input type="hidden" name="BuyerEmail" value="<?php echo $userdata->user_email; ?>"/> <input type="hidden" name="opt_mobile" value="<?php echo $ADD[5]; ?>"/> <?php echo MakePayButton('javascript:document.gateway_payson.submit();'); ?> </form> <?php } function payson_new_gateway($gateways){ $nId = count($gateways)+1; $gateways[$nId]['name'] = "Payson Gateway"; // STRING - NAME OF YOUR GATEWAY $gateways[$nId]['logo'] = "https://www.payson.se/sites/all/files/images/external/payson72x29.png"; // STRING - http:// link to your logo file $gateways[$nId]['website'] = "http://www.payson.se"; // STRING - http:// link to the merchants website for more details $gateways[$nId]['function'] = "gateway_payson"; // STRING - name of your callback function $gateways[$nId]['callback'] = "no"; // YES/NO - FOR DISPLAY PURPOSES ONLY $gateways[$nId]['fields'] = array( '1' => array('name' => 'Enable Gateway', 'type' => 'listbox','fieldname' => 'gateway_payson','list' => array('yes'=>'Enable','no'=>'Disable') ), '2' => array('name' => 'MD5-nyckel', 'type' => 'text', 'fieldname' => 'gateway_payson_receiver', 'default' => 'Will be typed in a form') , '3' => array('name' => 'Display Name', 'type' => 'text', 'fieldname' => 'gateway_payson_name', 'default' => 'Betala med Payson') , '4' => array('name' => 'Display Icon', 'type' => 'text', 'fieldname' => 'gateway_payson_icon', 'default' =>'https://www.payson.se/sites/all/files/images/external/payson72x29.png' ), '5' => array('name' => 'Callback Url', 'type' => 'text', 'fieldname' => 'gateway_payson_callback', 'default' =>'http://www.xxx.com/shop/callback/' ), '6' => array('name' => 'Payson Email', 'type' => 'text', 'fieldname' => 'gateway_payson_email', 'default' =>'will be typed in a form' ), '7' => array('name' => 'Agent ID', 'type' => 'text', 'fieldname' => 'gateway_payson_agentid', 'default' =>'will be typed in a form' ), '8' => array('name' => 'Payson Garanti', 'type' => 'text','fieldname' => 'gateway_payson_guaranteeoffered','default' =>'1' ), ); return $gateways; } add_action('premiumpress_admin_payments_gateways','payson_new_gateway'); function gateway_payson_callback($orderID){ global $wpdb, $PPTPayment; //error_reporting(E_ALL ^ E_NOTICE); $email = get_option('gateway_payson_email'); // <------ change to your email address!!! $header = ""; $emailtext = "EMAIL"; // Read the post from OKPAY and add 'ok_verify' $req = 'paysbuy_verify=true'; foreach ($_POST as $key => $value){ $emailtext .= $key . " = " .$value ."\n\n"; } mail($email, "Paysbuy-VERIFIED ", $emailtext . "\n\n" . $req . "\n\n"); $result = $_POST["result"]; $result = substr($result, 0, 2); $apCode = $_POST["apCode"]; $amt = $_POST["amt"]; $fee = $_POST["fee"]; $method = $_POST["method"]; $confirm_cs = strtolower(trim($_POST["confirm_cs"])); /* status result 00=Success 99=Fail 02=Process */ if ($result == "00") { if ($method == "06") { if ($confirm_cs == "true") { $PPTPayment->UpdateOrderStatus(5, $orderID); echo "Success"; return "thankyou"; } else if ($confirm_cs == "false") { echo "Fail"; } else { echo "Process"; } } else { $PPTPayment->UpdateOrderStatus(5, $orderID); echo "Success"; return "thankyou"; } } else if ($result == "99") { echo "Fail"; } else if ($result == "02") { echo "Process"; } else { echo "Error"; } return ""; // RETURN FOR OTHER PAYMENT PROCESSING } add_action('premiumpress_callback_paymentstatus','gateway_payson_callback'); ?> So my problem is how to get this part to work $MD5string = $SellerEmail . ":" . $Cost . ":" . $ExtraCost . ":" . $OkUrl . ":" . $GuaranteeOffered . $Key; $MD5Hash = md5($MD5string); Any suggestions?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.