Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# PayPal计费协议-计划Id.NET无效_C#_Asp.net Mvc_Paypal_Paypal Rest Sdk - Fatal编程技术网

C# PayPal计费协议-计划Id.NET无效

C# PayPal计费协议-计划Id.NET无效,c#,asp.net-mvc,paypal,paypal-rest-sdk,C#,Asp.net Mvc,Paypal,Paypal Rest Sdk,我正在尝试使用.NET SDK在PayPal中创建一个新协议,但是当我将我的协议发送到PayPal API以及我的计划和协议详细信息时,我收到一个400错误请求错误。经过进一步调查,我发现这是因为计划Id无效,但我不知道为什么会这样,因为我已经在模型中、在BillingPlansController和PayPal仪表板中创建了它 这是来自PayPal API的Json响应: { "name":"TEMPLATE_ID_INVALID", "debug_id":"9e24570510a

我正在尝试使用.NET SDK在PayPal中创建一个新协议,但是当我将我的协议发送到PayPal API以及我的计划和协议详细信息时,我收到一个
400错误请求
错误。经过进一步调查,我发现这是因为
计划Id
无效,但我不知道为什么会这样,因为我已经在模型中、在
BillingPlansController
和PayPal仪表板中创建了它

这是来自PayPal API的Json响应:

{
   "name":"TEMPLATE_ID_INVALID",
   "debug_id":"9e24570510a3e",
   "message":"",
   "information_link":"https://developer.paypal.com/docs/api/payments.billing-agreements#errors",
   "details":[
      {
         "field":"validation_error",
         "issue":"Incorrect Plan Id."
      }
   ]
}
这是我的
计划
模型,我在其中创建了要在应用程序中使用的计划

public class Plan
{
   public string PayPalPlanId { get; set; }
   public string Name { get; set; }
   public decimal Price { get; set; }
   public int NumberOfEmployees { get; set; }
   public string Description { get; set; }
   public static List<Plan> Plans => new List<Plan>()
   {
      new Plan()
      {
          Name = "Starter Subscription",
          Price = 30,
          PayPalPlanId = "P-27H34871BG666983A2CPYWUI",
          NumberOfEmployees = 1,
          Description = "Access to the website for a monthly payment"
      }
   };
}
注意,在上面的代码中,我的控制器中有一个GetAPIContext()方法

这是发送到PayPal API的数据

{
   "name":"Starter Subscription",
   "description":"Access to the website for a monthly payment",
   "start_date":"2020-07-15T12:44:06Z",
   "payer":{
      "payment_method":"paypal",
      "payer_info":{
         "email":"xxxx",
         "first_name":"xxx",
         "last_name":"xxx"
      }
   },
   "plan":{
      "id":"P-4PV26268V7918953BL3S3ZHA"
   }
}

指向GitHub存储库的链接:

看起来PayPal不赞成我使用的API版本

{
   "name":"Starter Subscription",
   "description":"Access to the website for a monthly payment",
   "start_date":"2020-07-15T12:44:06Z",
   "payer":{
      "payment_method":"paypal",
      "payer_info":{
         "email":"xxxx",
         "first_name":"xxx",
         "last_name":"xxx"
      }
   },
   "plan":{
      "id":"P-4PV26268V7918953BL3S3ZHA"
   }
}