3.7. /api/v2/get-exchange

Introduction

Get exchange rate is initiated through HTTPS POST request by using URLs and the parameters specified below. Use OAuth HMAC-SHA1 for authentication. See Statuses.

API URLs

Integration

Production

https://sandbox.gitpay.tech/paynet/api/v2/get-exchange/ENDPOINTID

https://gate.gitpay.tech/paynet/api/v2/get-exchange/ENDPOINTID

Request Parameters

Note

Request must have content-type=application/x-www-form-urlencoded and Authorization headers.

Parameter Name

Description

Value

exchange-provider

Exchange provider.

Necessity: Required
Type: String
Length: 128

exchange-currency-code-from

Currency code that need to exchange (See:Currency codes).

Necessity: Required
Type: String
Length: 128

exchange-currency-code-to

Currency code that need to get (See:Currency codes).

Necessity: Required
Type: String
Length: 128

Response Parameters

Note

Response has Content-Type: text/html;charset=utf-8 header. All fields are x-www-form-urlencoded, with (0xA) character at the end of each parameter’s value.

Parameter Name

Description

exchange-low-rate

Provider’s buy rate.

exchange-high-rate

Provider’s sell rate.

Request Example

POST /paynet/api/v2/get-exchange/39790 HTTP/1.1
Host: sandbox.gitpay.tech
User-Agent: curl/7.83.0
Accept: */*
Authorization: OAuth realm="",oauth_version="1.0",oauth_consumer_key="test_merch",oauth_timestamp="1684995901",oauth_nonce="1kKy3hMlAe1",oauth_signature_method="HMAC-SHA1",oauth_signature="jGUaNFqLvBO1gGgWag%2FSU3wMnUc%3D"
Content-Length: 222
Content-Type: application/x-www-form-urlencoded
Connection: close

exchange-currency-code-from=USD
&exchange-currency-code-to=RUB
&exchange-provider=test
&oauth_consumer_key=test_merch
&oauth_nonce=1kKy3hMlAe1
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1684995901
&oauth_version=1.0

Success Response Example

HTTP/1.1 200
Server: server
Date: Thu, 25 May 2023 06:27:46 GMT
Content-Length: 48
Connection: close
X-XSS-Protection: 1
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000
Strict-Transport-Security: max-age=31536000

exchange-low-rate=10.00
&exchange-high-rate=20.00

Fail Response Example

HTTP/1.1 403
Server: server
Date: Thu, 25 May 2023 07:02:59 GMT
Content-Type: text/html
Content-Length: 735
Connection: close
X-XSS-Protection: 1
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000

error-message=Book TCurrencyBook was not found by code USB

Postman Collection

Request Builder

HTTP method
URL
parameters
version
consumer key
consumer secret
timestamp

nonce

signature method

normalized parameters
signature base string
signature
authorization header