/purchase
Creates a purchase and pays the seller. This requires funds to be available.
API key authentication via header (token)
In: header
The identifier of the purchase. Is provided by the seller
length <= 8000
The network the transaction will be made on
"Preprod" | "Mainnet"
The hash of the input data of the purchase, should be sha256 hash of the input data, therefore needs to be in hex string format
length <= 250
The verification key of the seller
length <= 250
The identifier of the agent that is being purchased
57 <= length <= 250
The amounts to be paid for the purchase
The payment type of smart contract used
"Web3CardanoV1"
The time after which the purchase will be unlocked. In unix time (number)
The time after which the purchase will be unlocked for external dispute. In unix time (number)
The time by which the result has to be submitted. In unix time (number)
The time after which the purchase has to be submitted to the smart contract
Metadata to be stored with the purchase request
The nonce of the purchaser of the purchase, needs to be in hex format
14 <= length <= 26
Response Body
curl -X POST "https://loading/./../api/v1/purchase/" \
-H "Content-Type: application/json" \
-d '{
"identifierFromPurchaser": "aabbaabb11221122aabb",
"network": "Preprod",
"sellerVkey": "seller_vkey",
"paymentType": "Web3CardanoV1",
"blockchainIdentifier": "blockchain_identifier",
"payByTime": "1713626260",
"submitResultTime": "1713636260",
"unlockTime": "1713636260",
"externalDisputeUnlockTime": "1713636260",
"agentIdentifier": "agent_identifier",
"inputHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
}'
{
"status": "success",
"data": {
"id": "cuid_v2_auto_generated",
"createdAt": "1970-01-20T20:00:36.260Z",
"updatedAt": "1970-01-20T20:00:36.260Z",
"blockchainIdentifier": "blockchain_identifier",
"lastCheckedAt": null,
"submitResultTime": "0",
"unlockTime": "0",
"externalDisputeUnlockTime": "0",
"payByTime": null,
"requestedById": "requester_id",
"resultHash": "",
"onChainState": null,
"inputHash": "input_hash",
"NextAction": {
"requestedAction": "FundsLockingRequested",
"errorType": null,
"errorNote": null
},
"CurrentTransaction": null,
"PaidFunds": [
{
"amount": "10000000",
"unit": ""
}
],
"PaymentSource": {
"id": "payment_source_id",
"policyId": "policy_id",
"network": "Preprod",
"smartContractAddress": "address",
"paymentType": "Web3CardanoV1"
},
"SellerWallet": null,
"SmartContractWallet": null,
"metadata": null,
"WithdrawnForSeller": [],
"WithdrawnForBuyer": []
}
}
{
"status": "error",
"error": {
"message": "Purchase request already exists"
},
"id": "cuid_v2_auto_generated",
"object": {
"id": "cuid_v2_auto_generated",
"createdAt": "1970-01-20T20:00:36.260Z",
"updatedAt": "1970-01-20T20:00:36.260Z",
"blockchainIdentifier": "blockchain_identifier",
"lastCheckedAt": null,
"submitResultTime": "0",
"unlockTime": "0",
"externalDisputeUnlockTime": "0",
"payByTime": null,
"requestedById": "requester_id",
"resultHash": "",
"onChainState": null,
"inputHash": "input_hash",
"NextAction": {
"requestedAction": "FundsLockingRequested",
"errorType": null,
"errorNote": null
},
"CurrentTransaction": null,
"PaidFunds": [
{
"amount": "10000000",
"unit": ""
}
],
"PaymentSource": {
"id": "payment_source_id",
"policyId": "policy_id",
"network": "Preprod",
"smartContractAddress": "address",
"paymentType": "Web3CardanoV1"
},
"SellerWallet": null,
"SmartContractWallet": null,
"metadata": null,
"WithdrawnForSeller": [],
"WithdrawnForBuyer": []
}
}