Prepare Subscription
Validates the request against product limits and returns a backend EIP-712 signature for the on-chain subscribe call.
POST /earn/subscribe/prepare
Content-Type: application/json
Auth: Authorization: Bearer <JWT> from the EIP-712 login. API keys are not accepted.
Request body
{ "product_id": "123204f6-5bde-4434-890a-8ca241f66067", "amount": "100" }
| Field | Type | Required | Description |
|---|---|---|---|
product_id | string | yes | Product UUID |
amount | string | yes | Human-readable USDT ("100", "100.5") |
Response
{
"chain_product_id": 1769524310,
"amount": "100000000",
"deadline": 1772006400,
"signature": "0x1a2b3c...",
"contract_address": "0x...",
"user_address": "0x29F721B203A9fC9c5DDe35A739d8b8E0E4605489"
}
| Field | Description |
|---|---|
amount | On-chain units — pass straight to the contract |
deadline | Unix seconds, 30 minutes after issue; single-use |
signature | Backend signature over Subscribe(address user,uint256 productId,uint256 amount,uint256 deadline) |
Contract calls
await usdt.approve(contract_address, amount);
await earn.subscribe(chain_product_id, amount, deadline, signature);
Errors
| code | Condition |
|---|---|
SUBSCRIPTION_CLOSED | Product not subscribing / outside window |
AMOUNT_TOO_LOW | < min_amount |
AMOUNT_TOO_HIGH | > max_amount_per_user |
QUOTA_EXCEEDED | > available_quota |
INVALID_AMOUNT | Malformed / ≤ 0 |
PRODUCT_NOT_FOUND |
Your per-day allowance is additionally bounded by the Earn Level quota (GET /points/earn-quota).