How to get user country via Paypal API - paypal

Is it possible to get the country using their email? Or validate user's country.
In our system, the user submits their email and country. We need to check whether the country is correctly specified.
Sorry for my English.
Thanks.

you have to force users to login paypal (you don't want to allow transactions by who doesn't have a paypal account)
See SetExpressCheckout SOLUTIONTYPE = Mark
after the user completes the expresscheckout, in order to confirm it, you should check if its street address is confirmed and if it is of the country you require:
GetExpressCheckoutDetails
PAYERSTATUS must be "verified"
COUNTRYCODE must be the country you require
if these two values are ok, you can confirm the payment with "DoExpressCheckoutPayment"
since you are new, if you like my answer don't forget to set it as "accepted"

An alternative solution to verify customer's PP account country with out initiaing a transaction, is to implement "Login with PayPal" with your own customer login/register managenment.
It's based on the PayPal REST identity APIs, and will be much easier for you to get & manage customer account info (with user consent).
Here's the developemnt resource for your reference: https://developer.paypal.com/docs/integration/direct/identity/

Related

Getting user's business name and country via PayPal APIs

Our company has clients who have PayPal accounts. We also have their PayPal emails.
The issue is how to get client's business_name and country by providing its PayPal email?
Is it possible to make it using PayPal API?
Thanks in advance!
When a user makes a payment (Set up standard payments), you'll receive their shipping address country code as part of the v2/checkout/orders capture response.
If you need to the country of a PayPal account separately from such a payment capture's shipping address, then you might need to implement Log in with PayPal requesting the scope address, and have the user log in.
However, the capture response might also have a "payer" object with the billing account country (which can be different from the shipping country in some cases).

What should I do for a reliable checkout flow with Paypal?

A listener on my website 'listens' for successful purchases made via Paypal. Data retrieved by the listener includes a post variable that I can set before initiating the purchase. This is possible with Paypal's IPN(Instant Payment Notification). I am trying to get the IPN to recognize the users account on my website upon purchase. Every account on my website has a unique user ID number.
I have tried passing the accounts unique ID through Paypal's "Custom" variable so the IPN can listen for that. Though I think this is a bad idea because then people can purchase things for another account if they passed their unique ID. Though this is a guaranteed purchase handler, hackers can take advantage of this with social engineering.
I see that some people instead pass the session_id with php, but this isn't safe because the listener would have no way of recognizing the user's website account if the session_id were to disappear. I also see that people will pass a cookie tied to the user's unique account. I don't think this is a good idea because the cookie could be cleared.
It is to my impression that I can not send a refund or cancel a purchase if the user's account could not be identified(Without doing it manually). What checkout flow should I do?
I would create a local invoice record in your system, and this invoice would get a customer ID associated with it.
Then you can use the INVOICE parameter to pass the invoice ID to PayPal, and that would come back in IPN where you can then lookup the customer ID based on that invoice ID.

Payout with PayPal

I am generating a payout with PayPal to different people. These people provide access to us to their PayPal information to retrieve the necessary information to make the payout. So I am using two different things from PayPal:
Payouts.
Log in with PayPal.
To avoid problems when the user change their PayPal email address I am trying to use the recipient type "PAYPAL_ID" when I make the payout. But I have problem to retrieve this information when the user log in with PayPal.
I see the field "PAYER_ID" in this web site from PayPal but in the list of scopes to retrieve each field I don't found the scope for this field.
How can I retrieve this field from PayPal?
Thanks!!!
The problem was in PayPal, for some reason the Sandbox didn't return the PAYER_ID. They updated something in their systems.

What is _xclick-merchant?

What does _xclick-merchant means in terms of PayPal? iTunes buttons use it, but if I try to substitute any other PayPal email in it'll just say that it doesn't even exist. Is there any documentation if I wanted to try to implement it myself?
_xclick-merchant means in paypal terms that which merchant id is registered with the api key provided by the paypal at the time of merchant account creation. Api key is unique for every merchant account and if you change with any other email it will not be found because paypal in his end checks for both api key and provided paypal email if matches payment screen appear other wise error which you are getting.you can get all your required information here
https://developer.paypal.com/

How do you connect a Paypal IPN confirmation to a user?

I wanted to use Paypal's IPN service to verify payments for a recurring subscription charge for my website. How do you tie the IPN confirmations to a user in your site?
The IPN confirmation message has a name, email, paypal ID, recurring payment ID, but it seems to not give a unique identifier since I don't know where the paypal ID or recurring payment id comes from and it may not be trivial to uniquely match up the name/email that a user has on their paypal account (or entered there) with the name/email I have for them on my site (there may be many John Smith's and the person may choose to use a different email.)
1) When I send the initial payment request to Paypal, I can attach a unique UUID in the URL I ask them to send back to me, so if I save that unique ID for that user I can match that payment confirmation to the user who initiated it. Am I making that harder than it is? Is there an easier way?
2) Also, for a recurring/subscription charge, does paypal always use the URL I specified with the initial payment initiation? Does anyone have practical experience using the recurring Paypal payments with IPN's, does it reuse that unique URL? Or do I have to associate the Paypal ID's with the user after the first recurring payment is received?
Attaching unique data to the payment request is pretty much the accepted way to do it.
I don't have any experience with recurring charges.
I recently also set up some reoccurring payments with Paypal.
I actually wanted people to register as members after paying for the subscription, if they wanted to. As having to sign up as a member could add some friction to the sale process. So I don't send any user info along with the Subscribe button.
What my IPN script does is generate a unique activation code tied to the Paypal subscriptionID in the Activations table, then it sends this code to whoever paid for the subscription, with instructions on how to activate.
At the point of activation, you need to register or login. At this point the userID is added to the relevant row in the Activations table.
When the EndOfTerm IPN notification comes in the IPN script looks up the userID from the Activations table based on the SubscriberID given in the IPN. Then I can do whatever I need to do to that user to disable their subscription.
At all time the URL of the IPN script remains the same.
1) You can send an 'item_number' parameter with the initial subscription setup, which will get passed back to you. I'd suggest embedding an identification token in it.
2) If you mean the 'return' parameter, no, that's for sending the user to at the conclusion of the subscription setup. The renewal is automatic and doesn't 'ping' that page.
1) You want to be using the item_number parameter. Set this in your HTML form shown to the customer, and it will be returned to you by the paypal IPN, so you can put a database row ID in here, and use it to match up to the right person later.