File tree Expand file tree Collapse file tree
python/patterns-use-cases/signalspayments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,18 +50,21 @@ async def create_payment_intent(request: dict) -> dict:
5050 ** request_options ,
5151 )
5252
53+ result = payment_intent .to_dict ()
5354 if request .get ("delayed_status" ):
54- payment_intent ["status" ] = "processing"
55+ result ["status" ] = "processing"
5556
56- return payment_intent
57+ return result
5758 except stripe .CardError as error :
5859
5960 if request .get ("delayed_status" ) and error .error and error .error .payment_intent :
60- payment_intent = error .error .payment_intent
61- payment_intent ["status" ] = "processing"
62- return payment_intent
61+ result = error .error .payment_intent . to_dict ()
62+ result ["status" ] = "processing"
63+ return result
6364 else :
64- status = error .error .payment_intent .get ('status' ) if error .error and error .error .payment_intent else "unknown status"
65+ status = "unknown status"
66+ if error .error and error .error .payment_intent :
67+ status = error .error .payment_intent .to_dict ().get ("status" , "unknown status" )
6568 raise TerminalError (f"Payment declined: { status } - { error .user_message } " )
6669 except Exception as error :
6770 raise error
You can’t perform that action at this time.
0 commit comments