Trustap API (0.1.0)

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.

API Keys


Some endpoints such as /charge endpoints can be accessed directly using an API key. API keys are provided as the "username" portion of a basic auth authentication. For example, the Trustap fee for a new online transaction can be determined using the following cURL request with an API key:

curl -u '<api_key>': 'https://dev.stage.trustap.com/api/v1/charge?currency=eur&price=1234'

Deprecation


Deprecated endpoints are tagged with the word DEPRECATED at the start of their description. The deprecation message will describe what endpoints/approach should be used instead.

Note that deprecated endpoints will not be removed from the current version of the API, but their use is discouraged. Furthermore, migrating to later major versions of the API will be made easier by avoiding deprecated endpoints.

Production


This documentation references the staging environment of the Trustap API, which is available at https://dev.stage.trustap.com and uses the trustap-stage realm during authentication. This environment can be used for implementing and testing features using test credit cards, bank accounts, etc.

When all features using Trustap have been implemented and tested sufficiently, the production environment of the Trustap API can be used to process actual currency. This environment is available at https://dev.trustap.com and uses the trustap realm during authentication.

Note that only your client ID will be the same in the staging and production Trustap API environments; your client secret and API key will be different in the two environments.

Download OpenAPI description
Overview
Languages
Servers
https://dev.stage.trustap.com/api/v1/

Online Transactions

Online transactions are used when the goods are delivered using registered mail.

Operations

Cancel this transaction

Request

Transaction can be cancelled until it's paid or if the feature RequireSellerAcceptance is present, it can be cancelled until it's tracked. Offline access is allowed for this endpoint when the user has granted the basic_tx:offline_cancel scope to the client that is performing the request.

Path
transaction_idinteger(int64)required
curl -i -X POST \
  'https://dev.stage.trustap.com/api/v1/transactions/{transaction_id}/cancel' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Responses

OK

Bodyapplication/json
amount_refundedinteger(int64)
amount_releasedinteger(int64)
buyer_idstring
Example: "feb33a87-3917-4538-9260-127c8a6b5232"
cancelledstring(date-time)
chargeinteger(int64)required
Example: 78
charge_international_paymentinteger(int64)
charge_postage_buyerinteger(int64)
charge_postage_clientinteger(int64)
charge_sellerinteger(int64)required
claimed_by_buyerstring(date-time)
client_idstringrequired
Example: "trustap-app"
complainedstring(date-time)
complaintobject(Complaint)
Example: {"description":"Item was fake"}
complaint_period_deadlinestring(date-time)
complaint_period_endedstring(date-time)
createdstring(date-time)required
Example: "2019-12-25T09:00:00Z"
currencystringrequired

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.

Example: "eur"
deliveredstring(date-time)
Example: "2019-12-25T13:00:00Z"
deniedstring(date-time)
descriptionstringrequired
Example: "Soccer ticket"
funds_releasedstring(date-time)
Example: "2019-12-26T14:00:00Z"
idinteger(int64)required
Example: 1309
is_payment_in_progressbooleanrequired

If the transaction is paid via a delayed payment method, such as SEPA debit, this field will be true until the payment has fully succeeded or failed.

join_codestring
joinedstring(date-time)
Example: "2019-12-25T10:00:00Z"
listing_creator_acceptedstring(date-time)
listing_creator_rejectedstring(date-time)
listing_idstring

If the transaction is created from a listing then this is the ID of that listing; otherwise this property is omitted.

listing_typestring(ListingType)
Enum"single_use""multi_use"
Example: "single_use"
paidstring(date-time)
Example: "2019-12-25T11:00:00Z"
payment_acceptedstring(date-time)
payment_refundedstring(date-time)
posta_hr_trackingobject(PostaHrTracking)
Example: {"barcode":"ABC123456","barcode_generated":"2019-12-26T14:00:00Z"}
priceinteger(int64)required
Example: 1234
quantityinteger(int64)required
Example: 1
released_to_sellerboolean
reviewobject(basic.Review)
review_flaggedstring(date-time)
seller_idstring
Example: "ad5bb99f-85bf-47e1-be0d-15e7541c6ad7"
shippo_transaction_idstring
statusstringrequired
Example: "funds_released"
trackedstring(date-time)
Example: "2019-12-25T12:00:00Z"
trackingobject(Tracking)
Example: {"carrier":"ups","tracking_code":"***"}
tracking_details_deadlinestring(date-time)
tracking_details_window_startedstring(date-time)
Response
application/json
{ "buyer_id": "feb33a87-3917-4538-9260-127c8a6b5232", "charge": 78, "charge_seller": 0, "client_id": "trustap-app", "created": "2019-12-25T09:00:00Z", "currency": "eur", "delivered": "2019-12-25T13:00:00Z", "description": "Soccer ticket", "funds_released": "2019-12-26T14:00:00Z", "id": 1309, "is_payment_in_progress": false, "joined": "2019-12-25T10:00:00Z", "paid": "2019-12-25T11:00:00Z", "posta_hr_tracking": { "barcode": "ABC12345", "barcode_generated": "2019-12-25T12:00:00Z" }, "price": 1234, "quantity": 1, "seller_id": "ad5bb99f-85bf-47e1-be0d-15e7541c6ad7", "status": "funds_released", "tracked": "2019-12-25T12:00:00Z", "tracking": { "carrier": "ups", "tracking_code": "***" } }

Cancel this transaction with a guest user

Request

This endpoint cancels a transaction for the user specified in the header as Trustap-User. Transaction can be cancelled until it's paid or if the feature RequireSellerAcceptance is present, it can be cancelled until it's tracked.

Path
transaction_idinteger(int64)required
Headers
Trustap-Userstring

Required in client flows, where you make API calls on behalf of another Trustap user.

curl -i -X POST \
  'https://dev.stage.trustap.com/api/v1/transactions/{transaction_id}/cancel_with_guest_user' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Trustap-User: string'

Responses

OK

Bodyapplication/json
amount_refundedinteger(int64)
amount_releasedinteger(int64)
buyer_idstring
Example: "feb33a87-3917-4538-9260-127c8a6b5232"
cancelledstring(date-time)
chargeinteger(int64)required
Example: 78
charge_international_paymentinteger(int64)
charge_postage_buyerinteger(int64)
charge_postage_clientinteger(int64)
charge_sellerinteger(int64)required
claimed_by_buyerstring(date-time)
client_idstringrequired
Example: "trustap-app"
complainedstring(date-time)
complaintobject(Complaint)
Example: {"description":"Item was fake"}
complaint_period_deadlinestring(date-time)
complaint_period_endedstring(date-time)
createdstring(date-time)required
Example: "2019-12-25T09:00:00Z"
currencystringrequired

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.

Example: "eur"
deliveredstring(date-time)
Example: "2019-12-25T13:00:00Z"
deniedstring(date-time)
descriptionstringrequired
Example: "Soccer ticket"
funds_releasedstring(date-time)
Example: "2019-12-26T14:00:00Z"
idinteger(int64)required
Example: 1309
is_payment_in_progressbooleanrequired

If the transaction is paid via a delayed payment method, such as SEPA debit, this field will be true until the payment has fully succeeded or failed.

join_codestring
joinedstring(date-time)
Example: "2019-12-25T10:00:00Z"
listing_creator_acceptedstring(date-time)
listing_creator_rejectedstring(date-time)
listing_idstring

If the transaction is created from a listing then this is the ID of that listing; otherwise this property is omitted.

listing_typestring(ListingType)
Enum"single_use""multi_use"
Example: "single_use"
paidstring(date-time)
Example: "2019-12-25T11:00:00Z"
payment_acceptedstring(date-time)
payment_refundedstring(date-time)
posta_hr_trackingobject(PostaHrTracking)
Example: {"barcode":"ABC123456","barcode_generated":"2019-12-26T14:00:00Z"}
priceinteger(int64)required
Example: 1234
quantityinteger(int64)required
Example: 1
released_to_sellerboolean
reviewobject(basic.Review)
review_flaggedstring(date-time)
seller_idstring
Example: "ad5bb99f-85bf-47e1-be0d-15e7541c6ad7"
shippo_transaction_idstring
statusstringrequired
Example: "funds_released"
trackedstring(date-time)
Example: "2019-12-25T12:00:00Z"
trackingobject(Tracking)
Example: {"carrier":"ups","tracking_code":"***"}
tracking_details_deadlinestring(date-time)
tracking_details_window_startedstring(date-time)
Response
application/json
{ "buyer_id": "feb33a87-3917-4538-9260-127c8a6b5232", "charge": 78, "charge_seller": 0, "client_id": "trustap-app", "created": "2019-12-25T09:00:00Z", "currency": "eur", "delivered": "2019-12-25T13:00:00Z", "description": "Soccer ticket", "funds_released": "2019-12-26T14:00:00Z", "id": 1309, "is_payment_in_progress": false, "joined": "2019-12-25T10:00:00Z", "paid": "2019-12-25T11:00:00Z", "posta_hr_tracking": { "barcode": "ABC12345", "barcode_generated": "2019-12-25T12:00:00Z" }, "price": 1234, "quantity": 1, "seller_id": "ad5bb99f-85bf-47e1-be0d-15e7541c6ad7", "status": "funds_released", "tracked": "2019-12-25T12:00:00Z", "tracking": { "carrier": "ups", "tracking_code": "***" } }

Get the Trustap fee for a transaction

Request

This returns the Trustap fee, in the currency's smallest unit, for a transaction involving goods with the supplied price. See the Stripe documentation for more details.

Path
transaction_idinteger(int64)required
Query
priceinteger(int64)required

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.

quantityinteger(int64)

When creating transactions from a multi-use listing, the quantity parameter can be provided in order to generate a charge for the given price multiplied by the given quantity. See /multi_use_listings/{listingId}/create_transaction for more details.

payment_methodstring

The payment method that will be used to pay for the transaction. This is necessary because different payment methods may result in different fees.

The default value is card.

curl -i -X GET \
  'https://dev.stage.trustap.com/api/v1/transactions/{transaction_id}/charge?payment_method=string&price=0&quantity=0' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Responses

OK

Bodyapplication/json
chargeinteger(int64)required

The Trustap fee that the buyer will pay, in the currency's smallest unit, for a queried amount. See the Stripe documentation for more details.

Example: 78
charge_calculator_versioninteger(int64)required

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

This property is present for error-handling purposes. The Trustap API allows apps and users to query how much Trustap will charge for a transaction before creating a transaction. Trustap then requires the queried charge to be provided when creating a transaction or listing. At this point the charge is calculated again and checked against the provided charge, to ensure that the charge calculated for the new resource is the same as the one shown to the user. In the unlikely event that the Trustap charge calculator used to calculate the charge has been updated, then the charge_calculator_version property will be used to return an incorrect_calc_version to the API client, which will indicate that the /charge endpoint should be queried again to get the newest charge value.

Example: 5
charge_postage_buyerinteger(int64)

When the transaction handles the generation of postage labels, then charge_postage_buyer will be added to cover this fee together with charge_postage_client

charge_postage_clientinteger(int64)
charge_sellerinteger(int64)required

The Trustap fee that the seller will pay, in the currency's smallest unit, for a queried amount. See the Stripe documentation for more details.

currencystringrequired
Example: "eur"
priceinteger(int64)required
Response
application/json
{ "charge": 78, "charge_calculator_version": 5, "currency": "eur" }

Clients

Clients represent partner applications.

Operations

Users

Users represent users of the platform.

Operations

Personal

Personal endpoints are used for managing personal details for users, for "Know Your Customer" requirements.

Operations

Notifications

Notifications log updates for users.

Operations

F2F Transactions

F2F2 transactions are used when the goods are delivered in person.

Operations

Online Multi-use Listings

These endpoints are no longer supported. We do not recommend using these endpoints.

Operations

Online Single-use Listings

These endpoints are no longer supported. We do not recommend using these endpoints.

Operations

F2F Multi-use Listings

These endpoints are no longer supported. We do not recommend using these endpoints.

Operations

F2F Single-use Listings

These endpoints are no longer supported. We do not recommend using these endpoints.

Operations