I have such a situation right now:
I do the integration of the payment from bitpay, after the invoice is created and the client pays for this invoice, there is a notificationURl at which the notification in the form of json will be received about the payment made.
I made the controller for callbacks, json comes there, let's say it was successfully spent -> the money is credited to the client on the balance and he is given some kind of new preference in connection with payment.
How to notify the user about a successful operation? session? but how to record a session in a specific user? Any ideas? (so that without additional unnecessary fields in the database would like to)
The user id data is obtained from order.user_id by order.invoice_id from json. Eid user there. Developed on laravel 5.3
|
1 answer
The session mechanism is not very suitable for this task for several reasons:
- As soon as the session is completed (or re-created), you will lose the user's data, and he will not be able to continue to use "some new payment preferences." And it depends on the settings of the server and php, which usually do not give control.
- Even if you stop up and want to work through the sessions, then you still can not do without the table in the database, in which you will store user_id and session_id. What would then look for the session file and append data to it (not an option)
Therefore, the question of как записать сессию в определенного пользователя? чтобы без дополнительных ненужных полей в базе данных хотел бы как записать сессию в определенного пользователя? чтобы без дополнительных ненужных полей в базе данных хотел бы answer
I would create a separate payments table, where I would store all user fees and statuses (successfully paid, not enough money, etc.). And you can notify the user himself:
- or using a script that, each time you load the page, would look at the
paymentstable, and if there are successful payments, you would display information about it - either on the client side, it periodically launched ajax payment verification request
- either completely get stuck and do something like long polling
- Yes, I came to a similar conclusion. It is possible to check whether there are views of this "product" - if not, I will show that this product has not even been viewed by the creator and must be issued. Thank you - Igor Kalamurda
|