我需要代表第三方向客户退款。我已经研究了权限API如何获取访问令牌和验证码,以便在身份验证API中使用它来生成签名和时间戳。但在此之后,我仍然对如何在Refund API中使用它感到困惑。目前这是我的退款paypal代码
CallerServices caller = new CallerServices();
APIProfile profile = ProfileFactory.createSignatureAPIProfile();
if(Configuration.getProperty("PaypalEnvironment").equals("sandbox"))
{
profile.setAPIUsername(Configuration.getProperty("PaypalAPIUsername"));
profile.setAPIPassword(Configuration.getProperty("PaypalAPIPassword"));
profile.setSignature(Configuration.getProperty("PaypalSignature"));
profile.setEnvironment(Configuration.getProperty("PaypalEnvironment"));
caller.setAPIProfile(profile);
}
RefundTransactionRequestType pprequest = new RefundTransactionRequestType();
if ((amount != null && amount.length() > 0)
&& (refundType.equals("Partial"))) {
BasicAmountType amtType = new BasicAmountType();
amtType.set_value(amount);
amtType.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
pprequest.setAmount(amtType);
}
pprequest.setVersion("63.0");
pprequest.setTransactionID(transactionId);
pprequest.setMemo(note);
pprequest.setRefundType(RefundType.fromString(refundType));
RefundTransactionResponseType ppresponse = (RefundTransactionResponseType) caller
.call("RefundTransaction", pprequest);
在此代码中,我如何嵌入签名?
答案 0 :(得分:0)
退款很简单。获得请求令牌和验证码后即可获得。您无需将此传递给退款API。您只需添加此行
即可 profile.setSubject(emailid);
然后退还。