Python and Square Payment Form in Windows

Hi, Everyone.

I’ve been working with the payment for walkthrough and everything was looking good. Unfortunately, I’m really stuck now trying to integrate Square payment into our website. I’ve been trying to use some of the connect-api-examples from github but most of these seem to be only “pieces” of what I need.

Does anyone know where I can find a complete example to follow to get the Square payments form working in Python in Windows?

Thanks very much for any help you can offer, it is very much appreciated.

Hi @mkleinsdf, welcome to the forums!

Here is a complete working example of Python with Square Payment form, and creating the payment: https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/python_payment. If you’re still having trouble, or you have further questions or concerns, let me know!

Thanks very much, Stephen. I tried to use the HTML, JS and CSS from the example but I just don’t know how to put it together into a working page. (Unfortunately my experience with HTML, etc. is very limited.)

Thanks again for pointing me to the examples.

The README of the example should be everything you need to do to get it up and running, are you running into any errors? To be clear, the payment form completely relies on Javascript, and if you want to customize it, you’ll need to use CSS/JS.

If you prefer something that doesn’t require coding, feel free to take a look at Square Checkout Links, or our App Marketplace.

Thanks again for the help. Does Square provide any type of hourly consulting that we could use to get the Square payment form running in our application?

No, unfortunately not. We can help with directly working with APIs, but if it’s more programming in general, that’s outside of our scope of support unfortunately.

Trying to call the “process_card.py” provided in the example. (Renamed it as “process_payment.py”.) I have been able to run other Python scripts as CGI on the server, but am not sure why the Javascript isn’t able to find the process_payment.py being referenced by the Javascript “fetch” as shown here:

fetch(’/cgi/process_payment.py’, {
method: ‘POST’,
//credentials: ‘same-origin’,
credentials: ‘include’,
headers: {
‘X-CSRFToken’: csrfToken,
‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’
},
body: JSON.stringify({
nonce: nonce,
idempotency_key: idempotency_key,
total_amount: 100, // amount in cents (or smallest denomination of the currency)
total_amount_currency: ‘USD’ // ISO 4217 formatted currency code
//location_id: locationID
})
})

I have checked permissions on the “cgi” folder, and this folder is also set up in IIS as a subfolder of the Python/Django website.

Thanks very much for any help you might be able to provide on this.