2010-07-12 139 views
19

我想將貝寶整合到我的網站,並要求用戶輸入貝寶賬戶的佣金支出。 我怎樣才能檢查他們的帳戶是否存在貝寶? 我更喜歡不發送他們$ 0.01或它是檢查帳戶的唯一方法?如何驗證PayPal賬戶?

它應該自動驗證它,而用戶登錄到網站。

回答

3

您可以要求他們輸入他們在paypal中使用的電子郵件地址。如果他們沒有PayPal帳戶,您仍可以將資金髮送給他們輸入的任何電子郵件。貝寶將負責讓他們創建一個包含該電子郵件ID的PayPal賬戶並向他們顯示他們的資金。

所有你可能要確保的是,他們輸入正確的電子郵件ID ..也許電子郵件地址驗證步驟可以做到這一點。

+0

它應該在用戶註冊時自動驗證它。 – Andrey 2010-07-12 19:45:47

+1

你的意思是你要檢查他們是否有一個有效的貝寶帳戶之前,你發送他們的錢?你必須有一個獨特的問題,因爲我只是要求他們輸入他們的PayPal ID,並假設他們做的是對的,給他們錢,並與它做好。 這是他們應該擔心輸入正確的信息,而不是你。除非你給那些不特別感興趣的人捐錢......這就是我的意思,你必須有一個獨特的問題。 – 2010-07-12 22:00:23

+0

注意:MassPay和Payments API不會將資金髮送到未先註冊帳戶的電子郵件地址! – 2016-02-05 20:26:34

11

嘗試使用貝寶AddressVerify API:https://www.x.com/docs/DOC-1161

AddressVerify還可以檢查用戶的地址和郵編/郵編是正確的。

請注意,訪問AddressVerify API默認情況下不由PayPal提供。您必須提交客戶支持請求才能在沙箱中訪問該請求,然後再次聯繫他們以在現場網站上審批。

+8

斷開的鏈接....:/ – coiso 2014-05-27 19:02:52

5

GetVerifiedStatus應該這樣做。您必須通過電子郵件地址和該人的姓名,然後才能返回其帳戶是否已通過驗證。

如果他們沒有PayPal賬戶,您會收到一條錯誤消息,指出「無法確定PayPal賬戶狀態」。

這裏的請求和響應我只是跑在沙箱使用經過驗證的PayPal帳戶的樣本...

<?xml version="1.0" encoding="utf-8"?> 
<GetVerifiedStatusRequest xmlns="http://svcs.paypal.com/types/ap"> 
    <requestEnvelope xmlns=""> 
    <detailLevel>ReturnAll</detailLevel> 
    <errorLanguage>en_US</errorLanguage> 
    </requestEnvelope> 
    <emailAddress xmlns="">[email protected]</emailAddress> 
    <matchCriteria xmlns="">NAME</matchCriteria> 
    <firstName xmlns="">Drew</firstName> 
    <lastName xmlns="">Angell</lastName> 
</GetVerifiedStatusRequest> 

<?xml version='1.0' encoding='UTF-8'?> 
<ns2:GetVerifiedStatusResponse xmlns:ns2="http://svcs.paypal.com/types/aa"> 
    <responseEnvelope> 
    <timestamp>2013-01-05T00:07:01.729-08:00</timestamp> 
    <ack>Success</ack> 
    <correlationId>3fecb3e1f2011</correlationId> 
    <build>4055066</build> 
    </responseEnvelope> 
    <accountStatus>VERIFIED</accountStatus> 
    <userInfo> 
    <emailAddress>[email protected]</emailAddress> 
    <accountType>BUSINESS</accountType> 
    <accountId>E7BTGVXBFSUAU</accountId> 
    <name> 
     <salutation></salutation> 
     <firstName>Drew</firstName> 
     <middleName></middleName> 
     <lastName>Angell</lastName> 
     <suffix></suffix> 
    </name> 
    <businessName>Drew Angell's Test Store</businessName> 
    </userInfo> 
</ns2:GetVerifiedStatusResponse> 

而且這裏有一個請求和響應,其中支付寶賬戶不存在的樣本...

<?xml version="1.0" encoding="utf-8"?> 
<GetVerifiedStatusRequest xmlns="http://svcs.paypal.com/types/ap"> 
    <requestEnvelope xmlns=""> 
    <detailLevel>ReturnAll</detailLevel> 
    <errorLanguage>en_US</errorLanguage> 
    </requestEnvelope> 
    <emailAddress xmlns="">[email protected]</emailAddress> 
    <matchCriteria xmlns="">NAME</matchCriteria> 
    <firstName xmlns="">Drew</firstName> 
    <lastName xmlns="">Angell</lastName> 
</GetVerifiedStatusRequest> 

<?xml version='1.0' encoding='UTF-8'?> 
<ns3:FaultMessage xmlns:ns3="http://svcs.paypal.com/types/common" xmlns:ns2="http://svcs.paypal.com/types/aa"> 
    <responseEnvelope> 
    <timestamp>2013-01-05T00:08:28.581-08:00</timestamp> 
    <ack>Failure</ack> 
    <correlationId>43364ce704211</correlationId> 
    <build>4055066</build> 
    </responseEnvelope> 
    <error> 
    <errorId>580023</errorId> 
    <domain>PLATFORM</domain> 
    <subdomain>Application</subdomain> 
    <severity>Error</severity> 
    <category>Application</category> 
    <message>Cannot determine PayPal Account status</message> 
    </error> 
</ns3:FaultMessage> 
+2

問題在於它還要求用戶輸入他們的firstName和lastName,因爲它顯示在他們的PayPal帳戶上,否則它會失敗。 – 2013-10-15 18:27:05

+2

很多人不正確地輸入他們的名字嗎? – 2013-10-15 22:36:47

+1

@DougS如果您將'matchCriteria'字段設置爲'NONE',則不需要用戶名稱。 – robmcvey 2013-10-31 10:36:47

0

擁有經過驗證的PayPal賬戶意味着您已經向PayPal提供了附加信息以證明您的身份。這使潛在客戶對您的合法性更有信心,並使您有資格被PayPal的賣家保護所涵蓋。驗證您的帳戶還會刪除帳戶限額,並使您能夠在PayPal帳戶和其他關聯的銀行帳戶之間轉移資金。

3

利用Java(我們可以這樣做使用adaptiveaccountssdk)

<dependency> 
    <groupId>com.paypal.sdk</groupId> 
    <artifactId>adaptiveaccountssdk</artifactId> 
    <version>LATEST</version> 
</dependency> 

...

Map<String, String> sdkConfig = new HashMap<>(); 
sdkConfig.put("mode", "sandbox/live"); 
sdkConfig.put("acct1.UserName", ""); 
sdkConfig.put("acct1.Password", "")); 
sdkConfig.put("acct1.Signature", "")); 
sdkConfig.put("acct1.AppId", "")); 

GetVerifiedStatusRequest request = new GetVerifiedStatusRequest(); 
AccountIdentifierType accountIdentifierType = new AccountIdentifierType(); 
accountIdentifierType.setEmailAddress(accountEmail); 
request.setAccountIdentifier(accountIdentifierType); 
request.setMatchCriteria("NONE"); 
AdaptiveAccountsService aas = new AdaptiveAccountsService(sdkConfig); 
GetVerifiedStatusResponse response = aas.getVerifiedStatus(request); 
String status = response.getAccountStatus(); 

.....

+0

此代碼是否保證用戶帳戶將被驗證? 我正在此錯誤.. INFO:responseEnvelope.timestamp = 2015-12-17T01%3A14%3A59.665-08%3A00&responseEnvelope.ack =失敗&responseEnvelope.correlationId = 9ee14ddcd7e99&responseEnvelope.build = 18679799&錯誤(0)= .errorId&580023錯誤(0).domain = PLATFORM&error(0).subdomain =應用程序錯誤(0).severity =錯誤和錯誤(0).category =應用程序和錯誤(0).message =不能 +確定+ PayPal +帳戶+狀態 您或任何人請幫忙!!? – 2015-12-17 09:19:01

3

我實現下面的腳本在PHP的GetVerifiedStatus方法與API調用,它對我來說工作得很好。此腳本適用於沙盒,因此如果您想對其進行測試,請使用沙箱PayPal帳戶進行測試。如果您想將其用於生產模式,請刪除沙箱行(我在評論提示中顯示它們)。我解釋了你需要從PayPal獲得的東西,以便在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; 

?>