C# 错误:贝宝:需要道具:付款

C# 错误:贝宝:需要道具:付款,c#,model-view-controller,paypal,C#,Model View Controller,Paypal,我遇到了一个我不完全理解的问题。以下是PayPal开发者网站上的演示: 我在这篇文章的标题中遇到了错误 下面是一些代码示例 客户端: 支付:功能{ // Make a call to the merchant server to set up the payment return paypal.request.post('My/api/call').then(function (res) { return res.token;

我遇到了一个我不完全理解的问题。以下是PayPal开发者网站上的演示:

我在这篇文章的标题中遇到了错误

下面是一些代码示例 客户端: 支付:功能{

        // Make a call to the merchant server to set up the payment

        return paypal.request.post('My/api/call').then(function (res) {

            return res.token;
        });
    },
服务器端my/api/call

var createdPayment = payment.Create(apiContext);

return createdPayment;
我正在使用PayPal NET SDK创建这些对象,并将它们返回给PayPal似乎可以接受的对象,直到返回响应。我认为,PayPal的演示代码意味着返回了一个支付对象。这就是我从服务器返回的对象PayPal通过api调用为其提供了一个ID、一个令牌等,并授予了令牌是不同的。有人知道可能发生了什么吗

谢谢

编辑:Asa per request此处是付款方式。创建方法

/// <summary>
    /// Creates and processes a payment. In the JSON request body, include a `payment` object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the `payment` object.
    /// </summary>
    /// <param name="apiContext">APIContext used for the API call.</param>
    /// <returns>Payment</returns>
    public Payment Create(APIContext apiContext)
    {
        return Payment.Create(apiContext, this);
    }

    /// <summary>
    /// Creates (and processes) a new Payment Resource.
    /// </summary>
    /// <param name="apiContext">APIContext used for the API call.</param>
    /// <param name="payment">Payment object to be used in creating the PayPal resource.</param>
    /// <returns>Payment</returns>
    public static Payment Create(APIContext apiContext, Payment payment)
    {
        // Validate the arguments to be used in the request
        ArgumentValidator.ValidateAndSetupAPIContext(apiContext);

        // Configure and send the request
        var resourcePath = "v1/payments/payment";
        var resource = PayPalResource.ConfigureAndExecute<Payment>(apiContext, HttpMethod.POST, resourcePath, payment.ConvertToJson());
        resource.token = resource.GetTokenFromApprovalUrl();
        return resource;
    }

您需要以字符串形式返回EC-XXXXXXXX令牌或PAY-XXXXXX id,而不是整个支付对象。

能否显示支付代码。创建方法?在OPI中共享代码尝试了您的建议,但我随后收到错误:Prop不是字符串类型:payment演示说明了什么?您可以共享新代码吗ing?它肯定需要一个字符串-您是否在返回字符串之前进行控制台日志记录以确保该字符串已填充?我错误地解释了“调用商户服务器以设置支付”,代码似乎需要一个具有属性“payToken”的对象。尽管如此,我还是尝试返回字符串。请参阅上面注释中的错误。谢谢你的时间。我刚刚重试了你的建议,效果很好。我的页面上可能缓存了一些内容,我很抱歉。谢谢你的帮助!