我尝试使用以下示例参数实现paypal的 创建帐户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¤cyCode=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®istrationType=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.test@gmail.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' => true,
'createAccountWebOptionsType.useMiniBrowser' => false,
'createAccountWebOptionsType.returnUrl' => 'http://www.testurlonly.com',
'createAccountWebOptionsType.reminderEmailFrequency' => 'NONE',
'createAccountWebOptionsType.confirmEmail' => false
);
这是 AdaptiveAccounts / CreateAccount api(转换为数组)的响应:
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 :(得分:0)
而不是nameType。,使用名称..因此,我们有
name.firstName, name.lastName, name.salutation and name.suffix
我删除了name.salutation,因为我不知道该字段的正确值是什么。
对于addressType。,我将其替换为地址。此外,address.state必须具有州代码而不是州名。
我还发现paypal为格式和值不正确的字段返回 580022无效的请求参数。我们不能为postalCode,city和state提供虚拟数据。