Skip to Content

Configure Payment

POST/payments/configure/:paymentId

Description

Configure a payment by selecting the token and chain. This generates a unique deposit address for the customer to send funds to.

💡

This step is typically handled by the payment UI when the customer selects their preferred token and network. You can also call this endpoint programmatically if you want to pre-configure the payment.

Path Parameters

NameTypeDescription
paymentIdstringPayment ID (UUID)

Request Body

NameTypeDescriptionRequired
idstringPayment ID (UUID)yes
selectedTokenstringToken to receive. Supported: "DAI", "USDC", "USDT"yes
selectedChainIdnumberChain ID for the payment networkyes

Supported Chain IDs

Chain IDNetwork
42161Arbitrum
10Optimism
137Polygon
56BSC
8453Base

Example Request

const paymentId = 'e0611550-0935-40f1-9cad-63096476207d';
 
const response = await fetch(`https://merchant.grateful.me/api/payments/configure/${paymentId}`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    id: paymentId,
    selectedToken: 'USDC',
    selectedChainId: 42161, // Arbitrum
  }),
});
 
const configuredPayment = await response.json();

Response

SUCCESSFUL CONFIGURATION (200)
{
  "id": "e0611550-0935-40f1-9cad-63096476207d",
  "amount": "50.00",
  "tokenAmount": 50.0,
  "selectedToken": "USDC",
  "selectedChainId": 42161,
  "depositAddress": "0x1234567890abcdef1234567890abcdef12345678",
  "merchant": {
    "name": "Your Store",
    "avatarUrl": "https://example.com/avatar.png"
  }
}
📋

After configuration, the customer should send exactly tokenAmount of selectedToken to the depositAddress on the specified chain.

Start building

XO

Request Demo

Schedule a call with our team

Select a product
Arrow right

Start building
Grateful

Contact Us

We're here to help