concretecms-community-store / community_store_stripe

Stripe payment add-on for Community Store for concrete5
MIT License
7 stars 2 forks source link

Seems broken after upgrade? #16

Closed katalysis closed 5 years ago

katalysis commented 5 years ago

I've updated c5 and Community Store to latest versions (8.4.3 and 1.4.2) and Stripe payments have stopped working.

Error on screen: Something went wrong with this transaction.

In the Stripe Logs:

The request POST body looks like this: { "amount": "100", "currency": "GBP" }

And the RESPONSE body:

{ "error": { "code": "parameter_missing", "doc_url": "https://stripe.com/docs/error-codes/parameter-missing", "message": "Must provide source or customer.", "type": "invalid_request_error" } }

Looks as if we no longer send the customer data through?

Mesuva commented 5 years ago

I just tested on a 8.4.3 site, with the latest community_store_stripe from master, both the button and the form worked correctly for me.

In terms of customer data, it doesn't send that through as such, I think it's referring to the 'source' being missing, which in this case is the token that comes from the form.

Are you using the button or the form in this case? Are there any javascript errors on submit of the CC form?

katalysis commented 5 years ago

You're right it is a js error.

It's related to another problem I had when switch URLs to have trailing slashes in config.

The URL https://www.zoejenkinsart.co.uk/packages/community_store_stripe/js/jquery.payment.min.js/

Does not load with the trailing slash in place.

Mesuva commented 5 years ago

It's a bit hacky, but what if you tried replacing line 2 in elements/strip/stripe_form.php with this: <script src="<?= str_replace('/index.php/', '/', rtrim(URL::to('packages/community_store_stripe/js/jquery.payment.min.js'), '/')); ?>"></script>

katalysis commented 5 years ago

That works - thank you

Mesuva commented 5 years ago

Great, I've pushed up that as a fix to the master branch. I can't think of a better way to handle it.