Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent double-submission of a payment form #122

Open
toomuchpete opened this issue Sep 9, 2016 · 1 comment
Open

Prevent double-submission of a payment form #122

toomuchpete opened this issue Sep 9, 2016 · 1 comment

Comments

@toomuchpete
Copy link
Member

toomuchpete commented Sep 9, 2016

Sometimes our users get impatient when they're paying for their leagues and click the "Pay" button twice, which causes them to pay for the league twice. We should probably approach this from a two angles.

  1. On the front-end, we should try to prevent this from happening in the first place, see here for some info on how others have solved this problem.
  2. Our back-end code should try to ensure that it is only executing a payment once.

Payment front-end can be found in the Registration Controller's Pay view, while processing code can be found in the Payments Controller.

To get this working in a local environment, you'll need a Braintree sandbox account. Those keys can be placed in the .env file, like so:

braintree_environment: development
braintree_merchant_id: MERCHANT_ID_HERE
braintree_public_key: PUB_KEY_HERE
braintree_private_key: PRIVATE_KEY_HERE
braintree_cse_key: HUGE_LONG_CSE_KEY_HERE
@toomuchpete toomuchpete changed the title Keep people from clicking "pay" twice Prevent double-submission of a payment form Jan 14, 2017
@toomuchpete
Copy link
Member Author

A recent commit added an order_id to the payments controller, thereby making it much more difficult to double-pay, but we'll still want to make sure double-clicking doesn't cause problems.

For example, if a user double-clicks, does their payment go through (because of the first click), but then get shown an error because of the last one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant