Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: unique order id

  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    unique order id

    I am integrating an online store with an epayment processing system (HSBC). They asked me to provide as part of every transaction, a unique order id. I need help with that.

    At the moment, I am using php session as a customer id, but I realise this may not be ideal.

    The problem is that I am not inserting any customer or order data into my database until the payment is complete and succesful (i.e. when i recieve the POST data back from HSBC and a flag that payment was succesful).

    My current table structure:

    Product (ProductCode(PK), ProductName, Price)
    Customer (UserId (PK), Name, etc) --> I'm inserting php session as UserId
    Order (OrderId (auto_increment), UserId (FK), date......)
    Order_Item (OrderItemId (auto_increment)(PK), OrderId (PK + FK), ProductCode (PK+FK)....)

    After the payment is succesful, i insert the session id into the UserId, and insert the order and orderItem details.

    Now, I'm not sure how to generate and POST a unique order ID to HSBC before even inserting it into the database. I thought about inserting the order anyway, retrieve the OrderId and POST it with the order to HSBC and if payment successful, leave it there, otherwsie delete. But I don't think this is the best solution and my client agrees.

    I would appreciate any help on:
    - Generating Customer id, other than the session
    - Sending a unique order with the data to HSBC.

    By the way, the customers do not sign up at all even to make a purchase (this is a client requirement)

    many thanks

  • #2
    Regular Coder
    Join Date
    Jun 2007
    Location
    Los Angeles
    Posts
    545
    Thanks
    81
    Thanked 5 Times in 5 Posts
    Trying to determine the session id in mysql prior to doing the insert can be done is not advisable for many reasons so I would not recommend going down that path.

    Instead, why don't you just create a starting cust ID number and keep it in a database and keep inc it as you need one? Pull it out, increment it and then store it back into the DB.
    RalphF
    Business Text Messaging Services
    https://www.MobileTextingService.com

  • #3
    New Coder
    Join Date
    Aug 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rfresh View Post
    Instead, why don't you just create a starting cust ID number and keep it in a database and keep inc it as you need one? Pull it out, increment it and then store it back into the DB.
    i am not sure what you mean, sorry


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •