Square Payment Integration Guide 10-15-2024
Madeline
Last Update 6 個月前
Squareup payment gateway has been integrated in our system, this article explains how to use this feature.
Step-1 :
To use the Square payment gateway, you’ll first need to create an account on the Square platform. You can sign up here: https://squareup.com/signup/en-us.
Please make sure to provide your personal and business information during the registration process.
Step-2 :
After setting up account, you need to create a app by visiting https://developer.squareup.com/apps

Click on + icon and it will open up the form to get information about the app and then it will show the app credentials to use for integration in our system .
Note : Sandbox version is for testing and use production credentials for live payment collection.
Step-3 :
Get credentials from Square to integrate into our system.

We need the Application ID, Access Token, and Location ID to activate Square payment in our system.
You can view all activities conducted through our system via Square on the following pages:
- Sandbox mode: https://squareupsandbox.com/dashboard/
- Production mode: https://squareup.com/dashboard/
Everything is managed on Square's side.

1- Activate Square Payment on FXMED portal.
First of all, you need to set up the square app credentials, the app you have created on Squareup portal: https://developer.squareup.com/apps . After setting up your Square App on this link note down the Application ID, Access Token and Location ID.
a) Click on Credential tab, A form to get credentials will show up.
b) Add Application ID, Access token and Location Id by getting them from https://developer.squareup.com/apps
c) Add other settings like, email subject, email body, notification channel etc.
d) Check the "is Active?" checkbox and click on "Save" Button.
If your added credentials are valid then the Square Payment Gateway is integrated into the system. Otherwise, it will show error and you need to recheck your credentials.
Each Practice will add its own credentials and for every practice an app on Square side is required to get credentials.

2- Add Subscriptions.
To add a new subscription for Square Payment method, Click on Add Subscriptions tab. Following Form Will show up.
a) Select charges (These Charges are same as on Cerbo side)
b) Next, select the period of payment , Weekly, monthly, yearly etc.
c) Select Start date, The subscription will start on selected date and the payment for the subscription will be charged on the start of this date.
d) Add number of payments and click on "Create Subscription" button
Upon submission, the system will check if a plan with the same information already exists. If it does, the current subscription will use that existing plan. If not, a new plan will be created, and the subscription will be set up using this newly created plan.

3- Subscription List.
By clicking on the Subscriptions tab you can list down all created subscriptions with the patient's email address, total charges, start date status and amount of subscription.
Subscriptions can be filtered by using given filters, Subscription status can be selected to see all subscriptions with a particular status or can be filtered by patient email.

4- Cancel Subscription.
Click on the name of charge from the above page, it will open the subscription details page. On the subscription detail page all details of subscription are listed.
For Active Subscriptions:
On the subscription details page there is a Cancel button. If you click on Cancel button and it will cancel the subscription.

5- Invite Patients To Square Payment.
Click on the "Bulk Invite Patient" tab. Enter the email addresses of the patients and then click the "Invite" button at the bottom.
This will send emails to the patients and also create customer profiles on Square. The email will include a link for patients to add their payment card information. Patients can enter their payment details by following that link.
The payment information will be stored directly on Square, while the payment_profile_id will be saved in our system. This payment info will be used for charging patients.

6- Refund.
To refund a payment, Click on the "Refund" tab and it will display the following form. Enter the email of the patient and click on "Get Charge".

It will display all charges for the patient. Select the charge for which you would like to claim a refund. You can choose to refund either the full amount or a partial amount by entering the desired refund amount.
Once you’ve provided all the relevant information, click the "Process" button. This will call Square's refund API, and the specified amount will be refunded to the payment card.
7- Charge List.
You can see the charged payment on Square by clicking on tab "Charge List". It will display all of the details of the charges.

8- Patients.
If you would like to view all patients registered with Square payment, click on the "Patients" tab. This will display a list of all patients along with their email addresses and current status.

Webhook Creation
Please follow these steps to create and set up a webhook for subscriptions:
1. Log in to your Square account.
2. Go to https://developer.squareup.com/apps/.
3. Click on your app to open the settings page.
4. Select "Webhook" and then "Subscriptions" from the left sidebar.

5. Click on Add Subscription Button and it will open following popup form:

6. Give a name of your choice.
7. Enter URL: DomainNAme/api/v1/square-payment/webhook
8. From Api version select: Default
9. From Events check these two events:
invoice.payment_made
invoice.scheduled_charge_failed
Click on "Save."
You're all set!
To view logs and other details, click on the listed subscription from the webhook subscription details page.