0 Replies Latest reply on Sep 10, 2007 10:16 PM by matt.drees

    credit card transactions with Seam

    matt.drees

      I need to implement credit card transactions using authorize.net. I wanted to ask if anyone had feedback on the approach I'm planning to use, because I'm a relatively young developer and this is a pretty important thing to get right, and there are many smart and experienced people here.

      I would have an action method (in a conversation-scoped bean) that looks something like this:

      public void processPayment() {
       //execute an AUTH_ONLY request, which checks funds availability etc, but doesn't transfer funds, and returns an authcode
       if (successful) {
       //create payment record (with authcode) and persist to DB. Store transaction id locally for capture step.
       raiseTransactionSuccessEvent("creditCardSuccess");
       } else {
       //prompt user for corrected info or show error screen as appropriate
       }
      }
      
      @Observer("creditCardSuccess")
      public void capturePayment() {
       //execute a PRIOR_AUTH_CAPTURE request, which does the transfer, using the stored transaction id
       if (successful) {
       //don't do much except log a success
       } else {
       //email the admin notifying him/her of failure. Admin would probably need to manually trigger a capture.
       }
      }
      


      The idea is I don't want to charge the user unless I know I have a record of their payment, so I wait until the transaction completes successfully.
      I've not done too much with transaction-aware code, but I think I'm using it correctly. Does this seem reasonable? Thanks for your time.