Configure Payment
POST/payments/configure/:paymentIdDescription
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
| Name | Type | Description |
|---|---|---|
| paymentId | string | Payment ID (UUID) |
Request Body
| Name | Type | Description | Required |
|---|---|---|---|
| id | string | Payment ID (UUID) | yes |
| selectedToken | string | Token to receive. Supported: "DAI", "USDC", "USDT" | yes |
| selectedChainId | number | Chain ID for the payment network | yes |
Supported Chain IDs
| Chain ID | Network |
|---|---|
| 42161 | Arbitrum |
| 10 | Optimism |
| 137 | Polygon |
| 56 | BSC |
| 8453 | Base |
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.
