PayPal Express Checkout(经典API)欺诈信息未返回

时间:2014-12-23 13:33:34

标签: c# express-checkout paypal

我使用PayPal Express Checkout和Classic API在我的网站上付款。以下是API文档:

https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_SOAP/

要使用该服务,我使用以下库:

https://www.nuget.org/packages/PayPalMerchantSDK/

我的任务是针对PayPal交易提供欺诈信息。我们想要显示的信息是地址验证(AVS)和安全代码验证(CSC)。

为了测试这一点,我试图记录欺诈信息。这是我创建Express Checkout请求的代码,然后获得响应:

var request = new DoExpressCheckoutPaymentReq() {
    DoExpressCheckoutPaymentRequest = new DoExpressCheckoutPaymentRequestType() {
        DoExpressCheckoutPaymentRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType() {
            Token = details.Token,
            PaymentAction = PaymentActionCodeType.SALE,
            PayerID = details.PayerInfo.PayerID,
            PaymentDetails = details.PaymentDetails
        },
        ReturnFMFDetails = 1
    }
};

var response = DoExpressCheckoutPayment(request);

上面注意我添加了以下行:

ReturnFMFDetails = 1

根据文档,这应该返回适​​当的欺诈信息。最后,我将以下代码添加到底部以记录欺诈信息:

var sb = new StringBuilder();

try {
    var paymentInfo = response.DoExpressCheckoutPaymentResponseDetails.PaymentInfo;

    for (var i = 0; i < paymentInfo.Count; i++) {
        var fmfDetails = paymentInfo[i].FMFDetails;

        if (fmfDetails != null) {
            if (fmfDetails.AcceptFilters != null) {
                foreach (var filter in fmfDetails.AcceptFilters.Filters) {
                    sb.AppendLine("Accept Filter (" + i + "): " + filter.Id + " - " + filter.Name);
                }
            }

            if (fmfDetails.DenyFilters != null) {
                foreach (var filter in fmfDetails.DenyFilters.Filters) {
                    sb.AppendLine("Deny Filter (" + i + "): " + filter.Id + " - " + filter.Name);
                }
            }

            if (fmfDetails.PendingFilters != null) {
                foreach (var filter in fmfDetails.PendingFilters.Filters) {
                    sb.AppendLine("Pending Filter (" + i + "): " + filter.Id + " - " + filter.Name);
                }
            }

            if (fmfDetails.ReportFilters != null) {
                foreach (var filter in fmfDetails.ReportFilters.Filters) {
                    sb.AppendLine("Report Filter (" + i + "): " + filter.Id + " - " + filter.Name);
                }
            }
        }
    }
} catch (Exception ex) {
    sb.AppendLine(ex.Message);
}

Logger.Log(sb.ToString());

但是,记录的信息始终为空。如果有人能告诉我我做错了什么,我会很感激。感谢

1 个答案:

答案 0 :(得分:0)

在使用PayPal Fraud Management Filters(FMF)之前,您必须setup & configure帐户过滤设置中的过滤条件。默认情况下,过滤器不会设置,也不会返回任何信息。

一旦你得到它设置&amp;如果已配置,则应开始接收相应的FMF信息。