I made a charge that is creating after pressing the button, and JSON Response is printing with python in my Command Line, how to extract from JSON Response code in order to put in in a redirect link, and redirect the customer on this charge page
url = "https://api.commerce.coinbase.com/charges"
payload = {
"local_price": {
"amount": 0.001,
"currency": "BTC"
},
"name": "Deposit cryptocurrency",
"description": "In order to replenish, you need to deposit your cryptocurrency",
"pricing_type": "fixed_price"
}
headers = {
"accept": "application/json",
"X-CC-Version": "2018-03-22",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
code = { somehow to extract code from upper response }
And here I need to put code in a variable in order to redirect customer to this page
render(request, f'https://commerce.coinbase.com/charges/{code}')