Skip to main content
Interact directly with the Paycrest Gateway smart contract for onchain stablecoin-to-fiat (off-ramp) order creation, settlement, and refunds. This approach gives you full control over the blockchain transactions and is ideal for dapps, wallets, or any EVM-compatible application.
This guide uses Viem for smart contract interactions, which is the recommended Ethereum library for modern applications. Viem provides better TypeScript support, improved performance, and a more intuitive API compared to ethers.js.
Starknet and Tron: Gateways are live on both networks, but this page documents EVM contract calls only. For those orders, use the Sender API Integration with network: "starknet" or network: "tron". Addresses and token contracts are listed under Gateway Contract Addresses and Supported Stablecoins.

Overview

The Gateway contract is a multi-chain EVM-based smart contract that facilitates the onchain lifecycle of payment orders. It empowers users to create off-ramp orders while enabling liquidity providers to facilitate those orders at competitive exchange rates.

Prerequisites

  • Paycrest Sender Account: Register at app.paycrest.io and complete KYB verification. You’ll need your API Key to embed in every order’s encrypted metadata — this links the onchain order to your sender profile and enables webhooks.
  • Ethereum Provider: MetaMask, WalletConnect, or any Web3 provider
  • Viem: For smart contract interactions
  • USDT/USDC Balance: Sufficient token balance for orders
  • Gas Fees: ETH for transaction fees

Connect Wallet

Initialize Contracts

Create an Order

Exchange Rate and Account Verification

For mobile money recipients, you may pass local MSISDN (e.g. KES 07…); POST /v2/verify-account normalizes dial codes server-side. Optional metadata on verify applies for KES Till/Paybill. See Verify Account.

Data Encryption

The recipient object is encrypted with the aggregator’s public key to produce the messageHash passed to the contract. Always include your API Key in the metadata.apiKey field — this is the same key used as the API-Key header in REST requests, and it links the onchain order to your sender profile, enabling webhooks and order attribution.
Your API Key is available in the dashboard at app.paycrest.io.

Token Approval

Get Order Information

Event Listening

Error Handling

Complete Example

Supported Networks

  • Ethereum: USDT, USDC, cNGN
  • Base: USDT, USDC, cNGN (primary recommended network)
  • Arbitrum One: USDT, USDC
  • Polygon: USDT, USDC, cNGN
  • BNB Smart Chain: USDT, USDC, cNGN
  • Lisk: USDT, USDC
  • Celo: USDT, USDC
  • Starknet: USDT, USDC
  • Tron: USDT
See Gateway Contract Addresses for deployment addresses per network.
Paycrest supports very low minimum orders ($0.50) and uses cost-effective EVM L2s. Start with small amounts to test your integration before scaling up.
Failed transactions still consume gas. Validate all parameters before submitting transactions.
Choose this method for full onchain control and direct smart contract interaction.