Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including erc-payable-token with all npm packages installed. Try it out:

erc-payable-token lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("erc-payable-token/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

erc-payable-token v3.1.0

ERC-1363 Payable Token Implementation

ERC-1363 Payable Token

NPM Package Build Status Coverage Status MIT licensed

This is an implementation of the ERC-1363 Payable Token that defines a Payable Token, a Token Receiver and a Token Spender.

The ERC-1363 is an ERC-20 compatible token that can make a callback on the receiver contract to notify token transfers or token approvals. It can be used to create a token payable crowdsale, selling services for tokens, paying invoices, making subscriptions, use them for a specific utility and many other purposes.

This proposal allows to implement an ERC-20 token that can be used for payments (like the payable keyword does for Ethereum).


npm install erc-payable-token


pragma solidity ^0.6.0;

import "erc-payable-token/contracts/token/ERC1363/ERC1363.sol";

contract MyToken is ERC1363 {

  constructor (
      string memory name,
      string memory symbol
  ) public payable ERC1363(name, symbol) {}

  // your stuff


This repo contains:



Interface for a Payable Token contract as defined in ERC-1363 Payable Token.



Implementation of an IERC1363 interface.



Interface for any contract that wants to support transferAndCall or transferFromAndCall from ERC1363 token contracts.



Interface for any contract that wants to support approveAndCall from ERC1363 token contracts.



Implementation proposal of a contract that wants to accept ERC1363 payments. It intercepts what is the ERC1363 token desired for payments and throws if another is sent. It emits a TokensReceived event to notify the transfer received by the contract. It also implements a transferReceived function that can be overridden to make your stuffs within your contract after a onTransferReceived. It emits a TokensApproved event to notify the approval received by the contract. It also implements a approvalReceived function that can be overridden to make your stuffs within your contract after a onApprovalReceived.



As example: an Implementation of a classic token Crowdsale, but paid with ERC1363 tokens instead of ETH.


Install dependencies

npm install


Use Solhint

npm run lint:sol

Use ESLint

npm run lint:js

Use Eslint and fix

npm run lint:fix

Usage (using Truffle)

Open the Truffle console

npm run console


npm run compile


npm run test

Usage (using Buidler)

Open the Buidler console

npm run buidler:console


npm run buidler:compile


npm run buidler:test


Code released under the MIT License.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free