如何在条纹和格子之间交换public_token

时间:2019-05-13 06:41:37

标签: c# stripe-payments plaid

我有一些下面的代码在条纹和格子之间交换令牌, 但是我的代码抛出错误为bad public_token

在我的C#格子应用程序中,我使用了nugget的以下Package

Install-Package Stripe-Plaid-Link

图书馆参考 https://github.com/asciutto990/Stripe-and-Plaid-Link-.NET

public async Task<ActionResult> PlaidAsync(string account_id, string public_token)
{
    var plaidApi = new PlaidApi();
    try
    {
        var response = await plaidApi.ExchangeTokenAsync(new ExchangeTokenInput
        {
            PublicToken = public_token,
            AccountId = account_id,
        });
        var bankToken = response.StripeBankAccountToken;
        var accountId = response.AccountId;
        var sandbox = response.Sandbox;
        var accessToken = response.AccessToken;
    }
    catch (PlaidException e)
    {
        var errorMessage = e.Message;               
    }
    return View();
}

1 个答案:

答案 0 :(得分:0)

从Plaid API V2(沙盒)开始,请遵循Plaid Doc中给出的6个步骤:https://plaid.com/docs/stripe/#step1

对于步骤3,在调用中添加api版本

apiVersion: 'v2',

此事件成功后,调用格子API https://sandbox.plaid.com/item/public_token/exchange获取访问令牌。

在此之后,调用格子API https://sandbox.plaid.com/processor/stripe/bank_account_token/create以获取银行帐户令牌

有关API的另一参考,请参见 https://documenter.getpostman.com/view/4675947/RWMLHkHR?version=latest#64d97a2b-071b-4826-838c-a8acec7d33ec