K
K
karkov2019-05-04 22:19:40
PostgreSQL
karkov, 2019-05-04 22:19:40

How to organize a database schema for storing payment?

Hello! I am implementing online payment through Sberbank on the site and a question arose about the competent organization of the database scheme.
There is the following scheme of action:
There is a transport with 7 seats, the user wants to pay for a seat in it. Before generating the payment form, the availability of seats is checked on the server, then the payment form is generated and redirected to the Sberbank payment page. The payment table contains the user ID, the transport ID for which he pays, and the Sberbank token.
After successful payment, the user is redirected to the specified link and I can get the transport for which he pays and the user himself using the token and then make the user-transport in the database. But what if 7 people have already registered before that? It turns out that the user will pay, but there is no place.
Could you tell me how to properly organize the database with the reservation at the time of payment?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question