2013-01-08 283 views
0

我試圖執行具有下列樣品參數創建帳戶API貝寶的創建帳戶貝寶API

accountType=Premier&addressType.line1=Real+St&addressType.city=San+Jose&addressType.postalCode=92274&addressType.countryCode=US&addressType.state=California&citizenshipCountryCode=US&contactPhoneNumber=123-456-1234&homePhoneNumber=123-456-1234&mobilePhoneNumber=123-456-1234&currencyCode=USD&dateOfBirth=1970-01-01Z&emailAddress=test.test%40gmail.com&nameType.salutation=Miss&nameType.firstName=Malou&nameType.lastName=Perez&nameType.suffix=Sr&preferredLanguageCode=en_US&registrationType=Web&requestEnvelope.errorLanguage=en_US&requestEnvelope.detailLevel=ReturnAll&suppressWelcomeEmail=1&createAccountWebOptionsType.useMiniBrowser=0&createAccountWebOptionsType.returnUrl=http%3A%2F%2Fwww.testurlonly.com&createAccountWebOptionsType.reminderEmailFrequency=NONE&createAccountWebOptionsType.confirmEmail=0 

使其更清晰,參數放入數組時具有以下值:

$parameters = array(
     'accountType'          => 'Premier', 
     'addressType.line1'         => 'Real St', 
     'addressType.city'         => 'San Jose', 
     'addressType.postalCode'        => '92274', 
     'addressType.countryCode'       => 'US', 
     'addressType.state'         => 'California', 
     'citizenshipCountryCode'        => 'US', 
     'contactPhoneNumber'         => '123-456-1234', 
     'homePhoneNumber'         => '123-456-1234', 
     'mobilePhoneNumber'         => '123-456-1234', 
     'currencyCode'          => 'USD', 
     'dateOfBirth'          => '1970-01-01Z', 
     'emailAddress'          => 'test.[email protected]', 
     'nameType.salutation'        => 'Miss', 
     'nameType.firstName'         => 'Malou', 
     'nameType.lastName'         => 'Perez', 
     'nameType.suffix'         => 'Sr', 
     'preferredLanguageCode'        => 'en_US', 
     'registrationType'         => 'Web', 
     'requestEnvelope.errorLanguage'      => 'en_US', 
     'requestEnvelope.detailLevel'      => 'ReturnAll', 
     'suppressWelcomeEmail'        => true, 
     'createAccountWebOptionsType.useMiniBrowser'   => false, 
     'createAccountWebOptionsType.returnUrl'    => 'http://www.testurlonly.com', 
     'createAccountWebOptionsType.reminderEmailFrequency' => 'NONE', 
     'createAccountWebOptionsType.confirmEmail'   => false 
    ); 

這裏是AdaptiveAccounts /的createAccount API響應(三onverted數組):

array(18) { 
    ["responseEnvelope.timestamp"]=> 
     string(29) "2013-01-07T21:33:01.984-08:00" 
     ["responseEnvelope.ack"]=> 
     string(7) "Failure" 
     ["responseEnvelope.correlationId"]=> 
     string(13) "ae7c9d245cabf" 
     ["responseEnvelope.build"]=> 
     string(7) "4055066" 
     ["error(0).errorId"]=> 
     string(6) "580029" 
     ["error(0).domain"]=> 
     string(8) "PLATFORM" 
     ["error(0).subdomain"]=> 
     string(11) "Application" 
     ["error(0).severity"]=> 
     string(5) "Error" 
     ["error(0).category"]=> 
     string(11) "Application" 
     ["error(0).message"]=> 
     string(40) "Missing required request parameter: name" 
     ["error(0).parameter(0)"]=> 
     string(4) "name" 
     ["error(1).errorId"]=> 
     string(6) "580029" 
     ["error(1).domain"]=> 
     string(8) "PLATFORM" 
     ["error(1).subdomain"]=> 
     string(11) "Application" 
     ["error(1).severity"]=> 
     string(5) "Error" 
     ["error(1).category"]=> 
     string(11) "Application" 
     ["error(1).message"]=> 
     string(43) "Missing required request parameter: address" 
     ["error(1).parameter(0)"]=> 
     string(7) "address" 
    } 

爲什麼它說:「缺少必要的請求參數:地址」請賜教「缺少必要的請求參數:名稱爲」

我想addressType.line1=Real+St&addressType.city=San+Jose&addressType.postalCode=92274&addressType.countryCode=US&addressType.state=California

地址

nameType.salutation=Miss&nameType.firstName=Malou&nameType.lastName=Perez&nameType.suffix=Sr

謝謝。

回答

0

,而不是NAMETYPE,使用的名字。因此,我們有

name.firstName, name.lastName, name.salutation and name.suffix 

和我刪除name.salutation,因爲我沒有什麼該字段的正確的價值觀是什麼想法。

對於addressType。,我用adress替換它。而且,address.state必須有狀態碼而不是狀態名稱。

我還發現paypal返回580022對於格式和值不正確的字段,請求參數無效。我們不能爲不存在的郵政編碼,城市和州的虛擬數據。