Shell Python

Introduction

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Accept crypto payments. Personal and business wallet - all in one.

The UseGateway API provides a simple and powerful REST API to integrate Bitcoin, Ethereum, Litecoin, Tron, Binance Smart Chain, BUSD BEP-20, USDT BEP-20 and USDT TRC-20 payments into your business or application. This API reference provides information on available endpoints and how to interact with them.

Authentication

Authorized request example

# You can also use wget
curl -X GET https://api.usegateway.net/v1/payments/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/payments/', headers = headers)

print(r.json())

Most requests to the UseGateway API must be authenticated with an API key. You can create an API key in your Settings page after creating an UseGateway account.

Authenticated API requests should be made with a x-api-key header. Your secret API key should be passed as the value.

If authentication fails, a JSON object with an error message will be returned as a response along with HTTP status 401.

Versioning

The URLs for the various resources use the following pattern:

https://api.usegateway.net/v{version}/{operation-specific component}

The components of the URL are:

version - the API version. Currently there is only one version, "1", in operation operation-specific component - this identifies the actual operation you want to do, eg /payments for getting a list of payments

Thus the URL getting a list of the orders for the authenticated user is https://api.usegateway.net/v1/payments

Pagination

All GET endpoints which return an object list support cursor based pagination with pagination information inside a pagination object. Use parameter page and limit to configure pagination. Default limit is set to 50 but values up to 100 are permitted.

Example responses

200 Response

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "type": "crypto",
      "address": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
      "value": {
        "amount": 10,
        "currency": "USDT_TRC20"
      },
      "comment": "tg: @username",
      "timeline": [
        {
          "status": "Received",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Declined",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ],
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Parameters

Name Description
total Total objects in query
page Page of query
size Number of results per call. Accepted values: 0 - 100. Default 50

Errors

All error messages include a type identifier and a human readable message. validation_error with status code 400 is returned when the validation of the resource fails on POST or PUT/PATCH requests. Response contains errors field with a list of errors.

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The object requested is hidden for administrators only.
404 Not Found -- The specified object could not be found.
405 Method Not Allowed -- You tried to access a object with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The object requested has been removed from our servers.
422 Validation Error -- Your request data or params are invalid.
429 Too Many Requests -- You're requesting too many objects! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503, 509 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Webhooks

Webhooks make it easier to integrate with UseGateway by allowing you to subscribe to a set of events. You can subscribe to the events by going to your settings page and adding a new webhook subscription. When you create a new subscription, you can specify what events you would like to receive updates for.

Example of a webhook payload

{
    "event": "payment.completed",
    "created_at": "2022-07-31T20:50:02Z",
    "data": {
        "id": "24934862-d980-46cb-9402-43c81b0cdba6",
        "resource": "payment",
        "code": "66BEOV2A",
        "name": "Product",
        "description": "The best Product",
        "hosted_url": "https://usegateway.app/payments/YJM5BAID",
        "created_at": "2019-08-24T14:15:22Z",
        "expires_at": "2019-08-24T14:15:22Z",
        "confirmed_at": null,
        "timeline": [
          {
            "status": "Opened",
            "created_at": "2019-08-24T14:15:22Z"
          },
          {
            "status": "Completed",
            "created_at": "2019-08-24T14:15:22Z"
          }
        ],
        "metadata": {},
        "pricing_type": "fixed_price",
        "transactions": [],
        "addresses": {
          "BTC": "mymZkiXhQNd6VWWG7VGSVdDX9bKmviti3U",
          "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
        },
        "pricing": {
          "tron": {
            "amount": 145.622008,
            "currency": "TRX"
          },
          "local": {
            "amount": 10,
            "currency": "USD"
          }
       }
    }
}

Events

Event Description
payment.created New payment is created
payment.completed Transaction has been confirmed and the associated payment is completed
payment.expired Payment has been expired
payment.unresolved Payment had some problems
payment.resolved Payment has been resolved
payment.closed Payment has been closed
invoice.created New invoice is created
invoice.viewed Invoice has been viewed
invoice.expired Invoice has been expired
invoice.renewed Invoice has been renewed and recalculated
invoice.paid Transaction has been confirmed and the associated invoice is paid
invoice.unresolved Invoice had some problems
invoice.resolved Invoice has been resolved
invoice.closed Invoice has been closed
deposit.created New deposit is created
deposit.replenished Transaction has been confirmed and the deposit was replenished
deposit.unresolved Underpaid replenishment
deposit.resolved Deposit has been resolved
deposit.closed Deposit has been closed
transaction.refunded Transaction has been refunded
withdrawal.completed Withdrawal has been completed
withdrawal_request.created New withdrawal request is created
withdrawal_request.approved Withdrawal request has been paid and approved
withdrawal_request.declined Withdrawal request has been declined

Fields

Field Type Description
event WebhookEvent Webhook event
created_at timestamp Delivery time
data object Corresponding resource object

Securing Webhooks

Because of the way webhooks work, attackers can impersonate services by simply sending a fake webhook to an endpoint. Think about it: it's just an HTTP POST from an unknown source. This is a potential security hole for many applications, or at the very least, a source of problems.

In order to prevent it, UseGateway signs every webhook and its metadata with a unique key for each endpoint. This signature can then be used to verify the webhook indeed comes from UseGateway, and only process it if it is.

Verifying Webhook with the Svix Libraries

First install the libraries if you haven't already:

# Install cURL. E.g. on arch linux:
pacman -S curl
pip install svix

The payload is the raw (string) body of the request, and the headers are the headers passed in the request.

Then verify webhooks using the code below.

No easy way to verify the signature just with cURL.
from svix.webhooks import Webhook

secret = "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"

# These were all sent from the server
headers = {
  "svix-id": "msg_p5jXN8AQM9LWM0D4loKWxJek",
  "svix-timestamp": "1614265330",
  "svix-signature": "v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE=",
}
payload = '{"test": 2432232314}'

wh = Webhook(secret)
# Throws on error, returns the verified content on success
payload = wh.verify(payload, headers)

Verifying Webhook manually

Each webhook call includes three headers with additional information that are used for verification:

Constructing the signed content The content to sign is composed by concatenating the id, timestamp and payload, separated by the full-stop character ..

In code, it will look something like:

signed_content = "${svix_id}.${svix_timestamp}.${body}"

Where body is the raw body of the request. The signature is sensitive to any changes, so even a small change in the body will cause the signature to be completely different. This means that you should not change the body in any way before verifying.

Determining the expected signature

UseGateway uses an HMAC with SHA-256 to sign its webhooks.

So to calculate the expected signature, you should HMAC the signed_content from above using the base64 portion of your signing secret (this is the part after the whsec_ prefix) as the key. For example, given the secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw you will want to use MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.

This generated signature should match one of the ones sent in the Svix-Signature header.

The Svix-Signature header is composed of a list of space delimited signatures and their corresponding version identifiers. The signature list is most commonly of length one. Though there could be any number of signatures. For example:

v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE= v1,bm9ldHUjKzFob2VudXRob2VodWUzMjRvdWVvdW9ldQo= v2,MzJsNDk4MzI0K2VvdSMjMTEjQEBAQDEyMzMzMzEyMwo=

Make sure to remove the version prefix and delimiter (e.g. v1,) before verifying the signature.

Please note that to compare the signatures it's recommended to use a constant-time string comparison method in order to prevent timing attacks.

Verify timestamp

As mentioned above, UseGateway also sends the timestamp of the attempt in the Svix-Timestamp header. You should compare this timestamp against your system timestamp and make sure it's within your tolerance in order to prevent timestamp attacks.

Exchange Rates

The UseGateway API can also be used to get real-time exchange rates between any one cryptocurrency and standard (fiat) currency.

Get Exchange Rate

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/rates/{currency1}/{currency2} \
  -H 'Accept: application/json'

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.usegateway.net/v1/rates/{currency1}/{currency2}', headers = headers)

print(r.json())

GET /rates/{currency1}/{currency2}

Get the current price of the specific cryptocurrency to another supported currency that you need.

Example responses

200 Response

{
  "rate": {
    "BTC-USD": 31234.4262
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response RateResponseSchema
400 Bad Request Bad Request Error None
422 Unprocessable Entity Validation Error HTTPValidationError

Payments

To request a cryptocurrency payment, you create a payment. You can create and view payments. Since cryptocurrency transactions are push transactions, a payment will expire after a waiting period (payment window) if no transaction has been detected. Payments are identified by a unique code.

Statuses

Status Description
Opened Payment is opened and waiting for transaction
Completed Transaction validated by the blockchain network
Expired Payment request expired after appointed time
Unresolved Transaction confirmed but the payment diverged from what was expected
Resolved Merchant marked the payment as resolved
Closed Request cancelled -- only new unpaid payments can be cancelled

Get Payments

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/payments/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/payments/', headers = headers)

print(r.json())

GET /payments/

Returns all payments

Example responses

200 Response

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "resource": "payment",
      "code": "YJM5BAID",
      "name": "Product",
      "description": "The best Product",
      "logo_url": "https://example.com/logo.png",
      "support_email": "support@example.com",
      "support_telegram": "support",
      "hosted_url": "https://usegateway.app/payments/YJM5BAID",
      "redirect_url": "https://example.com",
      "cancel_url": "https://example.com",
      "created_at": "2019-08-24T14:15:22Z",
      "expires_at": "2019-08-24T14:15:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z",
      "timeline": [
        {
          "status": "Opened",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Completed",
          "created_at": "2019-08-24T14:18:22Z"
        }
      ],
      "metadata": {
        "user_id": 123
      },
      "pricing_type": "fixed_price",
      "addresses": {
        "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
        "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
        "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
        "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
      },
      "pricing": {
        "tron": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        },
        "bitcoin": {
          "amount": 0.00043344,
          "currency": "BTC"
        },
        "litecoin": {
          "amount": 0.16979439,
          "currency": "LTC"
        },
        "usdt_trc20": {
          "amount": 10.004165,
          "currency": "USDT_TRC20"
        }
      },
      "transactions": [
        {
          "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
          "network": "tron",
          "status": "Confirmed",
          "exchange_rate_confirmed": 0.0686647,
          "value": {
            "crypto": {
              "amount": 145.622008,
              "currency": "TRX"
            },
            "local": {
              "amount": 10,
              "currency": "USD"
            }
          },
          "detected_at": "2019-08-24T14:18:22Z",
          "confirmed_at": "2019-08-24T14:18:22Z"
        }
      ],
      "payment_threshold": {
        "overpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "overpayment_relative_threshold": 0.05,
        "underpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "underpayment_relative_threshold": 0.05
      }
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Responses

Status Meaning Description Schema
200 OK Successful Response Page_PaymentResponseSchema_

Create Payment

Code samples

# You can also use wget
curl -X POST https://api.usegateway.net/v1/payments/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' \
  -d '{
    "name": "Product",
    "description": "The best Product",
    "pricing_type": "fixed_price",
    "local_price": {
      "amount": 10,
      "currency": "USD"
    },
    "metadata": {
      "user_id": 123
    },
    "redirect_url": "https://example.com",
    "cancel_url": "https://example.com"
  }'

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}
data = {
  "name": "Product",
  "description": "The best Product",
  "pricing_type": "fixed_price",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "user_id": 123
  },
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com"
}

r = requests.post('https://api.usegateway.net/v1/payments/', headers=headers, json=data)

print(r.json())

POST /payments/

Body parameter

{
  "name": "Product",
  "description": "The best Product",
  "pricing_type": "fixed_price",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "user_id": 123
  },
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com"
}

To get paid in cryptocurrency, you need to create a payment object and provide the user with a cryptocurrency address to which they must send cryptocurrency. Once a payment is created a customer must broadcast a transaction to the blockchain before the payment expires.

Parameters

Name Type Required Description
name string (255) true Payment name
description string (255) false More detailed description of the payment
pricing_type PricingType true Payment pricing type
local_price PaymentPricePayloadSchema true Price in local fiat currency
metadata object false Developer defined key value pairs
redirect_url string(uri) false Redirect URL after successful payment
cancel_url string(uri) false Redirect URL after cancelled payment

Example responses

201 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "payment",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/payments/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": null,
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "pricing_type": "fixed_price",
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
201 Created Successful Response PaymentResponseSchema
422 Unprocessable Entity Validation Error HTTPValidationError

Show Payment

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/payments/{id}/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/payments/{id}/', headers = headers)

print(r.json())

GET /payments/{id}/

Retrieves the details of a payment that has been previously created. Supply the unique payment code that was returned when the payment was created. This information is also returned when a payment is first created.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "payment",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/payments/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": "2019-08-24T14:18:22Z",
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Completed",
      "created_at": "2019-08-24T14:18:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "pricing_type": "fixed_price",
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:18:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z"
    }
  ],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response PaymentResponseSchema
404 Not Found Not Found Error None

Cancel Payment

Code samples

# You can also use wget
curl -X PATCH https://api.usegateway.net/v1/payments/{id}/cancel \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.patch('https://api.usegateway.net/v1/payments/{id}/cancel', headers = headers)

print(r.json())

PATCH /payments/{id}/cancel

Cancels a payment that has been previously created. Supply the unique payment code that was returned when the payment was created.

Note: Only new payments can be successfully canceled. Once transaction is detected, payment can no longer be canceled.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "payment",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/payments/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": null,
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Closed",
      "created_at": "2019-08-24T14:16:28Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "pricing_type": "fixed_price",
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response PaymentResponseSchema
400 Bad Request Bad Request Error None
404 Not Found Not Found Error None

Resolve Payment

Code samples

# You can also use wget
curl -X PATCH https://api.usegateway.net/v1/payments/{id}/resolve \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.patch('https://api.usegateway.net/v1/payments/{id}/resolve', headers = headers)

print(r.json())

PATCH /payments/{id}/resolve

Resolve a payment that has been previously marked as unresolved. Supply the unique payment code that was returned when the payment was created.

Note: Only unresolved payments can be successfully resolved. For more on unresolved payments, visit the Payment section of this reference.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "payment",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/payments/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": "2019-08-24T14:18:22Z",
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Unresolved (Underpaid)",
      "created_at": "2019-08-24T14:18:22Z"
    },
    {
      "status": "Resolved",
      "created_at": "2019-08-24T14:22:22Z"
    },
  ],
  "metadata": {
    "user_id": 123
  },
  "pricing_type": "fixed_price",
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 14.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 1,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:18:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z"
    }
  ],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response PaymentResponseSchema
400 Bad Request Bad Request Error None
404 Not Found Not Found Error None

Invoices

The invoicing feature lets you easily request crypto payments from your customers. You can manage your payments, track your invoice status, and review your transaction history all in one place.

Statuses

Status Description
Created Invoice is created and waiting to be viewed by a customer
Viewed Invoice was viewed and the payment timer was initiated
Expired Invoice expired after appointed time
Renewed Invoice was renewed and recalculated
Paid Invoice was successfully paid
Unresolved Transaction confirmed but the payment diverged from what was expected
Resolved Merchant marked the invoice as resolved
Closed Request cancelled -- only new unpaid invoices can be cancelled

Get Invoices

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/invoices/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/invoices/', headers = headers)

print(r.json())

GET /invoices/

Get all invoices for the user

Example responses

200 Response

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "resource": "invoice",
      "code": "YJM5BAID",
      "name": "Product",
      "description": "The best Product",
      "logo_url": "https://example.com/logo.png",
      "support_email": "support@example.com",
      "support_telegram": "support",
      "hosted_url": "https://usegateway.app/invoices/YJM5BAID",
      "redirect_url": "https://example.com",
      "cancel_url": "https://example.com",
      "created_at": "2019-08-24T14:15:22Z",
      "expires_at": "2019-08-24T14:15:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z",
      "timeline": [
        {
          "status": "Opened",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Viewed",
          "created_at": "2019-08-24T14:18:22Z"
        },
        {
          "status": "Paid",
          "created_at": "2019-08-24T14:23:22Z"
        }
      ],
      "metadata": {
        "user_id": 123
      },
      "addresses": {
        "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
        "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
        "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
        "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
      },
      "pricing": {
        "tron": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        },
        "bitcoin": {
          "amount": 0.00043344,
          "currency": "BTC"
        },
        "litecoin": {
          "amount": 0.16979439,
          "currency": "LTC"
        },
        "usdt_trc20": {
          "amount": 10.004165,
          "currency": "USDT_TRC20"
        }
      },
      "transactions": [
        {
          "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
          "network": "tron",
          "status": "Confirmed",
          "exchange_rate_confirmed": 0.0686647,
          "value": {
            "crypto": {
              "amount": 145.622008,
              "currency": "TRX"
            },
            "local": {
              "amount": 10,
              "currency": "USD"
            }
          },
          "detected_at": "2019-08-24T14:18:22Z",
          "confirmed_at": "2019-08-24T14:18:22Z"
        }
      ],
      "payment_threshold": {
        "overpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "overpayment_relative_threshold": 0.05,
        "underpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "underpayment_relative_threshold": 0.05
      }
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Responses

Status Meaning Description Schema
200 OK Successful Response Page_InvoiceResponseSchema_

Create Invoice

Code samples

# You can also use wget
curl -X POST https://api.usegateway.net/v1/invoices/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' \
  -d '{
    "name": "Product",
    "description": "The best Product",
      "amount": 10,
      "currency": "USD"
    },
    "metadata": {
      "user_id": 123
    },
    "redirect_url": "https://example.com",
    "cancel_url": "https://example.com"
  }'

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}
data = {
  "name": "Product",
  "description": "The best Product",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "user_id": 123
  },
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com"
}

r = requests.post('https://api.usegateway.net/v1/invoices/', headers=headers, json=data)

print(r.json())

POST /invoices/

Body parameter

{
  "name": "Product",
  "description": "The best Product",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "user_id": 123
  },
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com"
}

To send an invoice in cryptocurrency, you need to create an invoice object and provide the user with the hosted url where they will be able to pay. Once an invoice is viewed at the hosted url, a timer to pay will be started.

Parameters

Name Type Required Description
name string (255) true Invoice name
description string (255) false More detailed description of the invoice
local_price InvoicePricePayloadSchema true Price in local fiat currency
metadata object false Developer defined key value pairs
redirect_url string(uri) false Redirect URL after successful invoice
cancel_url string(uri) false Redirect URL after cancelled invoice

Example responses

201 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "invoice",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/invoices/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": null,
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
201 Created Successful Response InvoiceResponseSchema
422 Unprocessable Entity Validation Error HTTPValidationError

Show Invoice

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/invoices/{id}/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/invoices/{id}/', headers = headers)

print(r.json())

GET /invoices/{id}/

Retrieves the details of an invoice that has been previously created. Supply the unique short code that was returned when the invoice was created. This information is also returned when an invoice is first created.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "invoice",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/invoices/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": "2019-08-24T14:18:22Z",
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Viewed",
      "created_at": "2019-08-24T14:18:22Z"
    },
    {
      "status": "Paid",
      "created_at": "2019-08-24T14:23:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:18:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z"
    }
  ],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response InvoiceResponseSchema
404 Not Found Not Found Error None

Cancel Invoice

Code samples

# You can also use wget
curl -X PATCH https://api.usegateway.net/v1/invoices/{id}/cancel \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.patch('https://api.usegateway.net/v1/invoices/{id}/cancel', headers = headers)

print(r.json())

PATCH /invoices/{id}/cancel

Voids an invoice that has been previously created. Supply the unique invoice code that was returned when the invoice was created.

Note: Only invoices with OPEN or VIEWED status can be voided. Once a payment is detected, the invoice can no longer be voided.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "invoice",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/payments/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": null,
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Closed",
      "created_at": "2019-08-24T14:16:28Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response InvoiceResponseSchema
400 Bad Request Bad Request Error None
404 Not Found Not Found Error None

Resolve Invoice

Code samples

# You can also use wget
curl -X PATCH https://api.usegateway.net/v1/invoices/{id}/resolve \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.patch('https://api.usegateway.net/v1/invoices/{id}/resolve', headers = headers)

print(r.json())

PATCH /invoices/{id}/resolve

Resolve an invoice that has been previously marked as unresolved. Supply the unique invoice code that was returned when the invoice was created.

Note: Only invoices with an unresolved charge can be successfully resolved.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "invoice",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/payments/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": "2019-08-24T14:18:22Z",
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Unresolved (Underpaid)",
      "created_at": "2019-08-24T14:18:22Z"
    },
    {
      "status": "Resolved",
      "created_at": "2019-08-24T14:22:22Z"
    },
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 14.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 1,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:18:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z"
    }
  ],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

Responses

Status Meaning Description Schema
200 OK Successful Response InvoiceResponseSchema
400 Bad Request Bad Request Error None
404 Not Found Not Found Error None

Deposits

Deposits make it possible to have a permanent payment addresses associated with specified user_id and site to accept any transaction, that is not lower than minimal available amount. Deposits can have many transactions and each transaction is a replenishment. Deposits can also be quickly integrated into a website by associating with any ID in website system. Each deposit has a publicly accessible hosted page that can be shared with anyone.

Statuses

Status Description
Created Deposit is created and waiting for transaction
Replenished Deposit was replenished by a confirmed transaction
Unresolved Transaction confirmed but was less than the minimal replenishment amount
Resolved Merchant marked the deposit as resolved
Closed Request cancelled -- only new unpaid deposits can be cancelled

Get Deposits

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/deposits/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/deposits/', headers = headers)

print(r.json())

GET /deposits/

Get all deposits for the user.

Example responses

200 Response

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "resource": "deposit",
      "code": "YJM5BAID",
      "user_id": "UserEmail or UserID or UserPhone",
      "site": "example.com",
      "name": "Deposit",
      "description": "Deposit of User123",
      "is_p2p": false,
      "local_currency": "USD",
      "local_price": {
        "amount": 10,
        "currency": "USD"
      },
      "logo_url": "https://example.com/logo.png",
      "support_email": "support@example.com",
      "support_telegram": "support",
      "hosted_url": "https://usegateway.app/deposits/YJM5BAID",
      "created_at": "2019-08-24T14:15:22Z",
      "timeline": [
        {
          "status": "Created",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Replenished",
          "created_at": "2019-08-24T14:18:22Z"
        }
      ],
      "metadata": {
        "user_id": 123
      },
      "addresses": {
        "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
        "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
        "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
        "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
      },
      "transactions": [
        {
          "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
          "network": "tron",
          "status": "Confirmed",
          "exchange_rate_confirmed": 0.0686647,
          "value": {
            "crypto": {
              "amount": 140,
              "currency": "TRX"
            },
            "local": {
              "amount": 10,
              "currency": "USD"
            },
          },
          "detected_at": "2019-08-24T14:18:22Z",
          "confirmed_at": "2019-08-24T14:18:22Z"
        }
      ]
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Responses

Status Meaning Description Schema
200 OK Successful Response Page_DepositResponseSchema_

Create Deposit

Code samples

# You can also use wget
curl -X POST https://api.usegateway.net/v1/deposits/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' \
  -d '{
    "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "site": "example.com",
    "name": "Deposit",
    "description": "Deposit of User123",
    "is_p2p": false,
    "local_price": {
      "amount": 10,
      "currency": "USD"
    },
    "metadata": {
      "email": "user@example.com"
    }
  }'

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}
data = {
  "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "site": "example.com",
  "name": "Deposit",
  "description": "Deposit of User123",
  "is_p2p": false,
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "email": "user@example.com"
  }
}

r = requests.post('https://api.usegateway.net/v1/deposits/', headers=headers, json=data)

print(r.json())

POST /deposits/

Deposits allow you to create payment addresses that are associated with a specific user_id and site, and can accept multiple transactions.

Data parameter

{
  "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "site": "example.com",
  "name": "Deposit",
  "description": "Deposit of User123",
  "is_p2p": false,
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "email": "user@example.com"
  }
}

Parameters

Name Type Required Description
user_id string (255) true Any user identifier
site string (255) true Site name
name string (255) false Deposit name
description string (255) false More detailed description of the deposit
is_p2p bool false Is deposit p2p or not
local_price PaymentPricePayloadSchema false Price in local fiat currency
metadata object false Developer defined key value pairs

Example responses

201 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "deposit",
  "code": "YJM5BAID",
  "user_id": "UserEmail or UserID or UserPhone",
  "site": "example.com",
  "name": "Deposit",
  "description": "Deposit of User123",
  "is_p2p": false,
  "local_currency": "USD",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/deposits/YJM5BAID",
  "created_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Created",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "transactions": []
}

Responses

Status Meaning Description Schema
201 Created Successful Response DepositResponseSchema
422 Unprocessable Entity Validation Error HTTPValidationError

Show Deposit

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/deposits/{id}/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/deposits/{id}/', headers = headers)

print(r.json())

GET /deposits/{id}/

Retrieves the details of a deposit that has been previously created. Supply the unique deposit code that was returned when the deposit was created. This information is also returned when a deposit is first created.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "deposit",
  "code": "YJM5BAID",
  "user_id": "UserEmail or UserID or UserPhone",
  "site": "example.com",
  "name": "Deposit",
  "description": "Deposit of User123",
  "is_p2p": false,
  "local_currency": "USD",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/deposits/YJM5BAID",
  "created_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Created",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Replenished",
      "created_at": "2019-08-24T14:18:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:18:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Successful Response DepositResponseSchema
404 Not Found Not Found Error None

Resolve Deposit

Code samples

# You can also use wget
curl -X PATCH https://api.usegateway.net/v1/deposits/{id}/resolve \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.patch('https://api.usegateway.net/v1/deposits/{id}/resolve', headers = headers)

print(r.json())

PATCH /deposits/{id}/resolve

Resolve a deposit that has been previously marked as unresolved. Supply the unique deposit code that was returned when the deposit was created.

Note: Only unresolved deposits can be successfully resolved.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "deposit",
  "code": "YJM5BAID",
  "user_id": "UserEmail or UserID or UserPhone",
  "site": "example.com",
  "name": "Deposit",
  "description": "Deposit of User123",
  "is_p2p": false,
  "local_currency": "USD",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/deposits/YJM5BAID",
  "created_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Created",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Unresolved (Underpaid)",
      "created_at": "2019-08-24T14:18:22Z"
    },
    {
      "status": "Resolved",
      "created_at": "2019-08-24T14:22:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 14.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 1,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:18:22Z",
      "confirmed_at": "2019-08-24T14:18:22Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Successful Response DepositResponseSchema
400 Bad Request Bad Request Error None
404 Not Found Not Found Error None

Cancel Deposit

Code samples

# You can also use wget
curl -X PATCH https://api.usegateway.net/v1/deposits/{id}/cancel \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.patch('https://api.usegateway.net/v1/deposits/{id}/cancel', headers = headers)

print(r.json())

PATCH /deposits/{id}/cancel

Cancels a deposit that has been previously created. Supply the unique deposit code that was returned when the deposit was created.

Note: You can cancel any deposit. After a deposit is canceled, it will not be available for payment.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "deposit",
  "code": "YJM5BAID",
  "user_id": "UserEmail or UserID or UserPhone",
  "site": "example.com",
  "name": "Deposit",
  "description": "Deposit of User123",
  "is_p2p": false,
  "local_currency": "USD",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/deposits/YJM5BAID",
  "created_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Created",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Closed",
      "created_at": "2019-08-24T14:18:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "transactions": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response DepositResponseSchema
400 Bad Request Bad Request Error None
404 Not Found Not Found Error None

P2P

P2P entities are essentially Deposit entities with the is_p2p option enabled. The only difference is that they return a hosted_url link to a page where the client can choose from available peer-to-peer exchanges to make a replenishment for the deposit.

Peer-to-peer exchangers

Exchangers are our trusted partners who are willing to exchange fiat currency for cryptocurrency using available methods. Exchangers vary depending on the region and payment method.

Create P2P

Code samples

# You can also use wget
curl -X POST https://api.usegateway.net/v1/deposits/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' \
  -d '{
    "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "site": "example.com",
    "name": "P2P",
    "description": "P2P of User123",
    "is_p2p": true,
    "local_price": {
      "amount": 10,
      "currency": "USD"
    },
    "metadata": {
      "email": "user@example.com"
    }
  }'

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}
data = {
  "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "site": "example.com",
  "name": "P2P",
  "description": "P2P of User123",
  "is_p2p": true,
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "email": "user@example.com"
  }
}

r = requests.post('https://api.usegateway.net/v1/deposits/', headers=headers, json=data)

print(r.json())

POST /deposits/

Data parameter

{
  "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "site": "example.com",
  "name": "P2P",
  "description": "P2P of User123",
  "is_p2p": true,
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "email": "user@example.com"
  }
}

Parameters

Name Type Required Description
user_id string (255) true Any user identifier
site string (255) true Site name
name string (255) false Deposit name
description string (255) false More detailed description of the deposit
is_p2p bool false Is deposit p2p or not
local_price PaymentPricePayloadSchema false Price in local fiat currency
metadata object false Developer defined key value pairs

Example responses

201 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "deposit",
  "code": "YJM5BAID",
  "user_id": "UserEmail or UserID or UserPhone",
  "site": "example.com",
  "name": "P2P",
  "description": "P2P of User123",
  "is_p2p": true,
  "local_currency": "USD",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/p2p/YJM5BAID",
  "created_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Created",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "transactions": []
}

Responses

Status Meaning Description Schema
201 Created Successful Response DepositResponseSchema
422 Unprocessable Entity Validation Error HTTPValidationError

Withdrawal Requests

If you want to prepare a withdrawal you can use Withdrawal Requests API. All Withdrawal Requests are available in your merchant page. You can request a crypto or fiat withdrawal. Then approve or decline any withdrawal request.

Statuses

Status Description
Received Withdrawal Request was received and waiting to be approved or declined
Approved Withdrawal Request was successful processed
Declcined Withdrawal Request was declined

Get Withdrawal Requests

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/withdrawal_requests/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/withdrawal_requests/', headers = headers)

print(r.json())

GET /withdrawal_requests/

Get all withdrawal requests for the user.

Example responses

200 Response

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "type": "crypto",
      "address": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
      "value": {
        "amount": 10,
        "currency": "USDT_TRC20"
      },
      "comment": "tg: @username",
      "timeline": [
        {
          "status": "Received",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Declined",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ],
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Responses

Status Meaning Description Schema
200 OK Successful Response Page_WithdrawalRequestResponseSchema_

Create Withdrawal Request

Code samples

# You can also use wget
curl -X POST https://api.usegateway.net/v1/withdrawal_requests/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' \
  -d '{
    "address": "some usdt address",
    "value": {
      "crypto": {
        "amount": 10,
        "currency": "USDT_TRC20"
      }
    }
  }'
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}
data = {
  "address": "some usdt address",
  "value": {
    "crypto": {
      "amount": 10,
      "currency": "USDT_TRC20"
    }
  }
}

r = requests.post('https://api.usegateway.net/v1/withdrawal_requests/', headers=headers, json=data)

print(r.json())

POST /withdrawal_requests/

Withdrawal requests allow you to create a request that can be fulfilled later. You can request a withdrawal to a pre-specified cryptocurrency address as well as any other fiat currency details that will then be converted to cryptocurrency.

You can create a withdrawal request in 2 types: in cryptocurrency or in a fiat (local) currency. Just specify necessary type in the value field. See more in examples.

Request in cryptocurrency example

{
  "address": "some usdt address",
  "value": {
    "crypto": {
      "amount": 10,
      "currency": "USDT_TRC20"
    }
  }
}

Request in fiat example

{
  "value": {
    "local": {
      "amount": 10,
      "currency": "USD"
    }
  },
  "comment": "tg: @username, card number: 4111 1111 1111 1111"
}

Parameters

Name Type Required Description
address string true if type is crypto Withdrawal address
value ValuePayloadSchema true Withdrawal amount and currency
comment string (255) false Any additional info

Example responses

201 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "type": "crypto",
  "address": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
  "value": {
    "amount": 10,
    "currency": "USDT_TRC20"
  },
  "comment": "tg: @username",
  "timeline": [
    {
      "status": "Received",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "created_at": "2019-08-24T14:15:22Z"
}

Responses

Status Meaning Description Schema
201 Created Successful Response WithdrawalRequestResponseSchema
400 Bad Request Bad Request Error None
422 Unprocessable Entity Validation Error HTTPValidationError

Show Withdrawal Request

Code samples

# You can also use wget
curl -X GET https://api.usegateway.net/v1/withdrawal_requests/{id}/ \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' 

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.get('https://api.usegateway.net/v1/withdrawal_requests/{id}/', headers=headers)

print(r.json())

GET /withdrawal_requests/{id}/

Retrieves the details of a withdrawal request that has been previously created. Supply the unique withdrawal request code that was returned when the withdrawal request was created. This information is also returned when a withdrawal request is first created.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "type": "crypto",
  "address": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
  "value": {
    "amount": 10,
    "currency": "USDT_TRC20"
  },
  "comment": "tg: @username",
  "timeline": [
    {
      "status": "Received",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Declined",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "created_at": "2019-08-24T14:15:22Z"
}

Responses

Status Meaning Description Schema
200 OK Successful Response WithdrawalRequestResponseSchema
404 Not Found Not Found Error None

Decline Withdrawal Request

Code samples

# You can also use wget
curl -X POST https://api.usegateway.net/v1/withdrawal_requests/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: <Your API Key>' \
  -d '{
    "comment": "Client`s card is blocked",
  }'
import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': '<Your API Key>'
}

r = requests.post('/v1/withdrawal_requests/{id}/decline', headers = headers)

print(r.json())

POST /withdrawal_requests/{id}/decline

Declines a withdrawal request that has been previously created. Supply the unique withdrawal request code that was returned when the withdrawal request was created.

Note: Only new unpaid withdrawal requests can be successfully declined.

Body parameter

{
  "comment": "Client's card is blocked"
}

Parameters

Name Type Required Description
comment string (255) false Any additional info

201 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "type": "crypto",
  "address": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
  "value": {
    "amount": 10,
    "currency": "USDT_TRC20"
  },
  "comment": "tg: @username",
  "timeline": [
    {
      "status": "Received",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Declined",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "created_at": "2019-08-24T14:15:22Z"
}

Responses

Status Meaning Description Schema
200 OK Successful Response WithdrawalRequestResponseSchema
400 Bad Request Bad Request Error None
404 Not Found Not Found Error None
422 Unprocessable Entity Validation Error HTTPValidationError

Schemas

Cryptocurrency

"BTC"

Cryptocurrency

Properties

Name Type Description
Cryptocurrency string Available Cryptocurrencies.

Enumerated Values

Property Value
Cryptocurrency BTC
Cryptocurrency ETH
Cryptocurrency LTC
Cryptocurrency TRX
Cryptocurrency USDT_TRC20

Currency

"USD"

Currency

Properties

Name Type Description
Currency string Available Currencies.

Enumerated Values

Property Value
Currency USD
Currency EUR
Currency RUB
Currency UAH
Currency KZT
Currency AZN
Currency TRY

DepositPayloadSchema

{
  "user_id": "UserEmail or UserID or UserPhone",
  "site": "SiteName",
  "name": "Product",
  "description": "The best Product",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "client_id": 1
  }
}

DepositPayloadSchema

Properties

Name Type Required Description
user_id string (255) true Any user identifier
site string (255) true Site name
name string (255) false Deposit name
description string (255) false More detailed description of the deposit
local_price PaymentPricePayloadSchema false Price in local fiat currency
metadata object false Developer defined key value pairs

DepositResponseSchema

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "deposit",
  "code": "YJM5BAID",
  "user_id": "UserEmail or UserID or UserPhone",
  "site": "example.com",
  "name": "Deposit",
  "description": "Deposit of User123",
  "is_p2p": false,
  "local_currency": "USD",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/deposits/YJM5BAID",
  "created_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Created",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Replenished",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:15:22Z",
      "confirmed_at": "2019-08-24T14:15:22Z"
    }
  ]
}

DepositResponseSchema

Properties

Name Type Description
id string(uuid) Deposit ID
resource string Resource name
code string Deposit Code
user_id string Any user identifier
site string Site name
name string Deposit name
description string More detailed description of the deposit
is_p2p bool Is deposit p2p or not
local_currency Currency Local currency of user
local_price PaymentPricePayloadSchema Price in local fiat currency
logo_url string(uri) Logo url
hosted_url string(uri) Hosted url of deposit page
created_at string(date-time) Time of creating
timeline [StatusResponseSchema] Status history
metadata object Developer defined key value pairs
addresses object Addresses of Deposit
transactions [TransactionInResponseSchema] Transactions list

HTTPValidationError

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

HTTPValidationError

Properties

Name Type Required Description
detail [ValidationError] false none

InvoicePayloadSchema

{
  "name": "Product",
  "description": "The best Product",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "user_id": 1
  },
  "redirect_url": "https://google.com",
  "cancel_url": "https://google.com"
}

InvoicePayloadSchema

Properties

Name Type Required Description
name string (255) true Invoice name
description string (255) false More detailed description of the invoice
local_price InvoicePricePayloadSchema true Price in local fiat currency
metadata object false Developer defined key value pairs
redirect_url string(uri) false Redirect URL after successful invoice
cancel_url string(uri) false Redirect URL after cancelled invoice

InvoicePricePayloadSchema

{
  "amount": 10,
  "currency": "USD"
}

InvoicePricePayloadSchema

Properties

Name Type Required Description
amount number (>0) true Amount
currency Currency true Available Currencies.

InvoiceResponseSchema

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "invoice",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/invoices/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Viewed",
      "created_at": "2019-08-24T14:18:22Z"
    },
    {
      "status": "Paid",
      "created_at": "2019-08-24T14:22:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:15:22Z",
      "confirmed_at": "2019-08-24T14:15:22Z"
    }
  ],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

InvoiceResponseSchema

Properties

Name Type Description
id string(uuid) Invoice ID
resource string Resource name
code string Invoice code
name string Invoice name
description string Invoice description
logo_url string(uri) Logo url
hosted_url string(uri) Hosted url of Invoice page
redirect_url string(uri) Redirect url after successful invoice
cancel_url string(uri) Redirect url after cancelled invoice
created_at string(date-time) Time of creating
expires_at string(date-time) Time of expiring
confirmed_at string(date-time) Time of confirmation
timeline [StatusResponseSchema] Status history
metadata object Key value pairs
addresses object Invoice addresses
pricing object Invoice pricing
transactions [TransactionInResponseSchema] Invoice transactions
payment_threshold object Invoice threshold

Page_DepositResponseSchema_

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "resource": "deposit",
      "code": "YJM5BAID",
      "user_id": "UserEmail or UserID or UserPhone",
      "site": "example.com",
      "name": "Deposit",
      "description": "Deposit of User123",
      "is_p2p": false,
      "local_currency": "USD",
      "local_price": {
    "amount": 10,
        "currency": "USD"
      },
      "logo_url": "https://example.com/logo.png",
      "support_email": "support@example.com",
      "support_telegram": "support",
      "hosted_url": "https://usegateway.app/deposits/YJM5BAID",
      "created_at": "2019-08-24T14:15:22Z",
      "timeline": [
        {
          "status": "Created",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Replenished",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ],
      "metadata": {
        "user_id": 123
      },
      "addresses": {
        "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
        "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
        "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
        "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
      },
      "transactions": [
        {
          "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
          "network": "tron",
          "status": "Confirmed",
          "exchange_rate_confirmed": 0.0686647,
          "value": {
            "crypto": {
              "amount": 14,
              "currency": "TRX"
            },
            "local": {
              "amount": 1,
              "currency": "USD"
            },
          },
          "detected_at": "2019-08-24T14:15:22Z",
          "confirmed_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Page[DepositResponseSchema]

Properties

Name Type Description
items [DepositResponseSchema] Deposits list
total integer Total objects in query
page integer Page of query
size integer Number of results per call. Accepted values: 0 - 100. Default 50

Page_InvoiceResponseSchema_

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "resource": "invoice",
      "code": "YJM5BAID",
      "name": "Product",
      "description": "The best Product",
      "logo_url": "https://example.com/logo.png",
      "support_email": "support@example.com",
      "support_telegram": "support",
      "hosted_url": "https://usegateway.app/invoices/YJM5BAID",
      "redirect_url": "https://example.com",
      "cancel_url": "https://example.com",
      "created_at": "2019-08-24T14:15:22Z",
      "expires_at": "2019-08-24T14:15:22Z",
      "confirmed_at": "2019-08-24T14:15:22Z",
      "timeline": [
        {
          "status": "Opened",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Viewed",
          "created_at": "2019-08-24T14:18:22Z"
        },
        {
          "status": "Paid",
          "created_at": "2019-08-24T14:22:22Z"
        }
      ],
      "metadata": {
        "user_id": 123
      },
      "addresses": {
        "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
        "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
        "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
        "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
      },
      "pricing": {
        "tron": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        },
        "bitcoin": {
          "amount": 0.00043344,
          "currency": "BTC"
        },
        "litecoin": {
          "amount": 0.16979439,
          "currency": "LTC"
        },
        "usdt_trc20": {
          "amount": 10.004165,
          "currency": "USDT_TRC20"
        }
      },
      "transactions": [
        {
          "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
          "network": "tron",
          "status": "Confirmed",
          "exchange_rate_confirmed": 0.0686647,
          "value": {
            "crypto": {
              "amount": 145.622008,
              "currency": "TRX"
            },
            "local": {
              "amount": 10,
              "currency": "USD"
            }
          },
          "detected_at": "2019-08-24T14:15:22Z",
          "confirmed_at": "2019-08-24T14:15:22Z"
        }
      ],
      "payment_threshold": {
        "overpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "overpayment_relative_threshold": 0.05,
        "underpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "underpayment_relative_threshold": 0.05
      }
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Page[InvoiceResponseSchema]

Properties

Name Type Description
items [InvoiceResponseSchema] Invoices list
total integer Total objects in query
page integer Page of query
size integer Number of results per call. Accepted values: 0 - 100. Default 50

Page_PaymentResponseSchema_

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "resource": "payment",
      "code": "YJM5BAID",
      "name": "Product",
      "description": "The best Product",
      "logo_url": "https://example.com/logo.png",
      "support_email": "support@example.com",
      "support_telegram": "support",
      "hosted_url": "https://usegateway.app/payments/YJM5BAID",
      "redirect_url": "https://example.com",
      "cancel_url": "https://example.com",
      "created_at": "2019-08-24T14:15:22Z",
      "expires_at": "2019-08-24T14:15:22Z",
      "confirmed_at": "2019-08-24T14:15:22Z",
      "timeline": [
        {
          "status": "Opened",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Completed",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ],
      "metadata": {
        "user_id": 123
      },
      "pricing_type": "fixed_price",
      "addresses": {
        "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
        "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
        "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
        "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
      },
      "pricing": {
        "tron": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        },
        "bitcoin": {
          "amount": 0.00043344,
          "currency": "BTC"
        },
        "litecoin": {
          "amount": 0.16979439,
          "currency": "LTC"
        },
        "usdt_trc20": {
          "amount": 10.004165,
          "currency": "USDT_TRC20"
        }
      },
      "transactions": [
        {
          "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
          "network": "tron",
          "status": "Confirmed",
          "exchange_rate_confirmed": 0.0686647,
          "value": {
            "crypto": {
              "amount": 145.622008,
              "currency": "TRX"
            },
            "local": {
              "amount": 10,
              "currency": "USD"
            }
          },
          "detected_at": "2019-08-24T14:15:22Z",
          "confirmed_at": "2019-08-24T14:15:22Z"
        }
      ],
      "payment_threshold": {
        "overpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "overpayment_relative_threshold": 0.05,
        "underpayment_absoulte_threshold": {
          "amount": 1,
          "currency": "USD"
        },
        "underpayment_relative_threshold": 0.05
      }
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Page[PaymentResponseSchema]

Properties

Name Type Description
items [PaymentResponseSchema] Payments list
total integer Total objects in query
page integer Page of query
size integer Number of results per call. Accepted values: 0 - 100. Default 50

Page_WithdrawalRequestResponseSchema_

{
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "type": "crypto",
      "address": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
      "value": {
        "amount": 10,
        "currency": "USDT_TRC20"
      },
      "comment": "tg: @username",
      "timeline": [
        {
          "status": "Received",
          "created_at": "2019-08-24T14:15:22Z"
        },
        {
          "status": "Declined",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ],
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "total": 1,
  "page": 1,
  "size": 1
}

Page[WithdrawalRequestResponseSchema]

Properties

Name Type Description
items [WithdrawalRequestResponseSchema] Withdrawal Requests list
total integer Total objects in query
page integer Page of query
size integer Number of results per call. Accepted values: 0 - 100. Default 50

PaymentPayloadSchema

{
  "name": "Product",
  "description": "The best Product",
  "pricing_type": "fixed_price",
  "local_price": {
    "amount": 10,
    "currency": "USD"
  },
  "metadata": {
    "user_id": 1
  },
  "redirect_url": "https://google.com",
  "cancel_url": "https://google.com"
}

PaymentPayloadSchema

Properties

Name Type Required Description
name string (255) true Payment name
description string (255) false More detailed description of the payment
pricing_type PricingType true Payment pricing type
local_price PaymentPricePayloadSchema true Price in local fiat currency
metadata object false Developer defined key value pairs
redirect_url string(uri) false Redirect URL after successful payment
cancel_url string(uri) false Redirect URL after cancelled payment

PaymentPricePayloadSchema

{
  "amount": 10,
  "currency": "USD"
}

PaymentPricePayloadSchema

Properties

Name Type Required Description
amount number (>0) true Amount
currency Currency true Available Currencies.

PaymentResponseSchema

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "resource": "payment",
  "code": "YJM5BAID",
  "name": "Product",
  "description": "The best Product",
  "logo_url": "https://example.com/logo.png",
  "support_email": "support@example.com",
  "support_telegram": "support",
  "hosted_url": "https://usegateway.app/payments/YJM5BAID",
  "redirect_url": "https://example.com",
  "cancel_url": "https://example.com",
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "confirmed_at": "2019-08-24T14:15:22Z",
  "timeline": [
    {
      "status": "Opened",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Completed",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "metadata": {
    "user_id": 123
  },
  "pricing_type": "fixed_price",
  "addresses": {
    "BTC": "1NQXdsoSQaB74cESshoDELEwNi51fbGtC9",
    "LTC": "LenidgAMkqjjkBSMqSwj82za7ULdzEAzgK",
    "TRX": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
    "USDT_TRC20": "TSE4vBVTWshcFLcX1fciKw8PY9KW6NXmDd"
  },
  "pricing": {
    "tron": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    },
    "bitcoin": {
      "amount": 0.00043344,
      "currency": "BTC"
    },
    "litecoin": {
      "amount": 0.16979439,
      "currency": "LTC"
    },
    "usdt_trc20": {
      "amount": 10.004165,
      "currency": "USDT_TRC20"
    }
  },
  "transactions": [
    {
      "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
      "network": "tron",
      "status": "Confirmed",
      "exchange_rate_confirmed": 0.0686647,
      "value": {
        "crypto": {
          "amount": 145.622008,
          "currency": "TRX"
        },
        "local": {
          "amount": 10,
          "currency": "USD"
        }
      },
      "detected_at": "2019-08-24T14:15:22Z",
      "confirmed_at": "2019-08-24T14:15:22Z"
    }
  ],
  "payment_threshold": {
    "overpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "overpayment_relative_threshold": 0.05,
    "underpayment_absoulte_threshold": {
      "amount": 1,
      "currency": "USD"
    },
    "underpayment_relative_threshold": 0.05
  }
}

PaymentResponseSchema

Properties

Name Type Description
id string(uuid) Payment ID
resource string Resource name
code string Payment code
name string Payment name
description string Payment description
logo_url string(uri) Logo url
hosted_url string(uri) Hosted url of Payment page
redirect_url string(uri) Redirect url after successful payment
cancel_url string(uri) Redirect url after cancelled payment
created_at string(date-time) Time of creating
expires_at string(date-time) Time of expiring
confirmed_at string(date-time) Time of confirmation
timeline [StatusResponseSchema] Status history
metadata object Key value pairs
pricing_type PricingType Pricing type.
addresses object Payment addresses
pricing object Payment pricing
transactions [TransactionInResponseSchema] Payment transactions
payment_threshold object Payment threshold

PricingType

"no_price"

PricingType

Properties

Name Type Description
PricingType string Pricing type.

Enumerated Values

Property Value
PricingType no_price
PricingType fixed_price

RateResponseSchema

{
  "rate": {
    "BTC-USD": 31234.4262
  }
}

RateResponseSchema

Properties

Name Type Description
rate object Exchange rate

StatusResponseSchema

{
  "status": "Completed",
  "created_at": "2019-08-24T14:15:22Z"
}

StatusResponseSchema

Properties

Name Type Description
status string Status name
created_at string(date-time) Time of creating

TransactionInResponseSchema

{
  "txid": "45b9aa8a44a8e2d08b8421ba35672c2a6671c1e3b6e7849282ace87b446c920a",
  "network": "tron",
  "status": "Confirmed",
  "exchange_rate_confirmed": 0.0686647,
  "value": {
    "crypto": {
      "amount": 145.622008,
      "currency": "TRX"
    },
    "local": {
      "amount": 10,
      "currency": "USD"
    }
  },
  "detected_at": "2019-08-24T14:15:22Z",
  "confirmed_at": "2019-08-24T14:15:22Z"
}

TransactionInResponseSchema

Properties

Name Type Description
txid string none
network string none
status string none
exchange_rate_confirmed number none
value object none
detected_at string(date-time) none
confirmed_at string(date-time) none

ValidationError

{
  "loc": [
    "string"
  ],
  "msg": "string",
  "type": "string"
}

ValidationError

Properties

Name Type Description
loc [anyOf] none

anyOf

Name Type Description
» anonymous string none

or

Name Type escription
» anonymous integer none

continued

Name Type Description
msg string Error message
type string Error type

ValuePayloadSchema

{
  "amount": 0,
  "currency": "USD"
}

ValuePayloadSchema

Properties

Name Type Required Description
amount number (>0) true Amount
currency any true Currency or cryptocurrency

anyOf

Name Type Description
» anonymous Currency Available Currencies.

or

Name Type Description
» anonymous Cryptocurrency Available Cryptocurrencies.

WebhookEvent

"payment.completed"

WebhookEvent

Properties

Name Type Description
WebhookEvent string Available Webhook events.

Enumerated Values

Property Value
WebhookEvent payment.created
WebhookEvent payment.completed
WebhookEvent payment.unresolved
WebhookEvent payment.resolved
WebhookEvent payment.expired
WebhookEvent payment.closed
WebhookEvent invoice.created
WebhookEvent invoice.viewed
WebhookEvent invoice.expired
WebhookEvent invoice.renewed
WebhookEvent invoice.paid
WebhookEvent invoice.unresolved
WebhookEvent invoice.resolved
WebhookEvent invoice.closed
WebhookEvent deposit.created
WebhookEvent deposit.replenished
WebhookEvent deposit.unresolved
WebhookEvent deposit.resolved
WebhookEvent deposit.closed
WebhookEvent transaction.refunded
WebhookEvent withdrawal.completed
WebhookEvent withdrawal_request.created
WebhookEvent withdrawal_request.approved
WebhookEvent withdrawal_request.declined

WithdrawalRequestDeclinePayloadSchema

{
  "comment": "Client's card is blocked"
}

WithdrawalRequestDeclinePayloadSchema

Properties

Name Type Required Description
comment string false Additional withdrawal info

WithdrawalRequestPayloadSchema

{
  "address": "string",
  "value": {
    "property1": {
      "amount": 0,
      "currency": "USD"
    },
    "property2": {
      "amount": 0,
      "currency": "USD"
    }
  },
  "comment": "string"
}

WithdrawalRequestPayloadSchema

Properties

Name Type Required Description
address string true if type is crypto Withdrawal address
value ValuePayloadSchema true Withdrawal amount and currency
comment string (255) false Any additional info

WithdrawalRequestResponseSchema

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "type": "crypto",
  "address": "TN8etC84NYvKT7WZmU1TdvCsU3RUo2waaG",
  "value": {
    "amount": 10,
    "currency": "USDT_TRC20"
  },
  "comment": "tg: @username",
  "timeline": [
    {
      "status": "Received",
      "created_at": "2019-08-24T14:15:22Z"
    },
    {
      "status": "Declined",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "created_at": "2019-08-24T14:15:22Z"
}

WithdrawalRequestResponseSchema

Properties

Name Type Description
id string(uuid) Withdrawal request ID
type string Withdrawal request type
address string Destination address
value object Amount and currency or cryptocurrency
comment string Additional comments
status StatusResponseSchema Current status
created_at string(date-time) Time of creating