Socket
Book a DemoInstallSign in
Socket

@anycade/sdk

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anycade/sdk

Anycade SDK

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Bundle Size Version

@anycade/sdk

Web SDK for Anycade Games

Installation

# npm
npm i @anycade/sdk
# yarn
yarn add @anycade/sdk
# pnpm
pnpm add @anycade/sdk

Installation using CDN

Warning
The script must be inserted before your main game script!

<script src="https://unpkg.com/@anycade/sdk/dist/browser/index.min.js"></script>

Getting started

import { SDK } from '@anycade/sdk';

const sdk = new SDK({
  gameId: '123456'
});

Using the CDN version, the SDK class is accessible through Anycade.

const sdk = new Anycade.SDK({
  gameId: '123456'
});

SDK options

  • debug - Debug mode
  • gameId - Game ID

initialize

SDK initialization with the platform.

const sdk = new SDK({
    gameId: '123456',
});

try {
    await sdk.initialize();
    // Ok
} catch (error) {
    // Error
}

Payments

purchase

Show the payment window.

try {
    const result = await sdk.payments.purchase({
        meta: {
            // Custom fields to retrieve
            foo: 'bar',
        },

        productId: '123456', // Id of the product from the platform
    });

    // Handle the result.
    switch (result.status) {
        case 'cancel':
            // Cancel the payment process.
        case 'fail':
            // Failed to pay.
        case 'success':
            // Paid successfully.
    }

    // Access custom fields.
    result.meta;
} catch (error) {
    // Error
}

Keywords

anycade

FAQs

Package last updated on 24 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts