0

I need to build a custom form to collect card details using Stripe.

The form will allow users to enroll in a free trial. The form will collect customers card information without immediately charging them. Then after 7 days, we will charge them the full course amount.


Current behavior:


  1. Visitors select the course 
2) Create an account
  2. They are redirected to the free course page



Desired behavior: 
1) Visitors select the course 
2) Create an account 3) Enter their payment info (here the custom form collects payment info, creates a new customer on stripe with their card info) 
4) They are redirected to the free course page
 5) after 7 days if customer hasn’t cancelled trial we bill then the full course amount.

Here is a Stripe guide for how to save clients payment info: https://stripe.com/docs/payments/quickstart?lang=node

Here is Squarespace Development Platform: https://developers.squarespace.com/quick-start

2
  • "Squarespace has limitations on the type of server-side code you can run for security and stability reasons." .. so the official answer is "maybe". Commented Jan 24 at 20:18
  • You should ask Squarespace's support team if you need clarification on what they support. I found "Squarespace doesn’t support server-side code, including PHP, Ruby, Ruby on Rails, and SQL" from support.squarespace.com/hc/en-us/articles/…
    – Nolan H
    Commented Jan 24 at 20:30

1 Answer 1

1

Squarespace doesn't support any server-side/back-end code; it only supports the front-end addition of HTML, CSS and Javascript within Code Injection, Code Blocks, and Developer Mode.

Squarespace can host the custom form itself which, along with your Stripe API publishable key, can be added via HTML, CSS and JavaScript, either via Code Injection, Dev. Mode or Code Block. But you'd need another server/cloud-function setup outside of Squarespace which would communicate with the Stripe API using your secret key to create sessions, customers, etc. You cannot do that part securely from the front-end alone (and since Squarespace doesn't support server-side/back-end code, you must have another service available to do that).

As an aside, putting a website in Developer Mode (A.K.A using the Developer Platform) does not enable the use of server-side code. It just gives a bit more access to the "surrounding" front-end template files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.