Skip to content

String-xyz/string-sdk

Repository files navigation

String SDK

Version Downloads

NodeJS TypeScript Svelte

Usage

Install the package through npm or yarn as follows:

npm i @stringpay/sdk
// or
yarn @stringpay/sdk

Load the SDK's script in the root of your app like so:

<script src="../node_modules/@stringpay/sdk/dist/stringpay-v0.2.0.min.js"></script>

Initialize the SDK in onMount (client side):

window.StringPay.init({
	env: "LOCAL", // Can be PROD, SANDBOX, DEV, or LOCAL
	publicKey: apiKey,
});

With this in place, add your String Checkout button anywhere you'd like:

<button onClick={() => StringPay.loadFrame(payload)}>String Checkout</button>

The StringPay object can be fetched from the window object.

Add a div anywhere on your app where you'd like to render the payment modal:

<div class="string-pay-frame" />

Refer to our documentation for more in-depth explanations and help regarding transaction payload formats.

Types

The SDK's types can be imported if necessary. For example:

import type { StringPayload } from '@stringpay/sdk';

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •