Configuring Web Payments SDK in Apache 2.4 instead of npm

Hi all - trying to set up a simple sandbox payment form and following instructions located here:

However I’m setting this up on Apache 2.4, not using npm. After cloning the git repository I configured Apache to point to web-payments-quickstart/public as the document root. It loads the index.html page, but my console indicates a ‘401 Unauthorized’ error on this page:

https://squareup.com/1.0/as-reporter/csp/H1RIu78lArbEkNnMnJ_Dc3rlPQ8hFsEvQGLIzjtY

I’ve tried copying web-payments-quickstart/server.js and web-payments-quickstart/package.json to the web-payments-quickstart/public dir and changing the .env.sandbox location in web-payments-quickstart/server/config.js to the absolute path but I suspect the server is not even reading the web-payments-quickstart/server directory at all since it’s not in the document root.

I’ve looked around for a tutorial on getting the example/sandbox running on Apache but have not been able to locate anything, all the examples seem to use npm as the Webserver. Any suggestions?

:wave: With the quickstart if you’re not using npm then you will need to build your own payment processing with Apache. Unfortunately we don’t have any examples using Apache. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. :slightly_smiling_face:

Hi Bryan - Thank you for your response. I’m more than happy to help out w/ this task, but I need to get the basic example site working so I can better understand what’s going on w/ all the js code and JSON requests. A good start would be understanding how files like .env.sandbox and the server/*.js config files are read/loaded. Is there someone I can schedule a call w/ to try and hash this out?

My client is switching to Square for payment processing but I’m not willing to implement anything on my server until I’ve audited the code and have a full understanding of how it works.

Once I’ve crossed that bridge I’ll probably submit a Perl module to CPAN since there’s no API’s on the Square site for Perl and no modules (that I can find) seem to exist on CPAN. I’ve found this forum post:

and this one:

so I understand I need to pass JSON constructs around and use the REST API and am not unfamiliar w/ doing either. I just want to get the example code working as a first step…

I’m happy to hop on a call to further discuss. Feel free to message me to set something up :slightly_smiling_face: