C# 使用SetPaymentsOptions请求时事务处理出错

C# 使用SetPaymentsOptions请求时事务处理出错,c#,paypal,paypal-sandbox,C#,Paypal,Paypal Sandbox,我正在将PayPal整合到客户的电子商务网站中。通过使用沙箱,我们使一切正常工作。我现在需要添加SetPaymentOptions请求,以防止用户更改其配送地址(他们在我们的网站上输入地址,因此他们无法在PayPal上更改地址,因为我们网站上计算的配送成本不同)。它似乎工作正常,但我在登录PayPal沙盒网站确认交易时出现3005错误。以下是相关代码(C#): 当您的Paypal帐户的电子邮件地址未经验证时,Paypal将返回此消息。要验证您的Paypal电子邮件帐户,请执行以下步骤: 登录你的

我正在将PayPal整合到客户的电子商务网站中。通过使用沙箱,我们使一切正常工作。我现在需要添加SetPaymentOptions请求,以防止用户更改其配送地址(他们在我们的网站上输入地址,因此他们无法在PayPal上更改地址,因为我们网站上计算的配送成本不同)。它似乎工作正常,但我在登录PayPal沙盒网站确认交易时出现3005错误。以下是相关代码(C#):


当您的Paypal帐户的电子邮件地址未经验证时,Paypal将返回此消息。要验证您的Paypal电子邮件帐户,请执行以下步骤:

登录你的贝宝帐户。您应该在“概述”选项卡中

单击您的电子邮件地址,在“业务帐户概述”下,您将进入一个网页,列出您的Paypal电子邮件地址

选择您的主要地址

点击“确认”按钮


按照Paypal的其他说明进行操作。

问题在于我为国家传递了什么;我发送的是“USA”,应该是“US”。

这是买家的电子邮件地址还是卖家的?必须验证商户帐户才能收到付款。我不确定这是问题所在;我使用的是沙盒测试帐户,我的所有帐户都在AccountDetails>profile中显示已验证。另外,如果我省略了
setPaymentOptionResponse r=\u paymentService.SetPaymentOptions(PayptSreq),支付工作正常。因此,要确认,当您说登录PayPal沙盒网站确认交易时发生错误时,您是登录到沙盒帐户,而不是您的开发者帐户?正确;我正在登录买家/发送者的沙箱帐户。当然,我的回复很好,但在我做出更改之前,显然不是完全好。哦,好吧。
public string MakeChainedPayment(params params) {
  var request = new PayRequest {
    requestEnvelope = new RequestEnvelope("en_us"),
    actionType = "CREATE",
    cancelUrl = this._cancelUrl,
    currencyCode = this._currencyCode,
    returnUrl = this._returnUrl,
    ipnNotificationUrl = this._ipnNotificationUrl
  };

  // Some code to generate receivers, not important for this problem, I don't think

  var response = this._paymentService.Pay(request);

  switch (response.paymentExecStatus) {
    // This always returns "CREATED", as I'd want, so good up to here.
    case "CREATED":
      // If I leave this code out, PayPal works fine, but I need 
      // this part to do the shipping address verification.

      var p = new SetPaymentOptionsRequest();
      p.senderOptions = new SenderOptions();
      p.senderOptions.addressOverride = false;
      p.senderOptions.shippingAddress = new ShippingAddressInfo {
        // Setting from params: city, country, zip, state, street1, street2
      };

      p.payKey = response.payKey;
      p.requestEnvelope = request.requestEnvelope;

      SetPaymentOptionsResponse r = _paymentService.SetPaymentOptions(payOptsReq);
      break;

      // This always retuns r.error.Count = 0, r.responseEnvelope.ack = "SUCCESS",
      // so I think I'm good to go.
  }

  if (this._useSandbox) {
    return string.Concat("https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=", response.payKey);
  }

    return string.Concat("https://www.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=", response.payKey);

}