payment

Create a new payment request. (+PAY access required)

Changed on

Creates a payment request and identifier. This will check incoming payments in the background.

post/payment

Request

  • Base URL: ./../api/v1/ (relative, and the document was published on a file host, not at the API’s origin)
  • URL: ./../api/v1/payment
  • Auth: API key in header token

Request body

inputHashstring required

The hash of the input data of the payment, should be sha256 hash of the input data, therefore needs to be in hex string format

network'Preprod' | 'Mainnet' required

The network the payment will be received on

agentIdentifierstring required

The identifier of the agent that will be paid

paymentSourceType'Web3CardanoV1' | 'Web3CardanoV2'

Expected payment source type for this request

supportedPaymentSourceIndexinteger

Required for V2 Cardano payments and forbidden for V1. Selects the independently-priced source by its index in supported_payment_sources.

metadatastring

Metadata to be stored with the payment request

sellerReturnAddressstring

Optional seller return address. Defaults to the selling hot wallet collection address when available.

identifierFromPurchaserstring required

A unique nonce from the purchaser. It must be in hex format

forceLayer'L1' | 'Hydra'

Optional seller layer override. For V2 this choice is signed into the purchase terms: "Hydra" requires an open head, "L1" forces L1, and a conflict with the buyer's forceLayer is rejected. Hydra is not supported for V1. Omit for automatic routing.

Example request

{
  "agentIdentifier": "agent_identifier",
  "network": "Preprod",
  "inputHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "payByTime": "1970-01-20T20:00:26.260Z",
  "metadata": "(private) metadata to be stored with the payment request",
  "submitResultTime": "1970-01-20T20:00:36.260Z",
  "identifierFromPurchaser": "aabbaabb11221122aabb"
}

Response

Payment request created

statusstring required

Example response

{
  "status": "Success",
  "data": {
    "id": "cuid_v2_auto_generated",
    "blockchainIdentifier": "blockchain_identifier",
    "agentIdentifier": "agent_identifier",
    "agentName": "Example Agent",
    "pricingType": "Fixed",
    "createdAt": "1970-01-20T20:00:36.260Z",
    "updatedAt": "1970-01-20T20:00:36.260Z",
    "submitResultTime": "0",
    "unlockTime": "0",
    "externalDisputeUnlockTime": "0",
    "lastCheckedAt": null,
    "cooldownTime": 0,
    "payByTime": null,
    "cooldownTimeOtherParty": 0,
    "collateralReturnLovelace": null,
    "buyerReturnAddress": null,
    "sellerReturnAddress": null,
    "requestedById": "requester_id",
    "resultHash": "result_hash",
    "onChainState": null,
    "forceLayer": null,
    "inputHash": "input_hash",
    "NextAction": {
      "requestedAction": "AuthorizeRefundRequested",
      "errorType": null,
      "errorNote": null,
      "resultHash": null
    },
    "CurrentTransaction": null,
    "RequestedFunds": [
      {
        "unit": "",
        "amount": "10000000"
      }
    ],
    "PaymentSource": {
      "id": "payment_source_id",
      "network": "Preprod",
      "paymentSourceType": "Web3CardanoV1",
      "smartContractAddress": "address",
      "policyId": "policy_id"
    },
    "WithdrawnForSeller": [],
    "WithdrawnForBuyer": [],
    "BuyerWallet": null,
    "SmartContractWallet": null,
    "metadata": null,
    "totalBuyerCardanoFees": 0,
    "totalSellerCardanoFees": 0,
    "nextActionOrOnChainStateOrResultLastChangedAt": "1970-01-20T20:00:36.260Z",
    "nextActionLastChangedAt": "1970-01-20T20:00:36.260Z",
    "onChainStateOrResultLastChangedAt": "1970-01-20T20:00:36.260Z"
  }
}

Changes

    • breaking

      the // request property's maxLength was decreased to 19

    • breaking

      added the pattern ^\d+$ to the request property //

    • info

      added the new optional request property

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the required property / to the response with the status

    • breaking

      removed the required property / from the response with the status

    • warning

      removed the request property

    • warning

      removed the optional property // from the response with the status

    • warning

      removed the optional property // from the response with the status

    • info

      the // request property's maxLength was increased from 19 to 25

    • info

      removed the pattern ^\d+$ from the request property //