Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6888253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:59:17+00:00 2026-05-27T05:59:17+00:00

Below is a simplified version of a sign-up page I’m working on. When the

  • 0

Below is a simplified version of a sign-up page I’m working on.

When the user clicks the button I need to collect money from a credit card. Then, if the transaction is successful, create the new user account.

My problem is handling the scenario where the credit card transaction succeeds but then the create-user transaction fails. If the user needs to correct some information in the form I don’t want to charge their card again.
My PaymentStatus variable contains a 1 or a 0 depending on whether or not the transaction succeeds.

Will this persist across multiple button clicks? And if it does, is this a reliable way of avoiding duplicate transactions in scenarios where the user needs to correct some data in the form?
I could persist the information to the database, but my preference would be to do that later in the transaction when there exists a UserID to associate the payment with.

protected void btn_Click(object sender, ImageClickEventArgs e)
{
    int PaymentStatus = ChargeCardForSignUpFee(userInfo);

    if (PaymentStatus == 0)
    {
         Label1.Text = "Your credit card is invalid.  Please try again.";
    }
    else
    {

        try
        {
        MembershipUser newUser = Membership.CreateUser(userInfo);
            if (newUser == null)
            {
                lblStatus.Text = GetErrorMessage(status);
            }
            else
            {
                CreateCustomer(userInfo);
                SendWelcomeEmail(userInfo.email);
                FormsAuthentication.SetAuthCookie(userName, true);

                Response.Redirect("welcomepage.aspx");
            }
        }
        catch
        {
            lblStatus.Text = "An error occurred while creating your account. "+
                "Please check your information and try again. "+ 
                ex.Message;
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:59:18+00:00Added an answer on May 27, 2026 at 5:59 am

    Validate the data first, then charge the card. It doesn’t make sense to charge the card before validating the data.

    Also, save the data to the database before charging the card.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The screen shot below is of a simplified version of the application from the
Below is a simplified version of a segment of code that I'm working on
The code below is a simplified version of my website. On my site, the
I have below a working query that needs to be simplified. The reason is
I have a simple macro (simplified version below). At the moment it assumes that
Below is an over-simplified version of table I'm using: fruits +-------+---------+ | id |
Ok, here is setup. Note the code below is SIMPLIFIED version. PHP 5.2 ENGINE:
The code below is a simplified version of the pattern my project is using.
Here is a simplified version of a consider the data structure below in Matlab:
Here is a simplified version of the code I'm working on. main :: IO

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.