# Trustap API

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](https://stripe.com/docs/currencies#zero-decimal) 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
transaction can be determined using the following cURL request with an
API key:

``` bash
curl -i -X GET -u '<API_KEY>:' 'https://api.test.trustap.com/v2/fees?currency=usd&amount=896'
```

Deprecation
-----------

Deprecated endpoints have a description that describes what
endpoints/approach should be used instead.

Deprecated endpoints will remain available in the current API version, but
will be removed from subsequent API versions. To ensure a smooth migration
to later API versions, avoid using deprecated endpoints and replace them
with their recommended alternatives when they are deprecated.

Production
----------

This documentation references the staging environment of the Trustap
API, which is available at `https://api.test.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://api.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.


Version: 2.0.1

## Servers

```
https://api.test.trustap.com
```

## Security

### APIKey

Type: http
Scheme: basic

### OAuth2

Type: oauth2
Authorization URL: https://sso.trustap.com/auth/realms/trustap-stage/protocol/openid-connect/auth
Token URL: https://sso.trustap.com/auth/realms/trustap-stage/protocol/openid-connect/token
Scopes:

## Download OpenAPI description

 - [Trustap API](https://docs.trustap.com/_bundle/apis/@v2.0/openapi.yaml)

## Buyers and Sellers

 - [POST /v2/guest_users](https://docs.trustap.com/apis/openapi/buyers-and-sellers/v2_users.createguestuser.md): This endpoint creates a new guest user which can be used as the buyer or the seller in a transaction. Guest users can be used to create transactions for users that don't yet have login details, or who
 - [GET /v2/users/{user_id}/account_status](https://docs.trustap.com/apis/openapi/buyers-and-sellers/v2_users.getaccountpayoutstatus.md): This endpoint returns the status of the ability of the user identified by the `user_id` in the path to accept payouts. It can only be accessed with an API key.
## Payment

 - [GET /v2/fees](https://docs.trustap.com/apis/openapi/payment/v2_transactions.getfees.md): This returns the Trustap fee, in the `currency`'s smallest unit, for a transaction involving goods with the supplied `amount`. See [the Stripe documentation](https://stripe.com/docs/currencies#zero-de
 - [POST /v2/transactions/{transaction_id}/accept_payment](https://docs.trustap.com/apis/openapi/payment/v2_transactions.acceptpaymentfortransaction.md)
## Transactions

 - [POST /v2/transactions](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.createtransaction.md): Offline access is allowed for this endpoint.
 - [GET /v2/transactions/{transaction_id}](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.gettransaction.md)
 - [GET /v2/transactions/{transaction_id}/bank_transfer_details](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.getbanktransferdetails.md): Get the bank transfer details for a transaction with payment method `bank_transfer`.
 - [GET /v2/transactions/{transaction_id}/buyer_details](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.getbuyerdetailsfortransaction.md)
 - [POST /v2/transactions/{transaction_id}/cancel](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.canceltransaction.md)
 - [POST /v2/transactions/{transaction_id}/claim](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.claimtransaction.md): This endpoint enables a client to claim a transaction on behalf of a Trustap user as a buyer or seller. This endpoint can only be accessed by clients.
 - [POST /v2/transactions/{transaction_id}/items](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.addtransactionitems.md): Adds one or more items to a transaction. Items with a `recurring_period` are billed automatically on that interval.
 - [POST /v2/transactions/{transaction_id}/metadata](https://docs.trustap.com/apis/openapi/transactions/v2_transactions.settransactionmetadata.md)
## Transaction Issues

 - [POST /v2/transactions/{transaction_id}/accept_complaint](https://docs.trustap.com/apis/openapi/transaction-issues/v2_transactions.acceptcomplaintfortransaction.md)
 - [POST /v2/transactions/{transaction_id}/submit_complaint](https://docs.trustap.com/apis/openapi/transaction-issues/v2_transactions.submitcomplaintfortransaction.md): A complaint is submitted for problems with transactions after the order has been shipped or handover has been confirmed. Before that an order issue should be submitted instead.
 - [POST /v2/transactions/{transaction_id}/submit_order_issue](https://docs.trustap.com/apis/openapi/transaction-issues/v2_transactions.submitorderissuefortransaction.md): An order issue is submitted for problems with transactions after payment confirmation and before the order has been shipped or handover has been confirmed. After that a complaint should be submitted i
## Handover

 - [POST /v2/transactions/{transaction_id}/confirm_handover](https://docs.trustap.com/apis/openapi/handover/v2_transactions.confirmhandoverfortransaction.md): This endpoint is deprecated. Use the `confirm delivery for transaction` endpoint instead.
## Shipping

 - [GET /v2/carriers](https://docs.trustap.com/apis/openapi/shipping/v2_transactions.getsupportedcarriers.md): This returns the carriers that are currently supported for automated tracking. The carrier `name` should be shown to users but the `code` should be submitted to the `/track` endpoint when submitting t
 - [POST /v2/transactions/{transaction_id}/confirm_delivery](https://docs.trustap.com/apis/openapi/shipping/v2_transactions.confirmdeliveryfortransaction.md): This endpoint allows a user to confirm the delivery of the item in the case that the state of the transaction was not updated asynchronously by Trustap
 - [GET /v2/transactions/{transaction_id}/shipping_details](https://docs.trustap.com/apis/openapi/shipping/v2_transactions.getshippingdetailsfortransaction.md)
 - [POST /v2/transactions/{transaction_id}/shipping_details](https://docs.trustap.com/apis/openapi/shipping/v2_transactions.setshippingdetailsfortransaction.md)
 - [POST /v2/transactions/{transaction_id}/track](https://docs.trustap.com/apis/openapi/shipping/v2_transactions.tracktransaction.md): After the tracking information has been submitted then the state of the transaction will be updated asynchronously by Trustap once the delivery of the item has been confirmed, at which point the `deli
