robmcvey / cakephp-paypal

CakePHP 2.0 plugin for PayPal Website Payment Pro
60 stars 44 forks source link

Currency on direct payment. #21

Closed Hooolm closed 10 years ago

Hooolm commented 10 years ago

I just installed your plugin and i can not figure out whats going wrong. I am trying to make use of the "doDirectPayment"-method you implemented. I pass DKK as an argument for currency since it is the code for Danish Kroner. I get no errors and the payment goes through but on my sandbox account it seems to default to GBP no matter what currency i pass.

riteshkhadka commented 10 years ago

1) Go to app/Plugin/Paypal/Lib/paypal.php 2) Go to public function formatDoDirectPaymentNvps 3) Go to $nvps = array('CURRENCYCODE' => 'USD',), find this line change it to 'CURRENCYCODE' => $payment['yourfieldname'], i.e if you are passing field name currency_code changi yourfieldname to currency_code or if you will be using DKK for all payment simply change it to USD to DKK

Hooolm commented 10 years ago

Thanks for answering so quickly! It seems that DKK is not a supported currency. When i change it to USD it goes through as a valid payment. But i get the error "This transaction cannot be processed due to an unsupported currency." when i change it to DKK. I believe that this has nothing to do with your plugin but rather a problem in the paypal API?.

Hooolm commented 10 years ago

I found the problem, it seems that if your pro account is bounded to the US you cannot use DKK as a currency for direct payment. I created a new sandbox account and placed it in the UK. The transactions now work. Thank you so much for responding so quickly. Im looking forward to utilizing your plugin. Great work!