Automatically change the amount when paying with paypal

More
9 years 2 months ago #5145 by aloeup
Hello,

I would like to set up the paypal file in such a way that any amount that is entered as a paypal payment should be divided by 1.98553 The reason for this is that I am accepting payments in a currency which is not supported by paypal but is linked with a fixed exchange rate to the euro.

I hope my question makes sense.

Thank you

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #5147 by vietvh
Hi,

To do that, you can open this file

plugins/solidrespayment/paypal/paypal.php

Then adjust this line ( line 75) to insert your own calculation rule:
$paymentData->amount = $amountToBePaid;

Regards,

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #5152 by aloeup
Great! thank you!

Now the only thing that I am left with is to hard code the currency. I would need to have the currency within the file (which I am sending to Paypal) to be only Euro. At the moment it takes BGN which is the currency that the web site uses.

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #5153 by vietvh
Hi,

In the same file you can hard code your desired currency code here:
$paymentData->currency_code = $reservationData->currency_code;

Change it to something like this:
$paymentData->currency_code = 'EUR';

Regards,

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago - 9 years 2 months ago #5156 by aloeup
Hmm for some reason it does not work, The response that I get from PayPal is:
The link you have used to enter the PayPal system contains an incorrectly formatted item amount.
The code is:

$paymentData->currency_code = 'EUR';
$paymentData->item_number = $reservationData->code;
$paymentData->item_name = 'Reservation Code '. $reservationData->code;
$paymentData->amount = $amountToBePaid/1.95;


Any ideas?

Thank you.
Last edit: 9 years 2 months ago by aloeup. Reason: added text

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago - 9 years 2 months ago #5158 by vietvh
Hi,

You also need make sure that item amount has only 2 decimal places.

Regards.
Last edit: 9 years 2 months ago by vietvh.

Please Log in or Create an account to join the conversation.

Moderators: solidres
Powered by Kunena Forum

All the things you need to make your work easier. Did you like Solidres?