A2N Finance
  • 👋Welcome to A2N Finance
  • Overview
    • 💡What we do
    • ✨Our Features
  • Product Guides
    • 📪How to test
    • 📎How to integrate with WooCommerce
    • 🛒How to integrate with Shopify
  • Developer
    • 🛠️SDK
      • 📝Setting Javascript Files
      • ⚙️Select functions to use
  • Use Cases
    • 🎨For Designers
    • 🖥️For Developers
Powered by GitBook
On this page
  1. Developer
  2. SDK

Select functions to use

All functions are packed into window.a2n object.

Init Read Contract:

window.a2n.initReadContract()

Create an A2N smart contract instance to read/get data only. Methods of this instance do not require customers' wallet account permission.

Init Write Contract:

window.a2n.initWriteContract()

Developers can use this method to send transactions to A2N smart contract.

Get a product by ID from A2N Smart Contract:

window.a2n.getProductByIdFromSM(readContractInstance, productId)

To get a product and its subscription plans from A2N smart contract.

Get a product by ID from A2N cloud database:

window.a2n.getProductByIdFromDB(productId)

Get a product with additional information, such as description, image. and external link...

Get my subscribers:

window.a2n.getMySubscribers(readContractInstance, accountAddress)

Get all subscribers of an account address.

Get my subscriptions:

window.a2n.getMySubscriptions(readContractInstance, accountAddress)

Get all subscriptions of an account address.

Subscribe/purchase a subscription product:

widow.a2n.subscribe(writeContractInstance, productId, planId)

Send a transaction to A2N smart contract and complete a payment process.

Get current account:

window.a2n.getCurrenctAccount()

Get a customer's connected account on your website.

Insert a subscription product into your website:

widow.a2n.initDiv(subscriptionProductElementId)

Insert subscription product information into an HTML tag.

PreviousSetting Javascript FilesNextFor Designers

Last updated 2 years ago

To see more details, you can check here:

🛠️
⚙️
https://github.com/a2nfinance/app/blob/master/sdk/index.js