jeudi 18 avril 2019

How to keep an Object between calls without using sessions in Django?

I'm configuring MangoPay for my web application and it's now time for credit card registration. I'm using the python SDK that MangoPay recommends. The workflow requires a CardRegistration to be created on the backend, which can be used to generate a form in the front end. On this form the user adds the credit card details, which are sent to a 3rd party tokenisation service and returned to the users front end. This token can be sent now to my backend and, added to the CardRegistration object, can be saved enabling the card for the user.

My issue is that I don't know how to store CardRegistration object between calls in the backend while I wait for the user to generate the token and return it.

Sessions can not be used, as the preregistration object contains sensitive data. To prove if it would have worked and I tried to use pickle but it raises a PicklingError, so serialization and storage doesn't look like an option either.

What should I look into? Is there some kind of design pattern I can use to store the object quickly for retrieval?

Aucun commentaire:

Enregistrer un commentaire