我们表示结帐(在沙箱上),并在创建定期付款资料中设置“zh_CN”
CreateRecurringPaymentsProfileRequestType reqType = new CreateRecurringPaymentsProfileRequestType();
reqType.setVersion(VERSION);
reqType.setErrorLanguage(getLangCode());
我们也碰巧在请求paypal token api中将它设置在两个地方(自paypal网站显示中文以来有效)......
setExpressCheckoutRequestDetails.setReturnURL(url);
setExpressCheckoutRequestDetails.setCancelURL(url2);
setExpressCheckoutRequestDetails.setPaymentDetails(paymentDetailsList);
//This is the first place which works!!!! as the paypal GUI shows up in chinese...
setExpressCheckoutRequestDetails.setLocaleCode(getLangCode());
setExpressCheckoutRequestDetails.setBuyerEmail(user.getEmail());
SetExpressCheckoutRequestType setExpressCheckoutRequest = new SetExpressCheckoutRequestType(setExpressCheckoutRequestDetails);
setExpressCheckoutRequest.setVersion(VERSION);
//This is the second location which probably doesn't work though this request has never failed :( and I don't know how to force a failure :( as putting amount 105.37 on negative testing did not work
setExpressCheckoutRequest.setErrorLanguage(getLangCode());
然后,我们会将结算周期的开始日期评论为导致失败,因为否定测试无效(请参阅帖子how to simulate payment denial in paypal sandbox)。这会导致失败但是返回的错误是英文而不是中文说“需要开始日期”和长消息“订阅开始日期是必需的”错误代码11549.
为什么这不起作用? (我们只是简单地显示paypal错误,因为它似乎太多了,无法翻译,但它的语言不正确)。
感谢, 迪安
答案 0 :(得分:1)
您指的是API响应,对吧?那些只是(美国)英语 将PayPal API错误响应映射到您最终的适当面向客户的消息(当然可以使用您喜欢的任何语言)是一种很好的做法。
我不建议直接向客户公开PayPal API错误响应。