Skip to content

Metadata

The Trustap API transaction supports a metadata field.

  • The metadata field stores key-value pairs in a JSON format.
  • You can store up to 100 key-value pairs.
  • The maximum length of each JSON key is 40 characters and each JSON value is 100 characters.
  • Only strings are supported.

If you exceed your 100 key-value pairs, you will receive an error too_many_metadata_fields.

Add metadata to an existing transaction

Metadata can only be added to existing transactions. In this example, the transaction ID is tx_01kv7vtr9vfr5rnttm3n4x17z2. The response is the entire transaction object including all metadata associated with a

curl -i -X POST \
  -u '<API_KEY>:​' \
  'https://api.test.trustap.com/v2/transactions/tx_01kv7vtr9vfr5rnttm3n4x17z2/metadata' \
  -H 'Content-Type: application/json' \
  -d '{"customer_url":"https://my-bike-parts.com/","part_number":"98932"}'

Read metadata

Metadata is part of the transaction object. To read metadata, retrieve the transaction and extract the metadata field.

 curl -i -X GET \
  -u '<API_KEY>:' \
  'https://api.test.trustap.com/v2/transactions/tx_01kv7vtr9vfr5rnttm3n4x17z2'

Update metadata

You cannot delete a metadata entry but you can update an existing entry. You can add additional key-value pairs without overwriting existing metadata up to the maximum of 100 key-value pairs. The Trustap API supports updating existing values and adding new key-value pairs in the same call.

curl -i -X POST \
  -u '<API_KEY>:'​ \
  'https://api.test.trustap.com/v2/transactions/tx_01kv7vtr9vfr5rnttm3n4x17z2/metadata' \
  -H 'Content-Type: application/json' \
  -d '{"customer_url":"https://my-bike-parts.com/","part_number":"55555"}'