Reputation: 1901
I'd like to verify the email entered by the user if it is a valid PayPal email or not without taking the customer to the PayPal screen. I want to do this from code and on the backend if possible.
I found some information related to my need but don't know how to use it.
Upvotes: 2
Views: 4774
Reputation: 1901
-(void)verifyEmail:email
{
[kappDelegate ShowIndicator];
NSMutableURLRequest *request ;
NSString*_postData ;
webservice=1;
_postData = [NSString stringWithFormat:@"emailAddress=%@&matchCriteria=%@",email,@"NONE"];
request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus"]] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:60.0];
[request setHTTPMethod:@"POST"];
[request addValue:@"jb-us-seller_api1.paypal.com" forHTTPHeaderField:@"X-PAYPAL-SECURITY-USERID"];
[request addValue:@"WX4WTU3S8MY44S7F" forHTTPHeaderField:@"X-PAYPAL-SECURITY-PASSWORD"];
[request addValue:@"AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" forHTTPHeaderField:@"X-PAYPAL-SECURITY-SIGNATURE"];
[request addValue:@"APP-80W284485P519543T" forHTTPHeaderField:@"X-PAYPAL-APPLICATION-ID"];
[request addValue:@"NV" forHTTPHeaderField:@"X-PAYPAL-REQUEST-DATA-FORMAT"];
[request addValue:@"JSON" forHTTPHeaderField:@"X-PAYPAL-RESPONSE-DATA-FORMAT"];
[request setHTTPBody: [_postData dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if(connection)
{
if(webData==nil)
{
webData = [NSMutableData data] ;
NSLog(@"data");
}
else
{
webData=nil;
webData = [NSMutableData data] ;
}
NSLog(@"server connection made");
}
else
{
NSLog(@"connection is NULL");
}
}
here is the full code that i am using right now... as it is in sandbox environment no need to change any key value just send the email using this method to verify email with paypal.
Upvotes: 0
Reputation: 1901
i found my answer using this .
_postData = [NSString stringWithFormat:@"emailAddress=%@&matchCriteria=%@",email,@"NONE"];
request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus"]] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:60.0];
[request setHTTPMethod:@"POST"];
[request addValue:@"jb-us-seller_api1.paypal.com" forHTTPHeaderField:@"X-PAYPAL-SECURITY-USERID"];
[request addValue:@"WX4WTU3S8MY44S7F" forHTTPHeaderField:@"X-PAYPAL-SECURITY-PASSWORD"];
[request addValue:@"AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" forHTTPHeaderField:@"X-PAYPAL-SECURITY-SIGNATURE"];
[request addValue:@"APP-80W284485P519543T" forHTTPHeaderField:@"X-PAYPAL-APPLICATION-ID"];
[request addValue:@"NV" forHTTPHeaderField:@"X-PAYPAL-REQUEST-DATA-FORMAT"];
[request addValue:@"JSON" forHTTPHeaderField:@"X-PAYPAL-RESPONSE-DATA-FORMAT"];
Upvotes: 1
Reputation: 379
The information you have found is the correct way to verify the PayPal account. GetVerifiedStatus is one of the API of Adaptive Accounts. Please refer to the link below for the details of Adaptive Accounts. https://developer.paypal.com/webapps/developer/docs/classic/adaptive-accounts/gs_AdaptiveAccounts/
To use GetVerifiedStatus API, you will need to go to the site below to apply for an APP ID which should be used when you call Adaptive Accounts APIs. https://www.paypal-apps.com/user/my-account/applications Go to the site above, login and click "New App", then fill in the form base on your needs. Make sure to check the "Get Verified Status" checkbox under "Adaptive Accounts". After you applied it, APP review team will review your application, if any update, they will leave a message on this site.
Upvotes: 2