Setting up for taking payments through Stripe


(Ben Chapman) #1

Matrix Version: 5.4.0.2

So I am starting a new Matrix journey. A client has asked me to set up a website for a conference and they want to take payments for registration by credit card. The options for taking payments through the payment gateways that are built into Matrix (PayPal or Payment Express) are not suitable for us. So the client has asked that I use Stripe.

Stripe does look very good. It has a good API that I have been informed should be accessible to Matrix through REST.

So that is where I am just now. I want to set up a registration form for a conference that includes, at some step along the way, payment by Stripe. In front of me I have the documentation for the Matrix REST resources assets and the Stripe documentation, and from these I am trying to make a plan.

Has anyone here set up a payment system in Matrix using Stripe?

How should I implement this payment system? Can I set it up as a custom form with a “call REST resource” submission action? Or is there some way of implementing this just using Stripe’s tools?

I would be grateful for any help with this. Thanks.


(Tim Trodd) #2

Hi,

I have never used Stripe but have used Braintree which matrix has connectors for. Are you able to use Braintree instead? it allows for card payments and the rates/fees I believe are around the same as Stripe.

Tim


(Bart Banda) #3

Yes, you can use the send REST submission action together with a custom form to do the integration call to Stripe. I’ve done this before.

You just have to customise the Confirmation screen on the Custom Form with the JS that Stripe gives you here https://stripe.com/docs/checkout#integration

Then use the token that that generates as a POST request in the submission action as well.

Hope that helps.


(Ben Chapman) #4

Thanks for all that Bart. I worked with it and put together a POST to https://api.stripe.com/v1/charges with the appropriate request data and I appear to have it working. I can’t fully verify that it’s working correctly because my charge requests are being rejected for being sent over an old version of TLS, but they are at least getting through to Stripe.

I think this would make a good tutorial.


(Ben Chapman) #5

Hi Tom.

I did give Braintree a go for another project some time back but I was never able to get it to work in test mode so I didn’t give it much consideration for my current project.

I have previously set up an ecommerce system in Matrix using Payment Express, but that had a major headache in that because it is a merchant-hosted method we had to be PCI DSS compliant. I never got far enough through setting up Braintree to find out if this was also going to be a requirement.

Ben.


(Ben Chapman) #6

So I have a follow up question regarding using Stripe.

I have managed to get Stripe working on my website using Bart’s advice. So I am happy with that. However, I would like to offer people the option to pay by internet banking.

As I understand it, the Stripe widget code hijacks the “submit” button, so that the submission has to go through the widget. If I offer the option to pay by internet banking, I would want the user to go straight to the “thank you” page without having to make a credit card payment.

Ideally I would offer this option as the last question, just before the submit button.

Is there some way to bypass the Stripe widget?


(Bart Banda) #7

You should be able to write some JS that changes what the Submit button does perhaps when clicked? Maybe print 2 submit buttons and hide/show each one with JS where each button has a different onclick action? Or where the JS changes the onSubmit action of the itself?


(Ben Chapman) #8

Thanks Bart. That was perfect advice.

Since Stripe had hijacked the type=“submit” buttons, I created a button that did a form.submit() on-click.

Interestingly, Stripe also hijacked the ‘go back’ button, so I had to add a history.back() on-click button too.