Configuration
Public configuration options for ic.payment.v1.mount().
Public options for ic.payment.v1.mount(config):
| Property | Type | Required | Description |
|---|---|---|---|
sessionId |
string |
Yes | Payment session identifier returned by the API. |
container |
string or HTMLElement |
Yes | CSS selector, element ID, or DOM element to mount into. |
environment |
prod or sandbox |
No | Selects the API host. Defaults to "sandbox". |
wallets |
object |
No | { applePay?: boolean, googlePay?: boolean }. Both default to true. Only applies to card-based sale sessions. |
theme |
object |
No | Visual overrides - see Theming. |
onReady |
function |
No | Called when the form is ready. Receives { sessionId }. |
onComplete |
function |
No | Called when a transaction reached the payment gateway. Receives the full transaction object with a success flag. An ACH transfer accepted for processing can also report success: true; see Callback payloads. |
onError |
function |
No | Called when an SDK error, session error, or other non-transaction error occurs. Receives a standard error object with code, status (Rejected or Interrupted), message, and timestamp. |
environment defaults to "sandbox". Set it explicitly to "prod" in your production build. A session created in one environment and mounted against the other cannot complete. It can fail to load with 3201, or produce 6103 (SdkEnvironmentMismatch) if the SDK loads the session and detects a mismatch.
Full example
const controller = ic.payment.v1.mount({
sessionId: response.sessionId,
container: "#payment-container",
environment: "prod",
wallets: {
applePay: true,
googlePay: false,
},
theme: {
primary: "#7c3aed",
borderRadius: "8px",
},
onReady: ({ sessionId }) => console.log("Form ready for", sessionId),
onComplete: (transaction) => {
if (transaction.success) {
showPaymentAccepted(transaction); // backend confirms before fulfillment
} else {
showPaymentOutcome(transaction);
}
},
onError: (error) => {
reconcileWithBackend(error); // check any earlier submission before retrying
},
});
onComplete fires for declines as well as approvals - branch on transaction.success. Treating every onComplete as a successful payment is the most common integration bug with this SDK.
onPaymentEvent is an optional callback for SDK events such as mounted, ready, paymentResult, and destroyed. It receives { event, sessionId, origin, ...details }. For iframe integrations, allowedOrigins is an optional array of origins permitted to complete the messaging handshake. It has no effect when mounted directly on your page.
Wallet availability
Wallet buttons appear only when all of the following hold:
- The session is a card-based sale (
POST /transactions/virtual-sale) - The corresponding
walletsflag is not set tofalse - The customer's browser and device support the wallet
- Your domain has been validated - see Apple Pay and Google Pay
Teardown
mount() returns a MountController whose unmount() method removes the form and wallet buttons and stops their event handling. Call it on route changes and component teardown.