我正在建立一个电子商务网站(使用node.js),我使用经典的PayPal API。 我需要客户输入他们的电话号码,以便我们可以在订单出现问题时与他们联系。
因此,我在网站设置下更改了我的教皇帐户的设置,以便在结帐时需要一个电话号码。
在致电SetExpressCheckout
并且客户输入他的信息(包括电话号码)后,我会收到成功状态的回复以及其他订单信息。
但是,响应中缺少电话号码。根据文档,它假设在PHONENUM
字段中。我也尝试拨打GetExpressCheckoutDetails
以获取电话,但它仍然缺失。
请求电话:
var post_data = {
USER: paypalUser,
PWD: paypalPassword,
SIGNATURE: paypalSignature,
METHOD: "SetExpressCheckout",
VERSION: 93,
SOLUTIONTYPE: "Sole",
L_PAYMENTREQUEST_0_NAME0 : info.name,
L_PAYMENTREQUEST_0_DESC0 : info.description,
L_PAYMENTREQUEST_0_AMT0 : info.price,
L_PAYMENTREQUEST_0_QTY0 : 1,
PAYMENTREQUEST_0_PAYMENTACTION: "SALE",
PAYMENTREQUEST_0_AMT: subtotal+shippingCost,
PAYMENTREQUEST_0_ITEMAMT: subtotal,
PAYMENTREQUEST_0_CURRENCYCODE: "ILS",
PAYMENTREQUEST_0_SHIPPINGAMT:shippingCost,
LOCALECODE:"he_IL",
RETURNURL: "http://localhost:3000" + successUrl,
CANCELURL: "http://localhost:3000" + cancelUrl,
LOGOIMG:"localhost:3000/images/logo.svg"
}
var post_data_encoded = querystring.encode(post_data);
var httpRequest = https.request(options,function(response){
response.on('data', function (chunk) {
var resData = querystring.parse(chunk.toString());
callback(resData);
});
});
这是我得到的回应:
{"TOKEN":"EC-1UV4673091640241G",
"BILLINGAGREEMENTACCEPTEDSTATUS":"0",
"CHECKOUTSTATUS":"PaymentActionNotInitiated",
"TIMESTAMP":"2015-02-09T21:27:23Z",
"CORRELATIONID":"c1d72f302ac78",
"ACK":"Success",
"VERSION":"93",
"BUILD":"15177679",
"EMAIL":"******@gmail.com",
"PAYERID":"YW4B5FG9HBEXU",
"PAYERSTATUS":"unverified",
"FIRSTNAME":"Dany",
"LASTNAME":"Shovevani",
"COUNTRYCODE":"US",
"SHIPTONAME":"Dany Shovevani",
"SHIPTOSTREET":"baba",
"SHIPTOCITY":"New York",
"SHIPTOSTATE":"NY",
"SHIPTOZIP":"10001",
"SHIPTOCOUNTRYCODE":"US",
"SHIPTOCOUNTRYNAME":"United States",
"ADDRESSSTATUS":"Confirmed",
"CURRENCYCODE":"ILS",
"AMT":"225.00",
"ITEMAMT":"200.00",
"SHIPPINGAMT":"25.00",
"HANDLINGAMT":"0.00",
"TAXAMT":"0.00",
"INSURANCEAMT":"0.00",
"SHIPDISCAMT":"0.00",
"L_NAME0":"חלוק",
"L_QTY0":"1",
"L_TAXAMT0":"0.00",
"L_AMT0":"200.00",
"L_DESC0":"חלוק רגיל גדול.",
"L_ITEMWEIGHTVALUE0":" 0.00000",
"L_ITEMLENGTHVALUE0":" 0.00000",
"L_ITEMWIDTHVALUE0":" 0.00000",
"L_ITEMHEIGHTVALUE0":" 0.00000",
"PAYMENTREQUEST_0_CURRENCYCODE":"ILS",
"PAYMENTREQUEST_0_AMT":"482.50",
"PAYMENTREQUEST_0_ITEMAMT":"457.50",
"PAYMENTREQUEST_0_SHIPPINGAMT":"25.00",
"PAYMENTREQUEST_0_HANDLINGAMT":"0.00",
"PAYMENTREQUEST_0_TAXAMT":"0.00",
"PAYMENTREQUEST_0_INSURANCEAMT":"0.00",
"PAYMENTREQUEST_0_SHIPDISCAMT":"0.00",
"PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED":"false",
"PAYMENTREQUEST_0_SHIPTONAME":"Dany Shovevani",
"PAYMENTREQUEST_0_SHIPTOSTREET":"baba",
"PAYMENTREQUEST_0_SHIPTOCITY":"New York",
"PAYMENTREQUEST_0_SHIPTOSTATE":"NY",
"PAYMENTREQUEST_0_SHIPTOZIP":"10001",
"PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE":"US",
"PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME":"United States",
"PAYMENTREQUEST_0_ADDRESSSTATUS":"Confirmed",
"L_PAYMENTREQUEST_0_NAME0":"חלוק",
"L_PAYMENTREQUEST_0_QTY0":"1",
"L_PAYMENTREQUEST_0_TAXAMT0":"0.00",
"L_PAYMENTREQUEST_0_AMT0":"200.00",
"L_PAYMENTREQUEST_0_DESC0":"חלוק רגיל גדול.",
"L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0":" 0.00000",
"L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0":" 0.00000",
"L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0":" 0.00000",
"L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0":" 0.00000",
"PAYMENTREQUESTINFO_0_ERRORCODE":"0"}
我是否遗漏了某些内容或是否有其他步骤才能获取电话号码?
答案 0 :(得分:1)
看起来像是需要电话号码"设置未正确启用。 我已经为您的Sandbox帐户重新启用了它。你可以再试一次。
或者,如果您希望将货物发送到电话号码,则可以使用PAYMENTREQUEST_n_SHIPTOPHONENUM
。(您需要包含REQCONFIRMSHIPPING=1
才能使用this。