> For the complete documentation index, see [llms.txt](https://guide.form.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.form.gov.sg/user-guides/advanced-guide/payments/payment-workflows/payment-integrations-automations.md).

# Payment integrations / automations

{% hint style="info" %}
Basic overview of what webhooks are and how it works can be found [here](https://guide.form.gov.sg/user-guides/advanced-guide/webhooks).
{% endhint %}

With payment webhooks, FormSG can be all your online payment form needs, connected to backend systems

* using a workflow builder like Plumber.gov.sg or
* with the help of an IT team to integrate with agency systems.

### Setting up through Plumber

1. **Have your form URL and secret key ready**\
   \
   Before embarking on the steps below, ensure that your form is already [ready to collect responses](https://guide.form.gov.sg/user-guides/basic-guide/publish-form/publish-storage-mode-form) and a [payment field](https://guide.form.gov.sg/user-guides/payments/creating-payment-field) has been created. <br>
2. **Login to** [**plumber.gov.sg**](https://plumber.gov.sg) **(automation workflow builder)**<br>

   <figure><img src="/files/XtbaeglmCGidBqM7EHtQ" alt=""><figcaption></figcaption></figure>
3. **Create new pipe (workflow)**<br>

   <figure><img src="/files/ZY16uNO99CnHs6k94KPa" alt=""><figcaption></figcaption></figure>
4. **Choose FormSG as a trigger**\
   \
   Click on the dropdown to "Choose an app". <br>

   <figure><img src="/files/ycNInjs5WwIhhTJM1mYH" alt=""><figcaption><p><br></p></figcaption></figure>

   \
   For our payments tutorial, choose "FormSG" for the trigger app.<br>

   <figure><img src="/files/cVl199Q2TlEuua5sHVHn" alt=""><figcaption></figcaption></figure>

   \
   Choose "New form submission" as trigger event. Selecting this means that the workflow runs whenever a new form submission is received.<br>

   <figure><img src="/files/EMhjB9KEIQbDc0FiLpr3" alt=""><figcaption><p><br></p></figcaption></figure>

   Once you have done so, you may click continue.<br>

   <figure><img src="/files/N7XgKm4TILQg4a4Khien" alt=""><figcaption></figcaption></figure>
5. **Add connection**\
   \
   To set-up a connection between FormSG and Plumber, we make use of [webhooks](/user-guides/advanced-guide/webhooks.md). Click on "Add new connection".<br>

   <figure><img src="/files/5kiuNxzRF8eqoKeOo08U" alt=""><figcaption><p><br></p></figcaption></figure>

   Enter your form URL and secret key. Do ensure that the URL is in the correct format and does not contain /admin/form in it. \
   \
   Click "Submit".<br>

   <figure><img src="/files/OmXlu1tFBxX4jYx56Neh" alt=""><figcaption><p><br></p></figcaption></figure>

   Once you have successfully connected, a green tick will appear and you may continue.<br>

   <figure><img src="/files/CAw84eDPSoroDcOsK4am" alt=""><figcaption><p><br></p></figcaption></figure>

   You will also notice on your form settings, that an endpoint URL has been automatically added. Note that FormSG only supports one webhook URL at a time. \
   \
   Toggle "Enable retries" to on.<br>

   <figure><img src="/files/uUeqBIQjj2wn7Pdk3kSK" alt=""><figcaption></figcaption></figure>
6. **Perform a test submission**\
   \
   In order for Plumber to identify what appears in a form submission, you would need to perform a test submission in FormSG (not in preview mode). <br>

   <figure><img src="/files/b8PGYPZoIGksVJ4iat4v" alt=""><figcaption><p><br></p></figcaption></figure>

   To do this, open up your form. Back in FormSG, you may locate the form link in the share button. <br>

   <figure><img src="/files/hXBhiFtWWunkVfiKSXQ2" alt=""><figcaption><p><br></p></figcaption></figure>

   For a payments form, you would need to make a real payment as well. We suggest creating a category that collects $0.50 (minimum amount to transact) for this purpose.\
   \
   Enter **all** **mandatory** and **optional** fields that you would like Plumber to pick up. Plumber is not able to handle hidden fields via logic at this point. \
   \
   *If hidden fields are necessary, you may reach out to the Plumber/FormSG team for direct assistance if required.*<br>

   <figure><img src="/files/4xznlI3WHuyi1dViMukn" alt=""><figcaption><p><br></p></figcaption></figure>

   Proceed to complete payment. PayNow is recommended due to lower fees and there is no fixed fee involved. For a $0.50 payment, you will be incurring $0.01 fees (rounded up).<br>

   <figure><img src="/files/1sWvm3DzdqfICMi3UW7n" alt=""><figcaption><p><br></p></figcaption></figure>

   If you have reached the payment success page, it means a form submission has been recorded. You may switch back to Plumber.<br>

   <figure><img src="/files/zy9rAoVFXq18ou1UoOzi" alt=""><figcaption><p><br></p></figcaption></figure>

   On Plumber, click "Test Step".\ <br>

   <figure><img src="/files/0OgPRbY3PvHkLcI50NMI" alt=""><figcaption><p><br></p></figcaption></figure>

   Plumber will display received test data. These can be used for all subsequent actions for automations such as customised emails, updated to databases or as conditions for branching automations.\
   \
   For payment forms, we also include additional variables such as receipt URL, payment type, payer email, gross amount, transaction fees, product/service and quantity chosen.<br>

   <figure><img src="/files/XsL5bp9dgRwpGzVekw55" alt=""><figcaption></figcaption></figure>

   <figure><img src="/files/Dtfu8eWHHjyu764eqHfj" alt=""><figcaption><p><br></p></figcaption></figure>

   Note that if you add any new fields into your form, you will need to repeat step 7 again. <br>
7. **Automate your workflow by adding more actions for endless possibilities!**<br>

   * [Send customised notifications](https://guide.plumber.gov.sg/use-cases/dynamic-link-generation-based-on-respondent-selections) to different departments based on payment service chosen.
   * Consolidate payments from different forms into a single database
   * [Track payments statuses](https://guide.plumber.gov.sg/use-cases/attendance-taking) from a list of payees
   * Perform [logic](https://guide.plumber.gov.sg/use-cases/get-updated-on-urgent-requests) based on payment value (Greater than, less than)
   * Send reminders for a specific payment
   * Create unique entry codes for an event

   \
   Not sure what you can automate? Chat with us [here](https://go.gov.sg/formsg-payments).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://guide.form.gov.sg/user-guides/advanced-guide/payments/payment-workflows/payment-integrations-automations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
