[英]ERROR: PayPal: Prop is required: payment
我遇到了一個我不完全理解的問題。 在PayPal開發人員網站上進行以下演示: https : //developer.paypal.com/demo/checkout/#/pattern/server
我在這篇文章的標題中遇到了錯誤。
以下是客戶端的一些代碼示例:付款:function(){
// 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;
});
},
服務器端(我/ api /通話)
var createdPayment = payment.Create(apiContext);
return createdPayment;
我正在使用PayPal-NET-SDK創建這些對象,並將它們返回到PayPal似乎還可以的狀態,直到返回響應為止。 我認為,貝寶(PayPal)的演示代碼暗示返回了付款對象。 這是我從服務器返回的結果(PayPal從api調用中為其提供了ID,令牌等),但授予的令牌的屬性名稱是不同的。 是否有人對可能發生的事情有任何見解?
謝謝
編輯:Asa每個請求在這里是payment.Create方法
/// <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-XXXXXXX令牌或PAY-XXXXXX id,而不是整個支付對象。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.