我正在构建一个电子商务网站(使用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"}
我是遗漏了什么,还是有其他步骤可以获得电话号码?
"需要电话号码"设置似乎未正确启用。我已经为您的沙盒帐户再次启用了它。你可以再试一次。
或者,如果您想获得收货方的电话号码,也可以使用PAYMENTREQUEST_n_SHIPTOPHONENUM
。(您需要包含REQCONFIRMSHIPPING=1
才能使用此。