dualcube / moodle-enrol_stripepayment

Moodle Stripe Payment Collector
16 stars 27 forks source link

Submit Payment button not working #42

Closed PetrMoodle closed 3 years ago

PetrMoodle commented 4 years ago

Hi DualCube Team, I am trying to test a transaction using this Stripe plugin but for some reason when I click on the Submit Payment button on the course page nothing happens. I believe I am following the install instructions step by step for the Moodle side and also for the Stripe account side so I am not sure what I am missing. I have tried with both a test API and live API codes, I have changed themes to avoid conflicts, and several other settings. What is strange is that the coupon feature is working correctly but clicking Submit Payment does not, the page doesn't even refresh or trigger an error as if the button is disabled.

Could you please let me know what I should try to troubleshoot the issue. I am using Moodle 3.7.

muzetik commented 4 years ago

Hi, same thing here, nothing happens when Submit payment is clicked since latest version (06/08/2020) with latest moodle (git).

muzetik commented 4 years ago

Hi, same thing here, nothing happens when Submit payment is clicked since latest version (06/08/2020) with latest moodle (git).

latest update on postal code check is the cause, I reverted this modification and the Submit payment button is working again.

trideepdm commented 4 years ago

Dear user, postal code is now a mandatory field for Stripe Payment. So, make sure you have to give a postal code for every transaction. Once you give valid card details with postal code then only the Submit payment button is working.

PetrMoodle commented 4 years ago

Dear user, postal code is now a mandatory field for Stripe Payment. So, make sure you have to give a postal code for every transaction. Once you give valid card details with postal code then only the Submit payment button is working.

Hi trideepdm, I cannot see a post code field in the payment screen (see screenshot attached), just a the card number, date and cvc. Or do you mean a post code needs to be added in the Stripe account not in Moodle?

image

trideepdm commented 4 years ago

Dear PetrMoodle,

Once you start filling your card details then the postal code field is automatically created at the last field as ZIP. Please have a look at the attachment.

Thank you. Screenshot from 2020-08-10 10-19-59

PetrMoodle commented 4 years ago

Hi trideepdm, no that isn't appearing unfortunately, please see screenshot. Even if I try using a real card number and details it still doesn't show.

image

trideepdm commented 4 years ago

Dear PetrMoodle,

As I can see on your screenshot that is not valid card detail that's the reason the postal code isn't appearing. Please use valid card details then only the postal code is appearing. You can also look at my previous screenshot as that has valid card details so the postal code is showing also the font color was black where your invalid card details in red. Hope you understand the differences. For further details about valid test card details please have a look https://stripe.com/docs/testing

muzetik commented 4 years ago

Hi, zip code does not show even with valid card. Le 10 août 2020 10:21, trideepdm notifications@github.com a écrit : Dear PetrMoodle, As I can see on your screenshot that is not valid card detail that's the reason the postal code isn't appearing. Please use valid card details then only the postal code is appearing. You can also look at my previous screenshot as that has valid card details so the postal code is showing also the font color was black where your invalid card details in red. Hope you understand the differences. For further details about valid test card details please have a look https://stripe.com/docs/testing

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

PetrMoodle commented 4 years ago

Hi trideepdm, as I said and as muzitek also mentioned, even when I used valid card details the zip code still isn't showing.

elisoulsafe commented 4 years ago

Edit/added = The issue I describe below has now been fixed.

The ZIP field only appears when using USA credit card numbers, when you use credit card numbers from any other location the ZIP field does not appear making it impossible to proceed with payments from cards outside of USA.

You can confirm this by using any of these basic test numbers: https://stripe.com/docs/testing Try using any of these numbers: https://stripe.com/docs/testing#cards Then try Europe or Asia-Pacific cards here: https://stripe.com/docs/testing#international-cards

As you can see the ZIP field only appears when USA cards are entered. The issue is (a very stupid) IF statement inside the enrol.php file under /enrol/stripepayment: Lines 171 to 177

  if ((typeof(postal) != "undefined" && postal !== null && postal.length > 0)) {
    if (event.error) {
      status = 0;
    } else {
      status = 1;
    }
  }

This if statement will always run, and because the ZIP field only appears when using USA cards, then all other cards will make this if statement set status to 0.

albertopampin commented 4 years ago

Duplicate of #

Edit/added = The issue I describe below has now been fixed.

The ZIP field only appears when using USA credit card numbers, when you use credit card numbers from any other location the ZIP field does not appear making it impossible to proceed with payments from cards outside of USA.

You can confirm this by using any of these basic test numbers: https://stripe.com/docs/testing Try using any of these numbers: https://stripe.com/docs/testing#cards Then try Europe or Asia-Pacific cards here: https://stripe.com/docs/testing#international-cards

As you can see the ZIP field only appears when USA cards are entered. The issue is (a very stupid) IF statement inside the enrol.php file under /enrol/stripepayment: Lines 171 to 177

  if ((typeof(postal) != "undefined" && postal !== null && postal.length > 0)) {
    if (event.error) {
      status = 0;
    } else {
      status = 1;
    }
  }

This if statement will always run, and because the ZIP field only appears when using USA cards, then all other cards will make this if statement set status to 0.

what is the best solution for this case? I change the zip code to var

var status = 1; var postal = '99501'; Is this Ok? I am from Spain. Thank you

elisoulsafe commented 4 years ago

my original post...

what is the best solution for this case? I change the zip code to var

var status = 1; var postal = '99501'; Is this Ok? I am from Spain. Thank you

This should be fixed with the new update from dualcupe .. at least it is for me. You could simply comment out that if statement and hard code the status to be 1 :P but I recommend just updating the plugin..