top of page

Integrate Square's API for Wix Forms, using Velo

Updated: May 31, 2022


Who is our client and what problem did they want to solve?

Our client wanted seamless integration between their Liability Waiver Wix form and their on-premise Square POS system.


Before our client contacted RHM, the process for their customers was to fill out the Liability Waiver on their website prior to arriving at the business. Upon arrival, the desk clerk would then have to manually enter the data from the Liability Waiver form into their Square POS system.


With a quick look into Square's API, we determined that we would be able to automate this process to allow a more seamless workflow.


This would create a better and more efficient experience for both their customers and employees.



What solution did we provide?

We met with our client and had them generate an Access Token for the Square API, which we stored in the Wix Secrets Manager.




After this, we set to work on the page the form was on. Using the Wix Form `onFormSubmitted` method, we were able to gather the data the customers submitted and then pass it to a `createSquareCustomer` function we created in our 'backend/square.jsw' file, .jsw being the file extension Wix uses to allow backend code to be called from the frontend.


This function takes the data about the customer that is passed in and calls Square's Create Customer API using the `fetch` function of the Wix-fetch module.


With this code in place, the customer now has seamless integration between their Liability Waiver form and their Square POS system, saving their desk clerks quite a bit of time through automation as well as preserving data integrity by preventing errors that happen with manual entry of data.



Here's the code we used below:


import { createSquareCustomer } from "backend/square";

import wixLocation from "wix-location";

$w.onReady(function () {
  $w("#multiStepForm1").onWixFormSubmitted(({ fields }) => {
    const customer = {
      address: {},
    };
    console.log(fields);
    fields.forEach((field) => {
      console.log(field);
      switch (field.fieldName) {
        case "Guardian First Name":
          customer.given_name = field.fieldValue;
          break;
        case "Last Name":
          customer.family_name = field.fieldValue;
          break;
        case "Guardian Email":
          customer.email_address = field.fieldValue;
          break;
        case "Guardian Phone":
          customer.phone_number = field.fieldValue;
          break;
        case "House Number & Street":
          customer.address.address_line_1 = field.fieldValue;
          break;
        case "City":
          customer.address.locality = field.fieldValue;
          break;
        case "State":
          customer.address.administrative_district_level_1 = field.fieldValue;
          break;
        case "Zip":
          customer.address.postal_code = field.fieldValue;
          break;
        case "Child/Children's Full Names (":
          customer.note = field.fieldValue;
          break;
      }
    });

    console.log(customer);

    createSquareCustomer(customer);

    setTimeout(() => {
      wixLocation.to(wixLocation.url);
    }, 3000);
  });
});

Have any Wix questions? Contact us at 225-250-1888!



About our company


RHM specializes in helping businesses of all sizes and across all industries achieve their digital and web marketing needs. Whether it's designing a new website, building an app, performing custom development, or running Google Ads, our goal is to showcase how you are the best at what you do and help people connect with you. Contact us at 225-250-1888 to get started!


 
 
 

7 Comments


Eric
Eric
Feb 24

This is a fantastic breakdown of integrating Square with Wix Forms using Velo! The problem of manual data entry is a common one, and it's great to see how you've automated it to improve efficiency and data accuracy. This kind of seamless integration is a game-changer for businesses. If you're looking for other tools to streamline your business operations, you might find Invoice Generator useful for creating professional invoices quickly and easily.

Like

meery232w
Feb 17

Detailed and practical, this guide explains concrete rebar in a way that feels approachable without oversimplifying. The step by step clarity is especially useful for readers new to the subject. I recently came across a construction related explanation on https://hurenberlin.com that offered a similar level of clarity, and this article fits right in with that quality. Great شيخ روحاني resource. explanation feels practical for everyday rauhane users. I checked recommended tools on https://www.eljnoub.com

s3udy

q8yat

elso9

Edited
Like

meery232w
Feb 17

Using technology to increase access to youth mental health support may offer a practical way for young people to reach guidance, safe-spaces, and early help without feeling overwhelmed by traditional systems. Digital platforms, helplines, and apps could give them a chance to seek support privately, connect with trained listeners-orexplore resources that might ease their emotional load. This gentle shift toward tech-based support may encourage youth to open-up at their own pace, especially when in-person help feels too heavy to approach.

There is always a chance that these tools-quietly make support feel closer than before, creating moments where help appears just a tap-Berlinintim away. Even a small digital interaction might bring a sense of comfort. And somewhere in that space, you…

Like

zygekigi
Feb 03

This tutorial was very clear and concise, making API integration with Wix forms much more approachable. I appreciated the step-by-step code examples. I recently came across a similar discussion on a review blog, which mentioned soft tools like https://southerndry.com/ for workflow optimization, offering an interesting perspective on streamlining online processes.

Like

This is a fantastic real-world example of how Velo can be used to solve a common business problem! The clear explanation of integrating Square's API with Wix forms for seamless customer data entry is truly insightful. Automating the liability waiver process not only saves significant time for desk clerks but also greatly enhances data integrity by eliminating manual errors. It's a prime illustration of how well-thought-out custom development can streamline operations. For anyone looking for innovative digital tools, I'd also recommend checking out Video to Prompt Generator for its AI-powered video analysis capabilities. Great work demonstrating practical solutions!

Like
bottom of page