PayPal Currency Conversion is incorrect - javascript

I am implementing paypal checkout 2.0 with smart buttons into an eCommerce website I am developing.
Now the problem I am facing is that the "shop" is priced in South African Rands(ZAR) and paypal gateway does not support ZAR as a currency to pay in, so I convert the currency to USD through a third party library. where I send a get request to an api and get the exchange rate for USD/ZAR.
then I divide the product order total/exchange rate and the result is the USD amount. which I parse to the paypal object then proceed with the checkout.
The problem is that Paypal has its own exchange rate and when it picks up that a users card is with a South African Bank it automatically does a conversion and shows the user how much he/she will be paying in the ZAR amount, and that value is different to the actual ZAR Amount.
I would like to know is there an api I can request the exchange rate of the USD/ZAR amount and use that value as the exchange rate or Is there away to disable the ZAR value from being Shown in the checkout

There is no API to get the current foreign exchange rate. The rate varies from moment to moment.
As far as hiding the rate in your screenshot, the answer is no. That currency conversion is happening for the buyer end and is invisible to whoever is receiving a payment denominated in a different currency (USD in this case). They have no visibility or control over this process. A buyer paying from a non-South African country would see something entirely different on this screen, for instance --not ZAR. So that's entirely between them and PayPal, you are not a party to this.

Related

How can I charge customers on my website a monthly payment with Google Pay?

I have a website where users can post an ad.
And once in a month I charge them for the amount of clicks clicked on their ad.
Now I want to charge them once in a month through the Google Pay service, is it possible?
** From the searches I did I realized that PayPal has such an option to create a subscription and charge the user once in a month. But I did not find a similar option in Google Pay **
According to this FAQ, yes, it's supported, but you need to be in touch with Google:
We also support recurring billing with variable amounts. For example, monthly phone bills for mobile carriers are supported. To get more information, merchants must contact their payment gateway representative.

Check Apple-Pay Price

The site has implemented payment through applePay. The problem is that the payment amount is set in javascript, i.e. can the user open the code and change the amount? How to implement verification on the server?
Apple Pay doesn't actually process the payment. It provides your site with a payment credential that you use to send to a payment processor.
Yes, a user can change the amount in the browser, but it only impacts what that user sees, not what is ultimately charged. The amount in the sheet is for user feedback where you can display a breakdown of the price, etc.
The best way to verify the amount is by doing this on the server side. If your site processes orders, use the items in the order to calculate the total, shipping etc. You should be able to ignore the amount coming from the client altogether.

Apple Pay - get full shipping address (containing 'addressLines')

I'm doing an Apple Pay WEB integration (using JS) and Braintree as a payment provider.
I need to calculate some taxes (US sales tax) for the order.
Current flow: The user clicks Pay with Apple Pay button, the Apple Pay payment sheet is displayed (we require shipping address containing the postal address,zipcode,name and email).
After that the payment sheet is displayed -> I call the session.onshippingcontactselected function, but at this point I can only get the locality,administrativeArea,postalCode,country and countryCode values from the shippingContact, so I'm not getting the addressLines containing the street name and its number. I need these values as well to accurately calculate my tax.
I know that Apple says in docs that they only provide the full address after the user authorizes the payment, meaning after the payment was done (this is too late for me, cause I need to know the tax amount before the order is being placed/before the user authorizes/pays the order).
Is there a workaround through this?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
As this information is delivered by Apple directly, there isn't a means by which you could circumvent the redacted shippingContact information provided in the pre-authorized session using Braintree's integration. If you need the full address to calculate tax you'd need to collect that from your customer earlier in the payment process or use a different means to calculate tax using the information provided in the shippingContact object. I'd recommend sending our support team an email to discuss this further.

Options for In-Game Lodgement & Withdrawal Services from Payments Processors?

I've seen a few questions on here about choosing between payment processors like PayPal and Stripe so I hope it's okay to post a non-code related question.
I'm developing an app and I'm wondering if there exists a payments processor that allows players to lodge/transfer money into their game account (so that they'll have a real-money in-game balance), and allows them to withdraw/cash-out/transfer money out from their balance back to their bank or PayPal account instantly at any time.
I've seen such a thing happen on gambling/betting websites, but I haven't been able to find any clear information on this in PayPal and Stripe's product documents.
I'm wondering if there's a standard lodgement/withdrawal service, or would I need to approach each transaction as purchase transfer (player "purchases" in game curency from me when they lodge money, and I "purchase" their in game currency back from them when they choose to withdraw their money).
I've searched through PayPal and Stripe's documents but I can't seem to find an answer to my question. I'm planning to use Javascript and PHP to integrate the payments processor. Any advice on this would be really appreciated.
Thanks in advance!
Given various gambling and money transmission laws this is an area you'll want to be pretty careful in.
It would be against the terms of service for Stripe: "Virtual currency that can be monetized, resold, or converted to physical or digital products and services or otherwise exit the virtual world."
With Paypal it would depend a bit on what your game is, from their acceptable use policy: "Activities involving gambling, gaming and/or any other activity with an entry fee and a prize, including, but not limited to casino games, sports betting, horse or greyhound racing, fantasy sports, lottery tickets, other ventures that facilitate gambling, games of skill (whether or not legally defined as gambling) and sweepstakes, if the operator and customers are located exclusively in jurisdictions where such activities are permitted by law."

Is jQuery an acceptable method to process product variation calculations in an E-Commerce site?

I'm creating a very simple store with literally one product where the user can choose different options and, dependant on the options selected, this will generate the total cost for the item. So for example, if the user selects the red variant, the price will increase by 5%, if the user selects the blue variant then the price will increase by 10%.
Currently I'm making the calculations with jQuery and then passing them to an empty field which is then posted to a payment gateway. Is this method safe? Theoretically, a user could open up Firebug or Chrome Developer Tools and edit the value (to zero) before posting it to the gateway but couldn't this apply to similar methods of product variation calculations? I'm trying to figure out whether or not this is an issue, but is there a better way?
This is definitely an issue, as you said yourself a user can modify the values.
So, you would show a price to the user on the client side, it doesn't matter how the value is generated because it will never be trusted by the server and will never be passed to the payment gateway.
User presses "buy now", is redirected to the payment gateway, but via your own server first. The server should validate the product and calculate the price.
The final price (calculated by your own server) will be shown to the user at point of payment.
On the client side you could either continue to generate the values with JQuery, or have the server return them via an AJAX request. But this would only be for user experience, the values could not be trusted.
If you choose this method, you sholud probably store product configuration (like string represenetaion od JSON or comma delimited field, etc.) in a hidden field, calculate the price (client or server side) and show price only as an information to a customer.
When he submits the configuration, validate it and calcuclate pice again on server.
That way customer could change the configuration (trough Firebug or so), but could not change the price since it is calculated based on a configuration.
Well, that is how i would do it.
After a PayPal payment been proceed, PayPal sends IPN(Instant Payment Notification) message to the url you specify.You have to resend it to verify if the message is original from paypal. After that, to be sure the user payed the right amount of money you get the values from IPN (it may come with user Id. transaction ID and so on...) and check them with your DataBase.
Some useful links:
More about IPN
Paypal Developers Guide
Pyapal IPN
Rule number one in e-commerce website: Never trust Users
So, this is the right process:
After calculations with jQuery and then passing them to an empty field which is then posted to a payment gateway, store the user name/id, transaction, and amount in database. Create method that verify, the stored values with the IPN response from paypal.
If values match, payment succeed. Else, mark it for later hand verification(you should store the id so it is easier to find on paypal).

Categories