我正在使用来自自适应支付 api 的预先批准和延迟链式支付。
我使用 api 的测试业务帐户也是主要接收者帐户。
在使用预先批准启动延迟付款后,我得到了一个支付密钥。资金在主要收款人中准确收到。我的应用程序现在有一个场景,即资金必须从主要收款人退还给购买者。当尝试使用支付密钥执行此退款并指定接收方并设置主要接收方标志时,我收到错误 NO_API_ACCESS_TO_RECEIVER。
这阻止了我的应用程序发布,并且是一个严重的问题。请您尽早解除对我的屏蔽。
这是我的代码:
RefundRequest refundRequest = new RefundRequest();
refundRequest.setPayKey(payKey);
refundRequest.setCurrencyCode(KeyConstants.CURRENCY_USD_CODE);
refundRequest.setRequestEnvelope(ClientInfoUtil.getMyAppRequestEnvelope());
ReceiverList receiverList = new ReceiverList();
Receiver receiver = new Receiver();
receiver.setEmail(businessAccountPaypalEmail);
receiver.setPrimary(true);
double truncatedAmount = NumberUtil.getDoubleTruncate(amount, KeyConstants.TWO_DECIMAL_FORMAT);
BigDecimal trunBigDecimal = new BigDecimal(truncatedAmount);
receiver.setAmount(trunBigDecimal.setScale(2, RoundingMode.HALF_UP));
receiverList.getReceiver().add(receiver);
refundRequest.setReceiverList(receiverList);
try {
AdaptivePayments adaptivePayments = new AdaptivePayments();
RefundResponse refundResponse = adaptivePayments.refund(refundRequest);
ResponseEnvelope responseEnvelope = refundResponse.getResponseEnvelope();
AckCode ackCode = responseEnvelope.getAck();
if(ackCode == AckCode.SUCCESS || ackCode == AckCode.SUCCESS_WITH_WARNING){
Logger.getLogger(PayPalSessionBean.class.getName()).log(Level.INFO, "Refund success for the pay key {0} and messsage {1}",
new Object[]{payKey});
System.out.println("Ack code is " + ackCode);
RefundInfoList refundInfoList = refundResponse.getRefundInfoList();
List<RefundInfo> refundInfos = refundInfoList.getRefundInfo();
for (Iterator iterator = refundInfos.iterator(); iterator
.hasNext();) {
RefundInfo refundInfo = (RefundInfo) iterator.next();
System.out.println(refundInfo.getReceiver().getEmail() + "\t" + refundInfo.getRefundTransactionStatus() + "\t" +
refundInfo.getRefundGrossAmount() + '\t' + refundInfo.getRefundStatus() + '\t');
ErrorList errorList = refundInfo.getErrorList();
List<ErrorData> errs = errorList.getError();
for (Iterator iterator2 = errs.iterator(); iterator2
.hasNext();) {
ErrorData errorData = (ErrorData) iterator2.next();
System.out.println(errorData.getMessage());
}
}
return true;
}
在上面的代码片段中,返回的 Ak 代码是成功的,但是当我打印 RefundInfo 对象的退款状态时,它显示 NO_API_ACCESS_TO_RECEIVER。我已经从主帐户的贝宝面板向 api 调用者授予了权限。
我身边有什么遗漏吗?请帮帮我!