Trustap API API Reference

The Trustap API is a REST-based API for managing user data and transactions for Trustap users.

Note that, like Stripe, all API price and charge fields expect amounts to be provided in a currency’s smallest unit. See the Stripe documentation for more details.

Note that Trustap only supports usd as currency at present.

API Endpoint
https://dev.trustap.com/api/v1
Contact: help@trustap.com
Schemes: https
Version: 0.1.0

Authentication

OAuth2

flow
accessCode
authorizationUrl
https://dev.trustap.com/api/v1/oauth2/authorize
tokenUrl
https://dev.trustap.com/api/v1/oauth2/token

Paths

Get transactions for the logged-in user

GET /me/transactions

Transactions are currently sorted by ID.

after_id

Only return transactions that were created chronologically after the transaction with this ID (i.e. with smaller IDs)

type
integer (int64) , { x ∈ ℤ | x ≥ 0 }
in
query
limit

The maximum number of transactions to return

type
integer (int64) , { x ∈ ℤ | 1 ≤ x ≤ 50 } 25
in
query
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
[
  {
    "id": "integer (int64)",
    "currency": "string",
    "price": "integer (int64)",
    "charge": "integer (int64)",
    "descr": "string",
    "created": "string",
    "buyer_id": "integer (int64)",
    "seller_id": "integer (int64)",
    "joined": "string",
    "paid": "string",
    "tracked": "string",
    "delivered": "string",
    "complained": "string",
    "funds_released": "string",
    "join_code": "string"
  }
]

Create a new Trustap transaction

POST /me/transactions

A request to this endpoint must be preceded by a call to /charge with the price of the goods specified in price. The charge returned from charge MUST be shown to the user to accept, and included in the final cost displayed for the transaction.

role: Role
currency: Currency
price: integer (int64)

The price of the goods being sold, in the currency's smallest unit. The charge value should correspond to the Trustap charge created with this price, otherwise this request will fail with a 400 error.

description: string

A description of the goods being sold.

charge: integer (int64)

The charge value returned from a request to /charge.

charge_calculator_version: integer (int64)

The charge_calculator_version value returned from a request to /charge.

Request Content-Types: application/json
Request Example
{
  "role": "string",
  "currency": "string",
  "price": "integer (int64)",
  "description": "string",
  "charge": "integer (int64)",
  "charge_calculator_version": "integer (int64)"
}
201 Created

Created

400 Bad Request

Bad request

Response Content-Types: application/json
Response Example (201 Created)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Get personal information for the logged-in user

GET /me/personal
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "name": {
    "first": "string",
    "last": "string"
  },
  "address": {
    "city": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "postal_code": "string",
    "country_code": "string"
  },
  "dob": {
    "day": "integer (int64)",
    "month": "integer (int64)",
    "year": "integer (int64)"
  },
  "tos_acceptance": {
    "unix_timestamp": "integer (int64)",
    "ip": "string",
    "user_agent": "string"
  }
}

Update personal information for the logged-in user

PUT /me/personal
name: Name
address: Address
dob: Dob
Request Content-Types: application/json
Request Example
{
  "name": {
    "first": "string",
    "last": "string"
  },
  "address": {
    "city": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "postal_code": "string",
    "country_code": "string"
  },
  "dob": {
    "day": "integer (int64)",
    "month": "integer (int64)",
    "year": "integer (int64)"
  }
}
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "name": {
    "first": "string",
    "last": "string"
  },
  "address": {
    "city": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "postal_code": "string",
    "country_code": "string"
  },
  "dob": {
    "day": "integer (int64)",
    "month": "integer (int64)",
    "year": "integer (int64)"
  },
  "tos_acceptance": {
    "unix_timestamp": "integer (int64)",
    "ip": "string",
    "user_agent": "string"
  }
}

Confirm that the logged-in user accepted the Trustap Terms of Service and the Stripe Connected Account Agreement

POST /me/accept_tos

Note that the client making this request must have presented the logged-in user with the Trustap Terms of Service and the Stripe Connected Account Agreement, and this user must have expressly consented to the agreement, prior to making this request. See https://stripe.com/docs/connect/updating-accounts#tos-acceptance for more details.

undefined
Request Content-Types: application/json
Request Example
{
  "unix_timestamp": "integer (int64)",
  "ip": "string",
  "user_agent": "string"
}
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "name": {
    "first": "string",
    "last": "string"
  },
  "address": {
    "city": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "postal_code": "string",
    "country_code": "string"
  },
  "dob": {
    "day": "integer (int64)",
    "month": "integer (int64)",
    "year": "integer (int64)"
  },
  "tos_acceptance": {
    "unix_timestamp": "integer (int64)",
    "ip": "string",
    "user_agent": "string"
  }
}

Add a credit account for the logged-in user

POST /me/credit_account
type: CreditAccountType
bank_details: BankDetails
card_details: CardDetails
Request Content-Types: application/json
Request Example
{
  "type": "string",
  "bank_details": {
    "account_number": "string",
    "country_code": "string",
    "currency": "string",
    "routing_number": "string"
  },
  "card_details": "string"
}
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "bank_account": {
    "country": "string",
    "currency_alpha_2": "string",
    "last4": "string",
    "bank_name": "string",
    "routing": "string"
  },
  "card": {
    "last4": "string",
    "month": "integer (uint8)",
    "year": "integer (uint16)"
  }
}

Get the Trustap fee for a transaction

GET /charge

This returns the Trustap fee, in US cents, for a transaction involving goods with the supplied price.

currency

The currency that the price is specified in.

type
string
in
query
price

The price of the goods being sold in this transaction, in the currency's smallest unit. For example, if a trading card is being sold for $12.34 (with currency as usd), then the request for the charge for this transaction would be /charge?price=1234&currency=usd.

type
integer (int64)
in
query
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "currency": "string",
  "charge": "integer (int64)",
  "charge_calculator_version": "integer (int64)"
}

Get a transaction using a join code

GET /transactions
join_code

(no description)

type
string
in
query
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Join a transaction using a join code

PUT /transactions

A transaction can't be joined using its ID, because only the buyer and seller of a transaction can access a transaction using its ID.

join_code

(no description)

type
string
in
query
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Reject a transaction by its join code

POST /transactions-by-join-code/{joinCode}/reject

A transaction can't be rejected using its ID, because only the buyer and seller of a transaction can access a transaction using its ID.

joinCode

(no description)

type
string
in
path
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Get a transaction by its ID

GET /transactions/{transactionId}
transactionId

(no description)

type
integer (int64)
in
path
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Set payment details and process payment for this transaction

POST /transactions/{transactionId}/pay
stripe_token: string

stripe_token is a card token ID received from Stripe. It is generated using a publishable Stripe key from Trustap. See https://stripe.com/docs/stripe-js and https://stripe.com/docs/checkout for methods for generating this token.

transactionId

(no description)

type
integer (int64)
in
path
Request Content-Types: application/json
Request Example
{
  "stripe_token": "string"
}
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Set postal tracking details for this transaction

POST /transactions/{transactionId}/track
carrier: Carrier
tracking_code: string
transactionId

(no description)

type
integer (int64)
in
path
Request Content-Types: application/json
Request Example
{
  "carrier": "string",
  "tracking_code": "string"
}
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Submit a complaint for this transaction

POST /transactions/{transactionId}/complain
transactionId

(no description)

type
integer (int64)
in
path
200 OK

OK

Response Content-Types: application/json
Response Example (200 OK)
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}

Schema Definitions

Address: object

city: string
line1: string
line2: string
state: string
postal_code: string
country_code: string
Example
{
  "city": "string",
  "line1": "string",
  "line2": "string",
  "state": "string",
  "postal_code": "string",
  "country_code": "string"
}

BankAccount: object

country: string
currency_alpha_2: string
last4: string
bank_name: string
routing: string
Example
{
  "country": "string",
  "currency_alpha_2": "string",
  "last4": "string",
  "bank_name": "string",
  "routing": "string"
}

BankDetails: object

account_number: string
country_code: string
currency: string
routing_number: string
Example
{
  "account_number": "string",
  "country_code": "string",
  "currency": "string",
  "routing_number": "string"
}

Card: object

last4: string
month: integer (uint8)
year: integer (uint16)
Example
{
  "last4": "string",
  "month": "integer (uint8)",
  "year": "integer (uint16)"
}

CardDetails: string

stripe_token is a card token ID received from Stripe. It is generated using a publishable Stripe key from Trustap. See https://stripe.com/docs/stripe-js and https://stripe.com/docs/checkout for methods for generating this token.

Example
"string"

Carrier: string , x ∈ { fedex , ups , usps }

Example
"string"

Charge: object

currency: string
charge: integer (int64)

The Trustap fee, in US cents, for a queried amount.

charge_calculator_version: integer (int64)

The version of the Trustap charge calculator that was used to calculate this charge.

Example
{
  "currency": "string",
  "charge": "integer (int64)",
  "charge_calculator_version": "integer (int64)"
}

CreditAccount: object

bank_account: BankAccount
card: Card
Example
{
  "bank_account": {
    "country": "string",
    "currency_alpha_2": "string",
    "last4": "string",
    "bank_name": "string",
    "routing": "string"
  },
  "card": {
    "last4": "string",
    "month": "integer (uint8)",
    "year": "integer (uint16)"
  }
}

CreditAccountType: string , x ∈ { bank , card }

Example
"string"

Currency: string , x ∈ { usd }

Example
"string"

Dob: object

day: integer (int64)
month: integer (int64)
year: integer (int64)
Example
{
  "day": "integer (int64)",
  "month": "integer (int64)",
  "year": "integer (int64)"
}

Name: object

first: string
last: string
Example
{
  "first": "string",
  "last": "string"
}

PersonalInfo: object

name: Name
address: Address
dob: Dob
tos_acceptance: TosAcceptance
Example
{
  "name": {
    "first": "string",
    "last": "string"
  },
  "address": {
    "city": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "postal_code": "string",
    "country_code": "string"
  },
  "dob": {
    "day": "integer (int64)",
    "month": "integer (int64)",
    "year": "integer (int64)"
  },
  "tos_acceptance": {
    "unix_timestamp": "integer (int64)",
    "ip": "string",
    "user_agent": "string"
  }
}

Role: string , x ∈ { buyer , seller }

Example
"string"

TosAcceptance: object

The time at which and location from which the logged-in user accepted the Trustap Terms of Service and the Stripe Connected Account Agreement.

unix_timestamp: integer (int64)
ip: string
user_agent: string
Example
{
  "unix_timestamp": "integer (int64)",
  "ip": "string",
  "user_agent": "string"
}

Transaction: object

id: integer (int64)
currency: string

The currency of the transaction. Note that, at present, the buyer must pay using the transaction's currency and the seller will be paid in the transaction's currency.

price: integer (int64)
charge: integer (int64)
descr: string
created: string
buyer_id: integer (int64)
seller_id: integer (int64)
joined: string
paid: string
tracked: string
delivered: string
complained: string
funds_released: string
join_code: string
Example
{
  "id": "integer (int64)",
  "currency": "string",
  "price": "integer (int64)",
  "charge": "integer (int64)",
  "descr": "string",
  "created": "string",
  "buyer_id": "integer (int64)",
  "seller_id": "integer (int64)",
  "joined": "string",
  "paid": "string",
  "tracked": "string",
  "delivered": "string",
  "complained": "string",
  "funds_released": "string",
  "join_code": "string"
}