Skip to main content

Push JS SDK Reference

The SDK must be loaded as a script tag on your website — it cannot be statically bundled via package management.
The SDK is loaded from cdn.pushcash.com and creates iframes that load content from the same origin. If your site uses a Content Security Policy, ensure the following directives include https://cdn.pushcash.com:
  • script-src — to load the SDK script
  • frame-src — to allow the widget and UX iframes

Widget

new window.PushCash.Widget(options)

Creates the Push User Widget. The widget renders a card input form into the container specified by selector.

Options (WidgetOptions)

Returns

A Widget instance.

Example

widget.tokenize()

Generates a token from the user’s card details which can be used to process a transaction by calling authorize-payment. Throws an error if the user has not provided valid card details.

Signature

Example

widget.destroy()

Unmounts the widget and cleans up resources.

Signature


UX

Presents the Push-hosted authentication UI for an intent in a modal. Use it on the web to complete the step-up authentication requested when authorize-payment returns 202 Accepted — see Presenting the authentication UI.

window.PushCash.UX(config)

Creates a UX handler for a single intent. It renders the hosted UX in a modal — a centered dialog on desktop, a full-page sheet on mobile — and manages its lifecycle.

Config (PushUXConfig)

Because you omit redirect_url when presenting on the web, the flow’s end is signaled through onExit rather than a redirect. onExit does not indicate whether the payment succeeded — call get-an-intent (or wait for the intent webhook) and inspect status.

Returns

A PushUXHandler.

Example

handler.open()

Presents the modal and begins the flow. Calling open() again while the modal is already open, or after the flow has ended, is a no-op.

Signature

handler.exit()

Ends the flow programmatically: tears down the modal and fires onExit (once). Use it to close the UX from your own UI.

Signature

handler.destroy()

Removes the modal and all listeners without firing onExit. Terminal and idempotent — after destroy() the handler is spent and open() does nothing. Use it for cleanup (for example, when unmounting your page) where teardown should not be treated as an exit.

Signature


Apple Pay Launcher

new window.PushCash.ApplePay(config)

Creates an Apple Pay launcher instance.

Parameters

Example

launcher.display(args)

Launches the Apple Pay payment sheet and runs the Apple Pay flow.

Parameters

Example