dualcube / moodle-enrol_stripepayment

Moodle Stripe Payment Collector
16 stars 27 forks source link

Invalid token on payment #138

Closed jonnoconn closed 6 months ago

jonnoconn commented 6 months ago

Hi, I'm getting an error after payment:

{
    "exception": "moodle_exception",
    "errorcode": "invalidtoken",
    "message": "Invalid token - token not found"
}

That appears directly after the payment window. Stripe does take the payment (I've checked with live accounts).

Some settings:

Ideas suggestions? Most of the documentation I've seen from other issues related to not enabling web services.

moumitahalder commented 6 months ago

@jonnoconn, I'm sorry to hear that you're experiencing this issue.

Based on the error message, it appears that the token you added during the configuration of Stripe may no longer be valid. Could you please refer to our documentation to ensure that the token is added correctly : https://dualcube.com/docs/stripe-payment-with-sca-and-coupon/#3-toc-title

Please do keep us posted.

jonnoconn commented 6 months ago

Firstly, thank you for your patience.

I've been testing different variations of tokens. I've even deleted all payment options and started from scratch. I am just trying to get stripe-payment-with-sca-and-coupon working now. Once that is going, I'm sure the StripePaymentPro should be fine. Some quick notes:

Some more on my setup:

Something else I've noticed going through the stripe logs: When I deep dive into Stripe's logs, I see the specific call that fails to generate a response. Specifically, it says in the logs that the following web hook did not respond (error 404): https://{my_website}/webservice/rest/server.php?<my moodle_enrol_stripepayment token name>&wsfunction=moodle_stripepayment_success_stripe_url&moodlewsrestformat=json&session_id={CHECKOUT_SESSION_ID}&user_id=13&couponid=&instance_id=167

Any ideas?

moumitahalder commented 6 months ago

@jonnoconn as you can see you we are able to successfully place 10% coupon code : http://tinyurl.com/ytcb72os'

User is able to access the course also : http://tinyurl.com/2x7ebol3

Now as you are facing this issue, please do contact use here , so we can assist you with this.

jonnoconn commented 6 months ago

ok, solved the problem. It had to do with tokens. I am not sure why I was seeing this error.

It FAILED when:

It WORKED when:

Advice for future users If anyone encounters this problem in the future, create a new admin account specifically for token creation, and create the tokens using that account.

jonnoconn commented 6 months ago

Closed as I resolved the problem. Thank's to the team at Duel Cube who were patient and helpful.