I am creating a financial app using django. I want a user can connect to any bank using Plaid and on the UI, we can see the bank account number and balance of the user. I am not sure how to retrieve the dummy bank account number
I tried to connect to any bank using Plaid and I did that successfully. I have my account id and access token
Suppose through app we link our bank account to any of the institution. Now I want to see the bank account number which I can display on the UI so that user can see already linked bank account.
@csrf_protect
def link_account(request):
context = {}
return render(request, 'mybank/link-account.html', context)
@ensure_csrf_cookie
def create_link_token(request):
user = request.user
if user.is_authenticated:
data = {
'user': {
'client_user_id': str(user.id)
},
'products': ["transactions"],
'client_name': "Budget Bounty",
'country_codes': ['US'],
'language': 'en'
}
response = { 'link_token': client.post('link/token/create', data) }
link_token = response['link_token']
return JsonResponse(link_token)
else:
return HttpResponseRedirect('/')
You can retrieve the bank account number using
/auth/get. However, it is not recommended to use the bank account number returned by/auth/getin a user-facing UI for two reasons.First, it will not provide a good user experience for Chase bank accounts. For security reasons, Chase sends Plaid a tokenized account number that can be used for ACH transactions, instead of the user's actual account number, and the end user will not recognize it because it will not match their actual account number.
Second, if you are using Auth with a processor partner,
/auth/getis not part of your normal flow, and calling/auth/getwhen you don't need to means you then have sensitive information you need to manage.For these reasons, you should instead display the
mask(which is typically the last 4 digits of an account number) to the user instead of the full account number. You can obtain themaskfrom theonSuccesscallback, or by calling/accounts/get.