MERCHANT INTEGRATION GUIDE Version 2.8
CHANGE LOG 1. Added validation on allowed currencies on each payment method. 2. Added payment_method parameter that will allow merchants to dynamically select payment options per MTG setup. 3. Added success_url that will allow merchants to dynamically designate a Success URL per MTG setup. 4. Added fail_url that will allow merchants to dynamically designate a Fail URL per MTG setup. 5. Added callback_url that will allow merchants to dynamically designate a Callback URL per MTG setup. 6. Allowed merchant to receive status of payment. Successful or Failed on credit card, wallet to wallet, and CUP. Pending or Failed on wire transfer. 7. Allowed merchant to receive the type of payment used by the client to pay for the items. 8. Allowed merchant to receive the amount to be credited on his MegaTransfer wallet. 9. Removed Wire Transfer Message URL. For wire transfer gateway, MegaTransfer hardly suggest that merchant must put it on a separate MTG setup using WT as payment_method and having its own success_url. 10. Added version parameter that will help MegaTransfer detect the gateway version installed by merchant.
INTRODUCTION MegaTransfer provides a wide range of financial services available worldwide: from transferring money and exchanging currencies, to financial institutions and banking alternatives. But one of the most common use of payment system like MegaTransfer, is to accept payments from clients via merchant perspective. Once registered and successfully verified by MegaTransfer, merchants can integrate the payment gateway (or we can call it here as MTG stands for MegaTransfer Gateway) instantly. One great attribute of MTG is that it allows merchants to accept four (4) different types of payment methods by just installing a single block of code. The following payment types are accepted by MTG: 1. VISA and MasterCard 2. MegaTransfer Wallet 3. China UnionPay 4. Wire Transfer This manual should help merchants to implement and integrate MTG to their respective online shops. We ensure each and every merchants a safe and secure payment environment between their website and to MTG server.
PARAMETERS The following parameters are needed in order for us to integrate properly the MTG. All API requests must be sent to https://www.megatransfer.co.uk/payments by POST method. items quantity amount currency total_amount merchant_id order_id client_name client_country client_city client_email client_regdate url payment_method selected product to be bought by client (alphanumeric, required) number of items (numeric, required) price of the item (float, required) Credit Cards (EUR, GBP, USD, RUB) MegaTransfer Wallet (EUR, USD, GBP, AED, AUD, BTC, CAD, CHF, CNY, CZK, DKK, HKD, HUF,ILS, INR, JPY, KWD, LTC, LTL, NOK, NZD, PHP, PLN, RON, RUB, SAR, SEK, SGD) China UnionPay (EUR, USD, GBP, AED, AUD, CAD, CHF, CNY, CZK, DKK, HKD, HUF,ILS, INR, JPY, KWD, LTL, NOK, NZD, PHP, PLN, RON, RUB, SAR, SEK, SGD) Wire Transfer (EUR, USD, GBP, CZK, NOK, SEK, CHF, CAD, AUD, DKK, HKD, JPY, NZD, PLN, RUB, SGD) quantity * amount (float, required) your merchant ID; please check https://www.megatransfer.co.uk/my/merchant setup (required) order ID from merchant s system (required) Name of end user inside Merchant's system. (required) Country name or country code of end user inside Merchant's system. (required) City of end user inside Merchant's system. (required) Email address of end user inside Merchant's system. (required) Registration date of end user inside Merchant's system. (required) URL on merchant's system triggered by end users before entering MegaTransfer process (required) Method/s to be used on processing the payment of client. (required) MT to accept payments via wallet to wallet transfer. CC to accept credit or debit card payments. CH to accept China UnionPay payments. WT to accept wire transfer payments. ALL to accept all payment methods. (vertical bar) delimiter to be used between two or more Sample strings: payment methods. MT CC to show a gateway with Megatransfer and Credit Card as options. CH CC WT to show a gateway with China UnionPay, Credit Card, and Wire Transfer as options. CC to remove option lightbox and gateway will proceed to credit card platform.
success_url default address of page where client will be redirected after successful payment. (required) fail_url default address of page where client will be redirected when an error occurred during payment. (required) callback_url default address of page for performing and receiving POST variables in JSON format through curl method. (required) version version number of implemented gateway. You can see it on the first page of PDF guide or integration pages of MegaTransfer. (optional) gateway_id 0 for test gateway, 1 for live gateway (required) Use this test account username for test gateway: Username: testmegatransfer@gmail.com Password: testmt@1234 signature composed of hash ("sha256",(secret code + separator + merchant_id + separator + items + separator + quantity + separator + amount + separator + total_amount + separator + currency + separator + secret code)) where : secret code indicated in your merchant setup separator indicated in your merchant setup (required) RETURN PARAMETERS items quantity amount currency total_amount merchant_id order_id transaction_id status payment_method amount_credited message token selected product to be bought by client (alphanumeric, required) number of items (numeric, required) price of the item (float, required) EUR, USD, GBP, AED, AUD, BTC, CAD, CHF, CNY, CZK, DKK, HKD, HUF, ILS, JPY, KWD, LTC, LTL, NOK, NZD, PHP, PLN, RON, RUB, SAR, SEK, or SGD.(required) quantity * amount (float, required) your merchant ID; please check https://www.megatransfer.co.uk/my/merchant setup (required) order ID from merchant s system (required) reference number from Megatransfer system successful or failed on MT,CC,CH; pending or failed on WT MT (payments via wallet to wallet transfer); CC (credit or debit card payments); CH (China UnionPay payments); WT (wire transfer payments). Amount credited to your MegaTransfer wallet. error messages (for failed transactions only) composed of hash ("md5",(secret code + order_id + transaction_id + secret code)) where : secret code indicated in your merchant setup (for success transactions only)
IMPLEMENTATION When clients of the merchant selects Megatransfer as their payment method, clients are actually sending data to MegaTransfer s web servers through safe and secure connection. Data sent by clients contains the payment information that makes up the behavior of MTG. Shopping Cart Process Page contains items, quantity, amount, currency and total_amount to be posted on Process Page. contains items, quantity, amount, currency total_amount, order_id and signature to be posted in MTG. Initially, when MTG is successfully implemented, merchants are only allowed to use two (2) payment methods the MegaTransfer Wallet and Wire Transfer. In order to start accepting VISA, MasterCard, and CUP (China UnionPay), merchants need to submit verification documents that supports the idea that their business is in good standing. Once verified, MegaTransfer will automatically add the remaining payment methods on merchant s MTG setup. WIRE TRANSFER API Wire Transfer can be added as a payment option by switching it ON from Merchant Setup page. All transactions made in wire transfer method will be automatically tagged as "Pending" on our system. We need to receive an actual wire transfer from your clients before making the status as "Completed" or "Declined". We will credit your wallets once we receive the wire transfer payment from your clients. You can check the status of the wire transfer payments using this link: https://www.megatransfer.co.uk/payments/wiretransferapi/[merchant ID]/[MERCHANT KEY]/[ORDER ID]
Both Merchant ID and Merchant Key can be found on your Merchant Setup page. Order ID is optional. Leaving it blank will list all payment transactions under your merchant account, otherwise, it will show records based on that specific Order ID. SAMPLE CODE STRUCTURES STRUCTURE OF PHP REQUEST <?php $items = $_POST["items"]; $quantity = $_POST["quantity"]; $amount = $_POST["amount"]; $currency = $_POST["currency"]; $client_name = $_POST["client_name"]; $client_country = $_POST["client_country"]; $client_city = $_POST["client_city"]; $client_email = $_POST["client_email"]; $reg_date = $_POST["client_regdate"]; $url = "https://www.megatransfer.co.uk/"; $merchant_id = "526600186654"; $secret_code = "6c417hg8eaef344c41b8ffggh56064cdfe13101dc28bbnx9b03bbb34c7e96dbdf4"; $separator = "101136960129"; $order_id = strtotime("now"); $total_amount = (int) $quantity * (float) $amount; $total_amount = sprintf("%1.2f",$total_amount); $signature = hash("sha256",$secret_code.$separator.$merchant_id.$separator.$items.$separator.$quantity. $separator.$amount.$separator.$total_amount.$separator.$currency. $separator.$secret_code);?> <html> <body onload="document.form.submit();"> <form id="form" name="form" method="post" action="https://www.megatransfer.co.uk/payments/"> <input type="hidden" name="items" value="<?php echo $items?>"/> <input type="hidden" name="quantity" value="<?php echo $quantity?>"/> <input type="hidden" name="amount" value="<?php echo $amount?>"/> <input type="hidden" name="currency" value="<?php echo $currency?>"/> <input type="hidden" name="total_amount" value="<?php echo $total_amount?>"/> <input type="hidden" name="merchant_id" value="<?php echo $merchant_id?>"/> <input type="hidden" name="order_id" value="<?php echo $order_id?>"/> <input type="hidden" name="client_name" value="<?php echo $client_name?>"/> <input type="hidden" name="client_country" value="<?php echo $client_country?>"/> <input type="hidden" name="client_city" value="<?php echo $client_city?>"/> <input type="hidden" name="client_email" value="<?php echo $client_email?>"/> <input type="hidden" name="client_regdate" value="<?php echo $reg_date?>"/> <input type="hidden" name="url" value="<?php echo $url?>"/> <input type="hidden" name="signature" value="<?php echo $signature?>"/> //FOR TEST GATEWAY <input type="hidden" name="gateway_id" value="0"/> //FOR LIVE GATEWAY <input type="hidden" name="gateway_id" value="1"/> <input type="hidden" name="payment_method" value="cc ch mt wt"/> <input type="hidden" name="success_url" value="https://www.megatransfer.co.uk/success/"/> <input type="hidden" name="fail_url" value="https://www.megatransfer.co.uk/fail/"/> <input type="hidden" name="callback_url" value="https://www.megatransfer.co.uk/callback/"/>
</form> </body> </html> STRUCTURE OF JSON RESPONSE Failed {"items":"clothes","quantity":"2","amount":"2.00","currency":"usd","total_amount":"4.00","merchant_id":"526600186654", "order_id":"1439280592","status":"failed","payment_method":"cc","message":"internal error on the system. Please contact support."} Success {"items":"clothes","quantity":"2","amount":"50.00","currency":"usd","total_amount":"100. 00","merchant_id":"526600186", "order_id":"1439280592","token":"66baa1bf7680613584b0f154bca39f0e","transaction_id": "59037524897","status":"successful","payment_method":"WT","amount_credited":2.99} STRUCTURE OF PHP CALLBACK <?php parse_str(file_get_contents("php://input"),$_post); $response = $_POST["response"]; $response = json_decode($response,true); $items = $response["items"]; $quantity = $response["quantity"]; $amount = $response["amount"]; $currency = $response["currency"]; $merchant_id = $response["merchant_id"]; $order_id = $response["order_id"]; $status = $response["status"]; $secret_code = "6c417hg8eaef344c41b8ffggh56064cdfe13101dc28bbnx9b03bbb34c7e96dbdf4"; if($status == "success"){ $transaction_id = $response["transaction_id"]; $token = $response["token"]; if($token == hash("md5",$secret_code.$order_id.$transaction_id.$secret_code)){ //your statement here //update your database for success transaction } } else { $message = $response["message"]; //your statement here //update your database for fail transaction
}?> CONTACT US For assistance on how to integrate MTG, please contact us through following methods: Email support@megatransfer.co.uk Phone +44 20 7193 0226 Skype mtuk.support