How are ePayments being handled with database writes?

  • I would like to hear how you are handling ePayments and database transactions. Specifically when the payment vendor is being called. Here are some questions which come to mind:

    1. Is the payment process detached from the database updates?

    2. Are all transactions being written to the database first, then the payment vendor is called to process the total amount from the transaction? In this case, what happens when the payment fails?

    3. Is the payment process part of the database transaction.

    4. Do you process the money first, then do the database transactions? In this case, if the db transaction fails you then have to issue a credit.

    Are there any recommendations for handling payments and database transactions?

    Let me add that a shopping cart is involved, so several items may be paid for at once.

    thanks

  • I've done this two ways. Note that this was relatively low volume, but it worked in each case.

    1. We process the order and load into the DB. Meaning everything is stored in our database, but the order is "pending." The application then sends a note for payment processing and receives success/failure.

    2. The application keeps all session in memory, calls the payment processor, notes a positive result and then stores in the dB.

    I prefer #1 because if the payment fails, or the web server explodes or something else, we have the order still marked in the database. The user has a chance to resubmit without redoing their order. Note that inventory becomes an issue. You don't want to deduct from it until payment is received, but you also don't want to be "out of stock" once the payment processes. Typically what I believe happens is that you time stamp the order and inventory is deducted for xx minutes. If that time passes (need a process to check this), the order is suspended or removed and the inventory is put back.

  • Thanks, Steve.

    #1 seems reasonable. If one of the cart items fails to process, you then wouldn't submit this as part of the payment which would eliminate a "credit" issue.

  • Be sure you walk through all failure scenarios and then make sure you have enough flags in your order details to handle the possible places where you need to keep the status of each item. Especially if you have multiple payment processors.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply