Skip to main content
POST
/
plan
/
{planId}
/
redeem
Redeem Credits
curl --request POST \
  --url http://sandbox.mintlify.com/plan/{planId}/redeem \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "creditsRedeemed": 123,
  "remainingBalance": 123
}
Redeems a specific number of credits from a subscriber’s balance after a valid request. This is typically used by builders after validating a request signature.

Example Usage

// Authorize the user and process the AI request first
// Then redeem credits after successful processing
const creditsToRedeem = 5n 
const result = await payments.redeemCredits(planId, creditsToRedeem, proof)

Parameters

  • planId: ID of the active payment plan
  • amount: Number of credits to redeem (BigInt)
  • proof: Signature or encoded proof provided with the query

Response

{
  "success": true,
  "creditsRedeemed": "number",
  "remainingBalance": "number"
}

Notes

  • Credits will be deducted from the user’s plan balance
  • Will fail if credits are insufficient or the proof is invalid

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

planId
string
required

The unique identifier of the plan.

Response

200 - application/json

Redemption successful

success
boolean
creditsRedeemed
integer
remainingBalance
integer