PayPal REST API-沙盒-结算方案

时间:2019-09-05 15:02:55

标签: asp.net-core paypal paypal-sandbox paypal-rest-sdk paypal-subscriptions

我在PayPal开发人员门户上设置了3个“应用”。

我目前正在使用沙盒开发新应用(因此我正在使用其凭据),但是当我调用端点列出所有计费计划时,我也从其他2个应用中获得了计划列表就是这个。

API调用已注册为在新应用程序下。

这是我的代码:

    int statusCode = -1;
    string debugId = "";
    PlanList lstPlans = new PlanList();

    PayPalEnvironment environment = new LiveEnvironment(clientId: clientId, clientSecret: clientSecret);
    if (isSandbox)
    {
        environment = new SandboxEnvironment(clientId: clientId, clientSecret: clientSecret);
    }
    var client = new PayPalHttpClient(environment);

    PlanListRequest request = new PlanListRequest();
    request.TotalRequired("YES");
    request.Status("ALL");
    request.PageSize(limit.ToString());
    request.Page((page - 1).ToString());

    try
    {
        HttpResponse response = await client.Execute<PlanListRequest>(request);
        statusCode = (int)response.StatusCode;

        lstPlans = response.Result<PlanList>();
    }
    catch (HttpException httpException)
    {
        statusCode = (int)httpException.StatusCode;
        debugId = httpException.Headers.GetValues("PayPal-Debug-Id").FirstOrDefault();
    }

我正在使用PayPal 2.0 Beta SDK来实现.NET Core兼容性。

还有其他人遇到这个问题吗?

0 个答案:

没有答案