我希望能够对运行命令之一来执行 strip 化时发生的错误采取行动。我可以看到该错误,但似乎无法捕获它。
当我运行条纹的ACH付款格式的验证并使用错误的存放者时,出现以下错误:
in handle_error_response
raise err
stripe.error.CardError: Request req_UyfXgBVRSOqUuJ: The amounts provided do not match the amounts that were sent to the bank account.
我该如何接受并做一些有意义的事情。我的代码如下所示:
ank_account_response = customer.sources.retrieve(request.stripe_id)
bank_account_response.verify(amounts=[request._post['deposit_1'], request._post['deposit_2']])
错误出现在代码的最后一行。我想要么做一些类似
output = bank_account_response.verify...
或try: bank_account_response
的操作,但是我无法使其正常工作。有什么想法吗?
最佳答案
您应该处理类似以下的错误响应。
try:
bank_account_response.verify(amounts=[request._post['deposit_1'], request._post['deposit_2']])
except CARD_ERROR as card_error:
return JsonResponse(status_code=400,
message=card_error.message)
关于django - Django : How to next process Stripe's ACH Verification Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50594202/