Developer

Purchases

Signature, parameters, an example call and the sample response for every method in this group, generated from the contract.

lid.purchases.prepare

build the unsigned purchase so YOUR user signs it with their wallet

Key permission: catalogo (catalog)

lid.purchases.prepare(input, options?)

NameTypeRequiredSource
productPdastringRequiredbody
buyerstringRequiredbody
affiliateCodestringOptionalbody
SDK
const result = await lid.purchases.prepare({
  productPda: '…',
  buyer: '…',
});
Response
{
  "ok": true,
  "txBase64": "AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA…",
  "buyer": "Hb6dzd4pYxmFYKkJDWuhzBEUkkaE93sFcvXYtriTkmw9",
  "productPda": "7Thx4DKF8ST1MFvpbDDgYJwS2eWgeVyQ5crEpPzsYtnN",
  "receiptPda": "FcJg9cCeByCxEGNGNvntkDhsRgDSuaxzyia91XG11Tdz",
  "purchaseNonce": "253ab455-b3b6-4f42-be3b-afee116c3299",
  "affiliateCode": null,
  "amounts": {
    "price": "100000",
    "platformFee": "3000",
    "affiliate": "0",
    "creator": "97000"
  },
  "blockhash": "CJCeFTQqDwofmWyJHyyfwMCSHTLmD9DhURDjRCjfRPPo",
  "lastValidBlockHeight": 491731574,
  "next": "Hacé que el comprador firme esta tx con su walle…"
}

lid.purchases.confirm

confirm a broadcast purchase and queue it for the listener

Key permission: catalogo (catalog)

lid.purchases.confirm(input, options?)

NameTypeRequiredSource
signaturestringRequiredbody
SDK
const result = await lid.purchases.confirm({
  signature: '…',
});

Hand-written sample (not captured on devnet yet)

Response
{
  "ok": true,
  "signature": "SfBVM6Jkay1vCXBCMoyum6vJECMTwmKAefJtQigQKQktfYjC4KiBXChuUg7VAnENa7xHLKJ3PTL2tRzvMqBs9pPE",
  "slot": 348219044,
  "receipt": {
    "receiptPda": "vDzbN4r1FZDWQ7GFFEU4wfvJhibAQVAQFrXNg95iHkFj",
    "productPda": "QUhSBF5ymKR22nXRbvnhCyLgNdVZK2213Gud3g4EcdzH",
    "buyer": "AuPxKKgShPSEow8PZ8gUmqgHxHrmeL7fue4DGRJri9uk",
    "pricePaid": "5000000"
  },
  "status": "recorded"
}

lid.purchases.list

what the agent wallet bought, with the deliverable files

Key permission: none (read)

lid.purchases.list(input?, options?)

NameTypeRequiredSource
limitnumberOptionalquery
SDK
const result = await lid.purchases.list();
Response
{
  "ok": true,
  "purchases": [],
  "total": 0
}

lid.purchases.create

buy a product with the agent wallet (optional maxPriceUsdc cap)

Key permission: dinero (money)

lid.purchases.create(input, options?)

NameTypeRequiredSource
productPdastringRequiredbody
maxPriceUsdcstringOptionalbody
SDK
const result = await lid.purchases.create({
  productPda: '…',
});

Hand-written sample (not captured on devnet yet)

Response
{
  "ok": true,
  "signature": "JnZkCXRtsFj5eZDcozKY1DSc7dVCGyrjN9KHAau9WT2kJwHWn9yfFdYzuwMw8Cuw4xhQtjvH4L4MRx8A4HhWewT9",
  "receiptPda": "eDdVMxtKqMYBN83LKjX27h6YXaHJzJb8UfdqQvKrAC8F",
  "purchaseNonce": "88e7f332-5777-4ee6-a28f-2d58c5ba7dc2",
  "priceAtomic": "5000000",
  "platformFeeAtomic": "5000000",
  "creatorAmountAtomic": "5000000",
  "buyer": "DefE5oyWvh86cRsRmx3emrp2YdfVddBbgWeHDDpJfMKz",
  "explorer": "https://solscan.io/tx/P3zahjvryH9kuoMjEueECRLHfUJj78WPWmvLQS2kS6Efdw7QgygcEAWJa6GYwJB26FFg1eesPiGsEHfWqvnN38m3",
  "note": "The receipt and files show up in GET /agent/purchases once the listener records it."
}