Square
Square is a card payment provider. The JoomInvoice - Payment - Square plugin creates a Square payment link for the payment and sends the client to Square's hosted checkout page. Card details never pass through your site.
What you need
- A Square account and an application in the Square Developer Dashboard.
- HTTPS on your site.
- Invoices in the currency of your Square location. A US location accepts only USD, a eurozone location only EUR. Other currencies are refused when the checkout is created.
- The plugin enabled: Integrations > Square, or System > Manage > Plugins, search for
square.
Get your credentials
In the Square Developer Dashboard, open your application and pick Sandbox or Production at the top:
- Credentials: copy the Access token.
- Locations: copy the Location ID of the location that receives the money, and check its currency.
Settings
| Setting | What to enter |
|---|---|
| Mode | Sandbox for testing, Production for real payments. |
| Sandbox Access Token, Sandbox Location ID | Used in Sandbox mode. |
| Access Token, Location ID | Used in Production mode. |
| Enable Webhooks | Yes is recommended. |
| Webhook Signature Key | The signature key of the webhook subscription. |
| Tab title | The tab name on the payment page. Default Square. |
| Description text | The text above the button. |
| Require shipping address | Yes asks the buyer for a shipping address on the Square page. |
Set up the webhook
Without a webhook, the payment is recorded when the client comes back to your site, after JoomInvoice checks the order with Square. If the client closes the browser first, it stays unpaid.
- In the Developer Dashboard, open your application, then Webhooks > Subscriptions and Add Endpoint.
- Notification URL:
https://example.com/index.php?option=com_joominvoice&task=process_payment&ptype=payment_square&paction=webhookIt must match your site address exactly, with
httpsand with or withoutwww. Square signs the URL, so any difference makes the check fail. - Subscribe to the event
payment.updatedand save. - Copy the Signature Key into Webhook Signature Key, set Enable Webhooks to Yes and save the plugin.
Sandbox and Production need separate subscriptions with separate keys.
Test
- Use Sandbox mode with the sandbox credentials.
- Create a test invoice in the currency of the sandbox location, with one payment.
- Open it on the site and pay with the Square tab.
In Sandbox, Square shows its Checkout API Sandbox Testing Panel instead of a card form. Click through to Test Payment and finish. You come back to JoomInvoice and the payment shows as Paid. In Production, clients see the normal Square card page.
Troubleshooting
- Square payment is not configured. The access token or location ID of the current mode is empty.
- Unable to start the Square checkout. Usually the invoice currency is not the currency of your Square location.
- Your checkout session has expired. The client starts again from the invoice.
- The payment stays unpaid. Check the webhook subscription, the signature key and the delivery log in the Developer Dashboard.