he implementado siguiente script en PHP para el método GetVerifiedStatus con llamada API y está funcionando bien para mí. Este script es para sandbox, por lo que si desea probarlo, pruébelo con cuentas de sandbox de PayPal. Si desea usarlo para el modo de producción, elimine las líneas de la zona de pruebas (las mostré en las sugerencias de comentarios). Le expliqué sobre las cosas que debe obtener de PayPal para ejecutar este código dentro de los comentarios de PHP.
<?php
// create a new cURL resource
$ch = curl_init();
$ppUserID = "******************"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppPass = "*************"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppSign = "********************"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppAppID = "***********"; //if it is sandbox then app id is always: APP-80W284485P519543T
$sandboxEmail = "********************"; //comment this line if you want to use it in production mode.It is just for sandbox mode
$emailAddress = "******************"; //The email address you wana verify
$firstName = "********"; //first name of the account holder you want to verify, sandbox personal account default first name is: test
$lastName = "*******"; //last name of the account holder you want to verify, sandbox personal account default last name is: buyer
//parameters of requests
$nvpStr = 'emailAddress='.$emailAddress.'&firstName='.$firstName.'&lastName='.$lastName.'&matchCriteria=NAME';
// RequestEnvelope fields
$detailLevel = urlencode("ReturnAll"); // See DetailLevelCode in the WSDL for valid enumerations
$errorLanguage = urlencode("en_US"); // This should be the standard RFC 3066 language identification tag, e.g., en_US
$nvpreq = "requestEnvelope.errorLanguage=$errorLanguage&requestEnvelope.detailLevel=$detailLevel";
$nvpreq .= "&$nvpStr";
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
$headerArray = array(
"X-PAYPAL-SECURITY-USERID:$ppUserID",
"X-PAYPAL-SECURITY-PASSWORD:$ppPass",
"X-PAYPAL-SECURITY-SIGNATURE:$ppSign",
"X-PAYPAL-REQUEST-DATA-FORMAT:NV",
"X-PAYPAL-RESPONSE-DATA-FORMAT:JSON",
"X-PAYPAL-APPLICATION-ID:$ppAppID",
"X-PAYPAL-SANDBOX-EMAIL-ADDRESS:$sandboxEmail" //comment this line in production mode. IT IS JUST FOR SANDBOX TEST
);
$url="https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
$paypalResponse = curl_exec($ch);
//echo $paypalResponse; //if you want to see whole PayPal response then uncomment it.
curl_close($ch);
$data = json_decode($paypalResponse);
if($data->responseEnvelope->ack == "Success"){
$output = array('status' => true); //means user is verified successfully
} else {
$output = array('status' => false); //means verification was unsuccessful
}
echo $output;
?>
Debe validarlo automáticamente mientras los usuarios firman. – Andrey
¿Quiere decir que quiere verificar si tienen una cuenta de PayPal válida antes de enviarles dinero? debe tener un problema único porque simplemente les pediría que ingresen su identificación de PayPal y supongan que lo están haciendo bien, les envíe el dinero y terminará con eso. son ellos quienes deberían estar preocupados por ingresar la información correcta, no usted. a menos que esté dando dinero a personas que no están particularmente interesadas en recibirlo ... que es lo que quiero decir con que debe tener un problema único. –
Nota: ¡las API MassPay y Payments NO enviarán dinero a una dirección de correo electrónico que no haya registrado una cuenta primero! –