Introduction
Accept stablecoin payments from every network Cosmos Pay works with, and swap between them, with the Cosmos Pay SDK and the Payments REST API.
Cosmos Pay lets you accept payments that customers pay from any network we work with (payment intents with SEP-7, Solana Pay and EIP-681 links, and a swap in first when the funds are on another network), swap on one network or between them, and manage webhooks, products, customers and analytics. These docs cover both ways to integrate:
SDK · Overview
What @cosmosapp/pay_sdk is, the server + browser entry points, and the mental model.
SDK · Quickstart
The smallest end-to-end flow: create an intent, complete it in the wallet, validate it.
API Reference
The Payments REST API (OpenAPI): payment intents, webhooks, products, customers, analytics.
Webhooks
Register endpoints, receive events, and verify signatures.
The payment flow
A payment has three steps (shown here with the SDK, on Stellar):
- Server creates an intent with your secret API key (
client.paymentIntents.createPay/createTx). - Browser completes it with the user's Stellar wallet (
new WebClient().pay(intent)), producing an on-chaintxHash. - Server validates that hash (
intent.validate(txHash)), which updates the status and fires a webhook.
The network is chosen by the API key type: dv_ keys hit testnet, prod_ keys hit mainnet.
On Solana and Monad, pass chain, with the SDK (createPay({ chain: 'solana', ... }), from version 2.2) or the REST API:
you get a Solana Pay or EIP-681 link, the payer pays it from any wallet on that chain, and the
Payments API detects the payment on-chain and fires the same webhooks.