Skip to content

Client-side Install (browser)

For use in the browser, you can access the SDK directly at https://js.getcode.com/v1/. However, you can also import the @code-wallet/elements package.

Installation

bash
import code from 'https://js.getcode.com/v1/';
import code from 'https://js.getcode.com/v1/';

If you're using a package manager, you can install the @code-wallet/elements package.

bash
npm install @code-wallet/elements
npm install @code-wallet/elements
bash
yarn add @code-wallet/elements
yarn add @code-wallet/elements
bash
pnpm add @code-wallet/elements
pnpm add @code-wallet/elements
bash
bun install @code-wallet/elements
bun install @code-wallet/elements

Quick Start

html
<script type="module">
    import code from 'https://js.getcode.com/v1';

    const { button } = code.elements.create('button', {
        // ...
    });

    button.mount('#button-container');
</script>
<script type="module">
    import code from 'https://js.getcode.com/v1';

    const { button } = code.elements.create('button', {
        // ...
    });

    button.mount('#button-container');
</script>
js
import code from '@code-wallet/elements';

const { button } = code.elements.create('button', {
    // ...
});

button.mount('#button-container');
import code from '@code-wallet/elements';

const { button } = code.elements.create('button', {
    // ...
});

button.mount('#button-container');
js
const code = require('@code-wallet/elements');

const { button } = code.elements.create('button', {
    // ...
});

button.mount('#button-container');
const code = require('@code-wallet/elements');

const { button } = code.elements.create('button', {
    // ...
});

button.mount('#button-container');

With this snippet, you can create a payment button that looks like this:

See a minimal example here.

Examples

You can also see the React or Vue examples for more information.