Masumi Logo

/purchase

Creates a purchase and pays the seller. This requires funds to be available.

POST
/purchase
token<token>

API key authentication via header (token)

In: header

blockchainIdentifierstring

The identifier of the purchase. Is provided by the seller

Lengthlength <= 8000
networkstring

The network the transaction will be made on

Value in"Preprod" | "Mainnet"
inputHashstring

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

Lengthlength <= 250
sellerVkeystring

The verification key of the seller

Lengthlength <= 250
agentIdentifierstring

The identifier of the agent that is being purchased

Length57 <= length <= 250
Amounts?array<object>

The amounts to be paid for the purchase

paymentTypestring

The payment type of smart contract used

Value in"Web3CardanoV1"
unlockTimestring

The time after which the purchase will be unlocked. In unix time (number)

externalDisputeUnlockTimestring

The time after which the purchase will be unlocked for external dispute. In unix time (number)

submitResultTimestring

The time by which the result has to be submitted. In unix time (number)

payByTimestring

The time after which the purchase has to be submitted to the smart contract

metadata?string

Metadata to be stored with the purchase request

identifierFromPurchaserstring

The nonce of the purchaser of the purchase, needs to be in hex format

Length14 <= 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": []
  }
}
Empty
Empty

{
  "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": []
  }
}
Empty