Contract Interactions
Contract interactions let a business register approved EVM contracts or Solana programs, then expose a constrained execution surface to its backend. Use this when PayChain needs to help a business safely call smart contracts as part of a payment, treasury, or automation workflow.Important note: Contract interactions are not the same as normal invoice collection. Invoices track customer payments. Contract interactions are approved automation actions that may read from or write to a chain program or contract.
When to use contract interactions
- A fintech app needs a controlled on-chain execution after a payment.
- A marketplace wants to trigger a settlement contract.
- A product needs safe reads from EVM contracts or Solana programs.
- A backend needs repeatable execution with audit history.
EVM contracts
For EVM contracts, an authorized dashboard user registers:- Contract address.
- Chain and network.
- ABI.
- Allowed functions or published actions.
- Optional execution constraints.
Solana programs
For Solana programs, an authorized dashboard user registers:- Program ID.
- Network.
- Anchor IDL where available.
- Approved instructions or account reads.
- Account mappings required by published actions.
Dashboard setup vs backend execution
Reads vs writes
- Reads query contract or program state and do not move funds by themselves.
- Writes broadcast transactions and can consume sponsored gas credits when PayChain sponsors the network cost.
Gas credit note: Sponsored contract execution can reduce the business gas-credit balance. If credits are insufficient, eligible sponsored execution may pause until the business tops up.
Recommended developer flow
- Confirm the business has an approved contract integration.
- Fetch the published actions available to the API key or backend service.
- Validate your own product state before requesting execution.
- Quote or simulate when the endpoint supports it.
- Execute with an idempotency key.
- Store the PayChain execution ID and request ID.
- Wait for terminal execution status or webhook notification.
- Reconcile the transaction hash and business object state.
REST examples
Contract execution uses approved action IDs. The action must already be published from the dashboard and the API key must be scoped for contract execution.Quote an approved action
Execute an approved action
Fetch execution status
Example use cases
Payment-triggered contract action
A merchant collects a fixed invoice, waits forinvoice.paid, fetches the canonical invoice, then executes an approved contract action tied to the order.
Use this when:
- The payment and contract action are separate steps.
- Your backend must validate order state before execution.
- The contract action should only happen after confirmed settlement.
Treasury automation action
An approved user publishes a constrained action for a known token or settlement contract. The backend quotes and executes only that published action when your approval rules pass. Use this when:- The business wants repeatable treasury movement.
- Your team needs audit history.
- Developers should not manage private signing credentials.
Read-only contract view
A backend or dashboard can query approved read functions to display contract state without broadcasting a transaction. Use this when:- You need contract state for reconciliation.
- You need a pre-execution check.
- You need visibility without moving funds.
What to document for each action
- Action name.
- Chain and network.
- Contract address or program ID.
- Function or instruction.
- Required parameters.
- Required accounts, where relevant.
- Whether it is read-only or writes to chain.
- Whether it can consume sponsored gas credits.
- Expected success state.
- Common failure states.
- Required API key or auth mode.
Common mistakes
- Treating a contract execution as invoice payment confirmation.
- Exposing private signing credentials or other secrets.
- Retrying a write action without an idempotency key.
- Letting client-side code choose unsafe contract parameters.
- Ignoring simulation or quote results before execution.
- Forgetting that sponsored execution can become gas-blocked.