6.1.12

Moneybookers Payment Gateway integration php




  • We need to create two accounts on Moneybookers, one for the Merchant and other for the Buyer.
  • We need to send the request to Moneybookers to convert these accounts into test accounts (for testing purpose).
  • After getting the test account,we can start using it for mayking payments
  • There are mainly two ways to implement Moneybookers in our application

  1.    Implementing Moneybookers in our site.
  2.    Sending the user to Moneybookers website.

                 we here demonstrate  uses first method
  •  The Payment needs to Take place in two Pages in the First Page We need to get all the details of the user and enter it into the DB for our Validation Purposes
  •  After the successful Validation of the first Page We need to rediect to another Page contain an iframe loading the page and we need to fill the in that page and we need to auto submit that page and the balance details like adding card details etc will be done inside the iframe and will be redirected
  •  In that Page we Need to Populate a Form with the details and Make the Form Variables Hidden so that users may not see the feild details and in the Page Just Write "Rediecting to Payment Gateway"
          The details of second page looks like

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>name</title>
    </head>
    <body>
    <div id="wrap">
        <div id="contentwrap">
            <div id="header">
                <h2 align="center">Redirecting to payment Gateway </h2>
            </div>
            <div id="content">
                <div class="columns">
                    <div id="page" class="span12 spaceR">
    <form action="https://www.moneybookers.com/app/payment.pl" target="_self" name="Moneybookers">

     <input type="hidden" name="pay_to_email" value="merchant_email">
     <input type="hidden" name="pay_from_email" value="user_email">
     <input type="hidden" name="return_url" value="sucesspage URL">
     <!-- Redirect to success Page -->
     <input type="hidden" name="cancel_url" value="cancel url">
     <!-- Redirect To cancel Page-->
     <input type="hidden" name="status_url" value="callback URL">
     <!-- Callback purl (backend call) -->
     <input type="hidden" name="language" value="EN"> <!-- Language -->

     <input type="hidden" name="hide_login" value="1">
     <!-- show the login form -->

     <!-- target in which the return_url value will be called on successful payment -->
     <!-- 1 = '_top', 2 = '_parent', 3 = '_self', 4= '_blank' -->
     <input type="hidden" name="return_url_target" value="1">
     <input type="hidden" name="cancel_url_target" value="1">

     <!-- Custom fields for your own needs -->
     <input type="hidden" name="merchant_fields" value="name, username, order_amount, user_id">
     <!-- List all your custom fields here (comma separated, max 5)-->
     <input type="hidden" name="name" value="name of user">
     <input type="hidden" name="username" value="user name">
     <input type="hidden" name="order_amount" value="total Price">
     <input type="hidden" name="user_id" value="userid or unique id">

     <input type="hidden" name="amount_description" value="Testing Amount">
     <input type="hidden" name="amount" value="total price">
     <input type="hidden" name="currency" value="GBP">
     <input type="hidden" name="firstname" value="first name">
     <input type="hidden" name="lastname" value="lastname"> 
     <input type="hidden" name="email" value="email of user"> 
     <input type="hidden" name="address" value="address">
     <input type="hidden" name="city" value="city"> 
     <input type="hidden" name="state" value="state">
     <input type="hidden" name="postal_code" value="postal_code">
     <input type="hidden" name="country" value="country"> 
     <input type="hidden" name="detail1_description" value="Product desc">
     <input type="hidden" name="detail1_text" value="product desc">
     <input type="hidden" name="confirmation_note" value="Your payment is Success">
                        </form>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <script>
        document.Moneybookers.submit();
    </script>
    </body>
    </html>

   After the successfull payment the details will be posted to the url in the 'status_url' ,

    In the Post url the details that are send are
    $statusofPayment = $_POST['status'];
    $userName = $_POST['username'];/*Custom field*/
    $userId = $_POST['user_id'];/*Custom field*/
    $transactionAmount = $_POST['amount'];/*Amount that is taken from user after the transaction*/
    $paymentType = $_POST['payment_type'];
    $transaction_id = $_POST['mb_transaction_id'];/*Moneybookers transaction id*/

we need to check the stautus of Payment to verify that the payment was successfull or not
    if  $_POST['status'] == ‘2’ Processed  transaction is processed
    if  $_POST['status'] == ‘0’ Pending  customers pays via the pending bank transfer option
    if  $_POST['status'] == ‘-1’ Cancelled cancelled manually by the sender
    if  $_POST['status'] == ‘-3’ Chargeback receive chargebacks


  • Depending on the status redirect to success / failed Urls

1 comment:

  1. the codes of status.url are not working properly, it is still returning NULL values....please somebody help me out..

    ReplyDelete