Handling Form Submissions
Customise how your Connected Payments payment form collects, validates, and processes submissions.
Before You Begin
| Requirement | Details |
|---|---|
| iFrame configuration | An active Connected Payments iFrame configuration (hosted or embedded) |
| Dashboard access | Access to the Connected Payments admin dashboard |
| Google reCaptcha | (Optional) Registered site key and secret key from google.com/recaptcha |
| PostMessage support | (For external submit) Embedded iFrame integration |
Code samples within this document are provided for reference purposes only and are not intended for production use.
How It Works
- User fills form
- Optional: reCaptcha validation
- Optional: Confirmation step
- Form submitted
- Loading animation shown
- Display outcome in page OR redirect to merchant URL
Features Overview
- reCaptcha
- Confirmation
- External Submit
- Loading
- Outcome Display
Google reCaptcha
Protect your payment form against bots and automated attacks.
Supported: Hosted & Embedded
Setup steps:
- Register at google.com/recaptcha
- Add keys to admin dashboard
- Add reCaptcha component to form config
Confirmation Step
Add a review screen before final payment processing.
Supported: Hosted & Embedded
Features:
- Display user-entered data
- Edit button to return to form
- Confirm button to proceed
External Submit Button
Trigger form submission from your parent page.
Supported: Embedded only
Use case: Integrate payment step into larger checkout form
Loading Animations
Branded loading state during payment processing.
Supported: Hosted & Embedded
Customise: Animation type, colors, text
Transaction Outcome
Choose how to display payment results.
Options:
- Display in-page (within iFrame)
- Redirect to merchant URL
Google reCaptcha
- Setup
- Properties
- Behavior
1. Register with Google
Visit google.com/recaptcha to obtain:
| Key | Type | Usage |
|---|---|---|
| Site Key | Public | Client-side (visible in form) |
| Secret Key | Private | Server-side (stored in dashboard) |
2. Add Keys to Dashboard
Navigate to your iFrame configuration in the Connected Payments admin dashboard and enter both keys in the reCaptcha section.
3. Add Component to Form Config
Add the reCaptcha component inside your form:
{
"type": "form",
"class": "payment-form",
"children": [
{
"type": "reCaptcha",
"theme": "light",
"lang": "en"
}
]
}
reCaptcha Component Properties
| Property | Type | Options | Default | Description |
|---|---|---|---|---|
type | String | "reCaptcha" | Required | Component identifier |
theme | String | "light", "dark" | "light" | Visual theme |
lang | String | ISO code (e.g. "en", "es") | "en" | Challenge language |
How It Works
The form cannot be submitted until the reCaptcha challenge is completed.
Key behaviors:
- Form submission blocked until challenge completed
- External submit requires completed reCaptcha
- Tokens expire and require re-completion
Confirmation Step
Add a review screen between form submission and payment processing.
- Setup
- Dynamic Variables
- Example
Configure in Dashboard
In the Connected Payments admin dashboard, fill out the body of the confirmation section within the Customer Config.
Required Components
| Component | Purpose |
|---|---|
| Confirm form | Form with submit button to proceed |
| Edit form | (Optional) Form with "formType": "editForm" to return to payment form |
Flow
Available Variables
Display user-entered and transaction data using {variable} syntax:
| Variable | Description |
|---|---|
{merchReference} | Merchant reference |
{amount} | Transaction amount |
{cardHolderName} | Cardholder name |
{maskedPAN} | Masked card number (e.g. 411111XXXXXX1111) |
Conditional Display
Show fields only when a value exists:
{
"if": { "exists": true, "key": "amount" }
}
Example Configuration
View full confirmation JSON
{
"children": [
{
"children": [
{
"children": [
{
"text": "Please confirm your card details",
"tag": "span",
"class": "field-label field-header clear text-wrap"
}
],
"class": "field-group",
"tag": "div"
},
{
"children": [
{
"children": [
{
"text": "Reference",
"class": "field-label clear",
"tag": "span"
},
{
"text": "{merchReference}",
"class": "field-value clear metadata",
"tag": "div"
}
],
"class": "field-group responsive-override",
"tag": "div"
},
{
"children": [
{
"text": "Payment amount",
"class": "field-label clear",
"tag": "span"
},
{
"children": [
{
"text": "$",
"class": "field-value clear metadata",
"tag": "div"
},
{
"text": "{amount}",
"class": "field-value clear metadata",
"tag": "div"
},
{
"text": "AUD",
"class": "field-value clear metadata",
"tag": "div"
}
],
"class": "field-group-row responsive-override",
"tag": "div"
}
],
"class": "field-group responsive-override",
"tag": "div",
"if": { "exists": true, "key": "amount" }
},
{
"children": [
{
"text": "Cardholder name",
"class": "field-label clear",
"tag": "span"
},
{
"text": "{cardHolderName}",
"class": "field-value clear metadata",
"tag": "div"
}
],
"class": "field-group responsive-override",
"tag": "div",
"if": { "exists": true, "key": "cardHolderName" }
},
{
"children": [
{
"text": "Card number",
"class": "field-label clear",
"tag": "span"
},
{
"text": "{maskedPAN}",
"class": "field-value clear metadata",
"tag": "div"
}
],
"class": "field-group responsive-override",
"tag": "div"
}
],
"tag": "div",
"class": "field-group"
}
],
"class": "field-group responsive-override",
"tag": "div"
},
{
"children": [
{
"children": [
{
"type": "form",
"children": [
{
"value": "Confirm details",
"type": "submit",
"class": "form-submit btn",
"tag": "input",
"if": { "key": "hosted", "eq": "true" }
}
]
},
{
"type": "form",
"formType": "editForm",
"children": [
{
"value": "Edit details",
"type": "submit",
"class": "form-reset btn",
"tag": "input",
"if": { "key": "hosted", "eq": "true" }
}
]
}
],
"tag": "div",
"class": "field-group"
}
],
"class": "component-group responsive-override",
"tag": "div"
}
],
"class": "iframe-container",
"tag": "div"
}
External Submit Button
This feature is only available for embedded iFrame integrations with PostMessage support.
Trigger the payment form submission from a button on your merchant page instead of inside the iFrame.
How It Works
Send a submit PostMessage to the iFrame's contentWindow. The iFrame validates all fields (including reCaptcha if enabled) before processing.
Implementation
- React
- Vanilla JavaScript
- jQuery
// Ref the iframe
const iframeRef = useRef(null);
const handleSubmit = () => {
iframeRef.current.contentWindow.postMessage(
JSON.stringify({ action: "submit" }),
"https://sandbox.connectedpayments.commbank.com.au",
);
};
return (
<>
<iframe ref={iframeRef} id="payment-iframe" src="YOUR_IFRAME_URL" />
<button onClick={handleSubmit}>Complete Payment</button>
</>
);
document.getElementById("submit-button").addEventListener("click", function () {
const iframe = document.getElementById("payment-iframe");
iframe.contentWindow.postMessage(
JSON.stringify({ action: "submit" }),
"https://sandbox.connectedpayments.commbank.com.au",
);
});
$("#submit-button").on("click", function () {
$("#payment-iframe")[0].contentWindow.postMessage(
JSON.stringify({ action: "submit" }),
"https://sandbox.connectedpayments.commbank.com.au",
);
});
PostMessage Payload
{ "action": "submit" }
Always specify the exact target origin ("https://sandbox.connectedpayments.commbank.com.au") rather than "*" in production.
Only trigger submission when the iFrame form is valid. Monitor the isValid field in field interaction PostMessages to gate your submit button.
Loading Animations
Customise the loading animation shown during payment processing to match your brand.
Setup
Configure in the Connected Payments admin dashboard under your iFrame configuration's form submission loader settings.
Customisation Options
| Option | Description |
|---|---|
| Animation type | Choose from available loading animation styles |
| Colors | Match your brand palette |
| Text | Set custom message (e.g. "Processing payment…") |
Transaction Outcome Display
Choose how the payment result is presented after processing completes.
- In-Page Display
- Redirect
- Comparison
Display Outcome in Payment Page
Render the transaction result directly inside the iFrame using the response section of the Customer Config.
Available Variables
| Variable | Description |
|---|---|
{txnReference} | Transaction reference |
{responseCode} | Response code |
{maskedPAN} | Masked card number |
{finalAmount} | Final charged amount |
Example Configuration
{
"tag": "div",
"class": "success-message",
"children": [
{ "tag": "h2", "text": "Payment Successful" },
{ "tag": "p", "text": "Reference: {txnReference}" },
{ "tag": "p", "text": "Card: {maskedPAN}" },
{ "tag": "p", "text": "Amount: ${finalAmount}" }
]
}
Redirect to Merchant Page
Configure a redirect URL in the response section of the admin dashboard. After processing, the user is sent to your URL with transaction data as query parameters.
Example Redirect
https://merchant-url.com/payment-complete?maskedPAN=411111XXXXXX1111&txnReference=ABC123&responseCode=00
Configure which parameters are included and their names in the admin dashboard response section.
Always verify transaction outcome server-side via notifications. Never trust URL parameters alone.
Choosing a Display Option
| In-Page Display | Redirect to Merchant | |
|---|---|---|
| User experience | Seamless — no page change | Returns user to your site |
| Customisation | Constrained to iFrame config | Full control on your own page |
| Post-payment logic | Handled by iFrame | Handled by your server |
| Best for | Simple confirmations | Complex post-payment flows |