Obtaining relevant data when processing PayPal order Django - 30

Let's talk about the most important data that we should record.

The next thing I want to talk about is the relevant data that we can get to record so for this it is also important we are going to do the test before that I am going to reload the page here the same one that I processed in the previous class and look at the message that it is going to give you notice that it is different in this case as a day has already passed because I am recording this the next day it seems to indicate that the resource has not been found but what I wanted to get to that right now we are going to do that test a little better since I am going to do it at the same time is that this process of verifying the order can only be done once since not only is it verified and data is given about it but also as I mentioned before the order is completed therefore if you try to complete an already completed order it will give you a message there let's see it it was simply so that you have it in mind so I am going to have this page here I am going to process it again we click Login and we go again to what I wanted to talk about at the beginning to see what data we have here in a relevant way let's see if we can get them here we have the order Note that it is different from the one above, here it clearly indicates that the resource has not been found in this case, apparently if they are evidence it seems that they expire, here we have the data:

return render(request,'elements/capture_payment.html', {'res': res, 
    'id': res['id'], 
    'status': res['status'], 
    'price': res['purchase_units'][0]['payments']['captures'][0]['amount']['value']})
  • The status is what we are going to need first, the response also comes in a JSON.
  • Mount
  • ID

So the next thing would be the ID here by the way that I saw it here we are going to get that information it is the same as we did above here it would be a json type response and we print what we are interested in I am going to cut this from here since we are not interested in making this print here you can now clean this code if you left any print or something and leave it there

If you want to take this system real I recommend that you save this whole trace in a separate field as well I mention this to you this way because although we are here Making a kind of online store I am really more interested in implementing a bit of the initial logic and also the payment gateways and the saved part of data and all that we already saw So I do not see the need to be redundant on the same thing I simply give you a recommendation

- Andrés Cruz

En español

This material is part of my complete course and book; You can purchase them from the books and/or courses section, Curso y Libro desarrollo web con Django 5 y Python 3 + integración con Vue 3, Bootstrap y Alpine.js.

Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.