Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Malaysia Payment System Integration
 
Jai
Jr. Member
 
Total Posts:  5
Joined:  2007-08-31
 

Hi,

Is there anyone had done the integration of Magento and our local payment provider like iPay88 or NBepay? I currently try working on it but if it already been done why not to let us know.

Thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
JLHC
Moderator
 
Avatar
Total Posts:  1287
Joined:  2008-05-09
Tampa, FL
 

I have not seen any of this available.

By the way, please join the Magento Malaysia Translation when you have the time. wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
ladycooper
Jr. Member
 
Total Posts:  3
Joined:  2009-02-01
 

Hi Jai,

have you done with the integration with payment gateway?
any information to share?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

I’m also exploring other payment gateways more suited with our local conditions. Still at the beginning stage, in fact, I’m just starting to look into this today. I’m thinking of
* maybank2u merchant
* online giro transfer (maybank, cimb, etc.)
* work with other integrators like iPay88 or neowave

So, if any of you guys are working on this or have already figure it out, please share it here.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mafinsoft.com
Jr. Member
 
Total Posts:  22
Joined:  2008-09-17
 

Hi there. We have completed integration of Magento and iPay88 payment switching gateway. Stay tune or you can PM us for more information.

phew.... integrating a payment gateway with Magento is not so easy and straightforward after all.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mafinsoft.com
Jr. Member
 
Total Posts:  22
Joined:  2008-09-17
 

hi everyone!

we are pleased to announce the iPay88 payment gateway integration is available for download via MagentoConnect. Please visit
iPay88 Online Payment Gateway Integation
for details.

You can also PM us for installation services.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

iPay88 requires RM488 just for registration. PayPal has free registration. iPay88 charges 4% per transaction (SOHO plan). PayPal charges 1.9% to 2.9% + USD0.30 per transaction. PayPal charges 2.5% exchange rate fees. iPay88 pays in USD, you convert it to RM yourself. Since PayPal has easier entry, so I tried PayPal. However, I encountered a big problem (http://www.magentocommerce.com/bug-tracking/issue?issue=5441) when your base currency is not one of the 18 currencies accepted by PayPal (https://www.paypal.com/cgi-bin/webscr?cmd=p/sell/mc/mc_intro-outside), well actually one of these defined in standard.php located in app/code/core/Mage/Paypal/Model:

protected $_allowCurrencyCode = array(’AUD’, ‘CAD’, ‘CHF’, ‘CZK’, ‘DKK’, ‘EUR’, ‘GBP’, ‘HKD’, ‘HUF’, ‘JPY’, ‘NOK’, ‘NZD’, ‘PLN’, ‘SEK’, ‘SGD’,’USD’);

which has not been updated even in Ver 1.2.1.1.  Either case, MYR is not one of them. So, until Magento fixes this bug, or you change the base currency, iPay88 is the only option for us Malaysians.  Or if you get your hand a little dirtier, and modified line 107 of standard.php

$currency_code = $this->getQuote()->getBaseCurrencyCode();

to this

$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();

Now, so far so good and you can proceed to checkout. If the buyer selected to pay in USD and if your base currency is MYR, then you’ll be very happy because the prices transfer to PayPal is without the rate conversion and everything is 3.5 times more expensive. But I doubt you’ll get any business.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mafinsoft.com
Jr. Member
 
Total Posts:  22
Joined:  2008-09-17
 

Hi Kiat. The PayPal transaction rate you stated is a general rate mainly for US sellers.

If you log into your PayPal account and click on the Fees link at the bottom of the page, you will see different rates. On my blog, I explained about 2 types of PayPal transactions fees. They are called domestic and cross-border transaction fees. You can read up here
http://www.malcolmwong.com/2008/08/24/two-types-of-paypal-transaction-fees/

Do you happen to know the official code/function to convert the amount in base currency to selected currency? I found the older codes but it didn’t work. If you are aware please let us know. I would like to allow iPay88 online sellers to be able to accept payments in USD despite using Ringgit as the base currency.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

Hi Malcom, thanks for pointing out PayPal fees as it apply to Malaysians. So, the rate is practically the same as iPay88, which makes PayPal rather attractive.  I read somewhere that PayPal now always converts to MYR and imposed the 2.5% fees instead of paying in USD. Is that true?

Regarding conversion to selected currency from the base currency, try

$amount $storeCurrency->convert($amount$currency_code);

where $amount is the amount in base currency and $currency_code is the 3-letter currency code, such as ‘USD’.

I’m trying to fix PayPal standard payment to do just that. Here are the code I changed so far. Be warned, it is not fully tested.  I’m using PayPal sandbox for testing, and for some reason, the sandbox site is extremely sloooow.  In the backend order page, I have this error:Order total amount does not match paypal gross total amount.  So there is one more thing to change which I have not found out.

Standard.php, lines 103 onwards

/*validate the currency code is avaialable to use for paypal or not*/
    public function validate()
    
{
        parent
::validate();
        
//$currency_code = $this->getQuote()->getBaseCurrencyCode();
        
$currency_code Mage::app()->getStore()->getCurrentCurrencyCode();
        if (!
in_array($currency_code,$this->_allowCurrencyCode)) {
            Mage
::throwException(Mage::helper('paypal')->__('Selected currency code ('.$currency_code.') is not compatible with PayPal'));
        
}
        
return $this;
    
}

Next changes in next post.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

standard.php lines 135 onwards:

public function getStandardCheckoutFormFields()
    
{
        
if ($this->getQuote()->getIsVirtual()) {
            $a 
$this->getQuote()->getBillingAddress();
            
$b $this->getQuote()->getShippingAddress();
        
else {
            $a 
$this->getQuote()->getShippingAddress();
            
$b $this->getQuote()->getBillingAddress();
        
}
        
/*kiat's version 090302
          check that the current currency is acceptable by PayPal, if not then set currency to USD
          if currency is not the same as base currency, set convert boolean to true  
        */
        
$currency_code Mage::app()->getStore()->getCurrentCurrencyCode();
        
$storeCurrency Mage::getSingleton('directory/currency')
                ->
load($this->getQuote()->getStoreCurrencyCode());
        if (!
in_array($currency_code,$this->_allowCurrencyCode)) {
            $currency_code
='USD';
        

        $bConvert 
$currency_code != $this->getQuote()->getBaseCurrencyCode();

        
$sArr = array(
            
'business'          => Mage::getStoreConfig('paypal/wps/business_account'),
            
'return'            => Mage::getUrl('paypal/standard/success',array('_secure' => true)),
            
'cancel_return'     => Mage::getUrl('paypal/standard/cancel',array('_secure' => false)),
            
'notify_url'        => Mage::getUrl('paypal/standard/ipn'),
            
'invoice'           => $this->getCheckout()->getLastRealOrderId(),
            
'currency_code'     => $currency_code,
            
'address_override'  => 1,
            
'first_name'        => $a->getFirstname(),
            
'last_name'         => $a->getLastname(),
            
'address1'          => $a->getStreet(1),
            
'address2'          => $a->getStreet(2),
            
'city'              => $a->getCity(),
            
'state'             => $a->getRegionCode(),
            
'country'           => $a->getCountry(),
            
'zip'               => $a->getPostcode(),
        );

        
$logoUrl Mage::getStoreConfig('paypal/wps/logo_url');
        if(
$logoUrl){
             $sArr 
array_merge($sArr, array(
                  
'cpp_header_image' => $logoUrl
             
));
        
}

        
if($this->getConfigData('payment_action')==self::PAYMENT_TYPE_AUTH){
             $sArr 
array_merge($sArr, array(
                  
'paymentaction' => 'authorization'
             
));
        
}

        $transaciton_type 
$this->getConfigData('transaction_type');
        
/*
        O=aggregate cart amount to paypal
        I=individual items to paypal
        */
        
if ($transaciton_type=='O'{
            $businessName 
Mage::getStoreConfig('paypal/wps/business_name');
            
$storeName Mage::getStoreConfig('store/system/name');
            
$amount = ($a->getBaseSubtotal()+$b->getBaseSubtotal())-($a->getBaseDiscountAmount()+$b->getBaseDiscountAmount());
            
//convert the amount to the current currency or USD
            
if ($bConvert{
                $amount 
$storeCurrency->convert($amount$currency_code);
            
}
            $sArr 
array_merge($sArr, array(
                    
'cmd'           => '_ext-enter',
                    
'redirect_cmd'  => '_xclick',
                    
'item_name'     => $businessName $businessName $storeName,
                    
'amount'        => sprintf('%.2f'$amount),
                ));
            
$_shippingTax $this->getQuote()->getShippingAddress()->getBaseTaxAmount();
            
$_billingTax $this->getQuote()->getBillingAddress()->getBaseTaxAmount();
            
$tax $_shippingTax $_billingTax;
            
//convert the amount to the current currency or USD
            
if ($bConvert{
                $tax 
$storeCurrency->convert($tax$currency_code);
            
}
            $tax 
sprintf('%.2f'$tax);
            if (
$tax>0{
                  $sArr 
array_merge($sArr, array(
                        
'tax' => $tax
                  
));
            
}

        } 
else {
            $sArr 
array_merge($sArr, array(
                
'cmd'       => '_cart',
                
'upload'       => '1',
            ));
            
$items $this->getQuote()->getAllItems();
            if (
$items{
                $i 
1;
                foreach(
$items as $item){
                    
if ($item->getParentItem()) {
                        
continue;
                    
}
                    
//echo "<pre>"; print_r($item->getData()); echo"</pre>";
                    
$amount = ($item->getBaseCalculationPrice() - $item->getBaseDiscountAmount());
                    if (
$bConvert{
                        $amount 
$storeCurrency->convert($amount$currency_code);
                    
}
                    $sArr 
array_merge($sArr, array(
                        
'item_name_'.$i      => $item->getName(),
                        
'item_number_'.$i      => $item->getSku(),
                        
'quantity_'.$i      => $item->getQty(),
                        
'amount_'.$i      => sprintf('%.2f'$amount),
                    ));
                    
$tax $item->getBaseTaxAmount();
                    if(
$tax>0){
                        
//convert the amount to the current currency or USD
                        
if ($bConvert{
                            $tax 
$storeCurrency->convert($tax$currency_code);
                        
}
                        $sArr 
array_merge($sArr, array(
                        
'tax_'.$i      => sprintf('%.2f',$tax/$item->getQty()),
                        ));
                    
}
                    $i
++;
                
}
           }
        }
to continue…
 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

sorry for breaking into so many posts, but this is the last one:

$totalArr $a->getTotals();
        
$shipping $this->getQuote()->getShippingAddress()->getBaseShippingAmount();
        if (
$shipping>&& !$this->getQuote()->getIsVirtual()) {
          
//convert the amount to the current currency or USD
          
if ($bConvert{
              $shipping 
$storeCurrency->convert($shipping$currency_code);
          
}
          $shipping 
sprintf('%.2f'$shipping);
          
          if (
$transaciton_type=='O'{
              $sArr 
array_merge($sArr, array(
                    
'shipping' => $shipping
              
));
          
else {
              $shippingTax 
$this->getQuote()->getShippingAddress()->getBaseShippingTaxAmount();
              
//convert the amount to the current currency or USD
              
if ($bConvert{
                  $shippingTax 
$storeCurrency->convert($shippingTax$currency_code);
              
}
              $sArr 
array_merge($sArr, array(
                    
'item_name_'.$i   => $totalArr['shipping']->getTitle(),
                    
'quantity_'.$i    => 1,
                    
'amount_'.$i      => sprintf('%.2f',$shipping),
                    
'tax_'.$i         => sprintf('%.2f',$shippingTax),
              ));
              
$i++;
          
}
        }

        $sReq 
'';
        
$rArr = array();
        foreach (
$sArr as $k=>$v{
            
/*
            replacing & char with and. otherwise it will break the post
            */
            
$value =  str_replace("&","and",$v);
            
$rArr[$k] =  $value;
            
$sReq .= '&'.$k.'='.$value;
        
}

        
if ($this->getDebug() && $sReq{
            $sReq 
substr($sReq1);
            
$debug Mage::getModel('paypal/api_debug')
                    ->
setApiEndpoint($this->getPaypalUrl())
                    ->
setRequestBody($sReq)
                    ->
save();
        
}
        
return $rArr;
    
}

Anyone care to join and help to fix this? Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mafinsoft.com
Jr. Member
 
Total Posts:  22
Joined:  2008-09-17
 

Thanks Kiat. I will try the code you highlighted again. Not sure why it didn’t work properly before.

The 2.5% isn’t exactly true as far as I know. Perhaps the following what the person meant.

In January this year, I purchased something online via PayPal. It was priced in USD.
I was using my card issued by a Malaysian bank as a source of funding and PayPal gave me the option to choose either:
a) to charge my card in Ringgit where the USD to RM rate is displayed on that same page.
or
b) charge my card in USD where Visa will determine the USD to RM rate later when the payment is captured.

I have not withdrawn PayPal funds for quite sometime. Perhaps PayPal also have the same mechanism today which will earn them more money. I personally hope PayPal will support Ringgit this year.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dileepgm
Jr. Member
 
Total Posts:  27
Joined:  2009-02-01
 

Hi Kiat,

My store base currency is Japanese Yen and i try to order in USD and i got the following error.

There was an error during communication with Paypal: Transaction refused because of an invalid argument. See additional error messaegs for details : -Order total is invalid.

I have followed the steps you explained, here I am attaching the Standard.php file . Can you please look into this and tell me where i made the mistake.

thanks in advance
dileep G

File Attachments
standard.php  (File Size: 19KB - Downloads: 403)
 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

Hello dileep G

Try the attachment in this thread

http://www.magentocommerce.com/boards/viewthread/29961/

I hope that will fix the problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dileepgm
Jr. Member
 
Total Posts:  27
Joined:  2009-02-01
 

Hello Kiat,

Thank you very much for the information. I have downloaded the Standard.php file and the strange thing is that it works for me only two times.  The next time when i select a new currency from the combo box, the paypal payment method shows error “There was an error during communication with Paypal: Transaction refused because of an invalid argument. See additional error messages for details. - Order total is invalid.” I never changed anything on the downloaded file.
Can you please help me to sort out this issue.

thank you
dileep G

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

Hi dileep G

My site malayakisses.com works just fine. So I don’t know why yours don’t work since I can’t replicate the problem. Did you clear the cache in System, and deleted the directories in var\cache?  Can you post the screenshot of the error?

kiat

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2