Connect API Quickstart Problems and more

I am developing a web app on AWS and I was hoping that integrating Square into my Lambdas would be easy but I am struggling. Getting the sample code to work was torture.


DO NOT run out of the box – you must manually edit the Python 3.8 libs or they both throw errors.


To fix, remove allowed_methods=retry_methods from http_client initializations

But even when I finally got them to work - I realized I don’t need them. I need the kind of solution found in

To sign up a seller I need to implement:





and for the buyer I need:


Chalice and Flask and Square itself all have to be imported into my lambdas. I cannot even get a successful Docker deployment to AWS. I am in configuration hell.

Are there any resources for developers like me? Are there any software packages that provide the glue?

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Python SDK
Square SDKs
Get Started

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

I understand your frustration and I’m sorry to hear that you’re having trouble. Unfortunately, there isn’t a pre-built software package that provides the exact functionality you’re looking for. However, I can provide some guidance on how you might approach this.

For the seller endpoints (/api/authorize, /api/authorize-callback, /api/revokeOAuthToken/{merchant_id}, /api/checkAccessTokenStatus/{merchant_id}), you would need to implement the OAuth flow. This involves redirecting the seller to Square’s OAuth page, handling the callback to receive the authorization code, and then exchanging that code for an access token. The access token can then be used to make API calls on behalf of the seller. The /api/revokeOAuthToken/{merchant_id} and /api/checkAccessTokenStatus/{merchant_id} endpoints would involve making calls to the RevokeToken and ObtainToken endpoints of the Square OAuth API respectively.

For the buyer endpoint (checkout-api/create-payment-link), you would need to create a payment using the Square Payments API, and then generate a payment link that the buyer can use to complete the payment.

As for deploying to AWS, you might find AWS’s own documentation on deploying Python applications helpful. They have guides on deploying both Flask and Chalice applications to AWS Lambda.

Remember, when working with these APIs, you’ll need to handle errors and edge cases, such as what to do if the seller denies authorization, or if a payment fails. You’ll also need to securely store and handle access tokens, as they allow access to the seller’s Square account.

I hope this gives you a starting point. Developing this kind of integration can be complex, but with careful planning and testing, it’s definitely achievable. Good luck with your project!

This answer was reviewed by @Bryan-Square.