curl --request POST \
--url https://api.avanor.tech/gateway/v1/invoice/get-refunds \
--header 'Content-Type: application/json' \
--header 'sign: <api-key>' \
--data '
{
"shop_id": 202203,
"invoice_id": 27401,
"now": "2020-04-21T20:07:02"
}
'import requests
url = "https://api.avanor.tech/gateway/v1/invoice/get-refunds"
payload = {
"shop_id": 202203,
"invoice_id": 27401,
"now": "2020-04-21T20:07:02"
}
headers = {
"sign": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {sign: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({shop_id: 202203, invoice_id: 27401, now: '2020-04-21T20:07:02'})
};
fetch('https://api.avanor.tech/gateway/v1/invoice/get-refunds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.avanor.tech/gateway/v1/invoice/get-refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shop_id' => 202203,
'invoice_id' => 27401,
'now' => '2020-04-21T20:07:02'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"sign: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.avanor.tech/gateway/v1/invoice/get-refunds"
payload := strings.NewReader("{\n \"shop_id\": 202203,\n \"invoice_id\": 27401,\n \"now\": \"2020-04-21T20:07:02\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("sign", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.avanor.tech/gateway/v1/invoice/get-refunds")
.header("sign", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"shop_id\": 202203,\n \"invoice_id\": 27401,\n \"now\": \"2020-04-21T20:07:02\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.avanor.tech/gateway/v1/invoice/get-refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["sign"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop_id\": 202203,\n \"invoice_id\": 27401,\n \"now\": \"2020-04-21T20:07:02\"\n}"
response = http.request(request)
puts response.read_body{
"result": true,
"message": "Ok",
"error_code": 0,
"data": [
{
"shop_refund_id": "aeee94a6-4e52-4a6f-ae63-f2159eb35add",
"status": "SUCCESS",
"invoice_id": 27401,
"amount": "91.00",
"currency": "USD",
"error_code": 0,
"created_at": "2020-04-21T20:07:02",
"processed_at": "2020-04-21T20:08:02",
"settlement_amount": "91.00",
"settlement_currency": "USD",
"settlement_rate": null
}
]
}Invoice refund status
To get status and up-to-date information on refunds.
Fields involved in request signature generation:
invoice_idnowshop_id
curl --request POST \
--url https://api.avanor.tech/gateway/v1/invoice/get-refunds \
--header 'Content-Type: application/json' \
--header 'sign: <api-key>' \
--data '
{
"shop_id": 202203,
"invoice_id": 27401,
"now": "2020-04-21T20:07:02"
}
'import requests
url = "https://api.avanor.tech/gateway/v1/invoice/get-refunds"
payload = {
"shop_id": 202203,
"invoice_id": 27401,
"now": "2020-04-21T20:07:02"
}
headers = {
"sign": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {sign: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({shop_id: 202203, invoice_id: 27401, now: '2020-04-21T20:07:02'})
};
fetch('https://api.avanor.tech/gateway/v1/invoice/get-refunds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.avanor.tech/gateway/v1/invoice/get-refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shop_id' => 202203,
'invoice_id' => 27401,
'now' => '2020-04-21T20:07:02'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"sign: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.avanor.tech/gateway/v1/invoice/get-refunds"
payload := strings.NewReader("{\n \"shop_id\": 202203,\n \"invoice_id\": 27401,\n \"now\": \"2020-04-21T20:07:02\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("sign", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.avanor.tech/gateway/v1/invoice/get-refunds")
.header("sign", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"shop_id\": 202203,\n \"invoice_id\": 27401,\n \"now\": \"2020-04-21T20:07:02\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.avanor.tech/gateway/v1/invoice/get-refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["sign"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop_id\": 202203,\n \"invoice_id\": 27401,\n \"now\": \"2020-04-21T20:07:02\"\n}"
response = http.request(request)
puts response.read_body{
"result": true,
"message": "Ok",
"error_code": 0,
"data": [
{
"shop_refund_id": "aeee94a6-4e52-4a6f-ae63-f2159eb35add",
"status": "SUCCESS",
"invoice_id": 27401,
"amount": "91.00",
"currency": "USD",
"error_code": 0,
"created_at": "2020-04-21T20:07:02",
"processed_at": "2020-04-21T20:08:02",
"settlement_amount": "91.00",
"settlement_currency": "USD",
"settlement_rate": null
}
]
}Authorizations
Every API request must be signed so that we can identify your account.
The signature is transferred in the request body through the sign parameter, for example:
{
"shop_id": 202203,
"shop_order_id" : "1994",
"amout": "104.04",
"currency": 840,
"payway": "payway_usd",
"description": "Invoice sign",
"sign": "05f6d3712417f62af6cbf66ca81c2f0b249f7dc1b4cbe3a50e3f8d67a1fb35a2"
}
"sign" parameter, nevertheless your real requests must include it in the request body where required.
Signature line is generated according to the following algorithm: all request parameters involved in signature generation are ordered in the alphabetical order of keys, the values are concatenated with a colon (":") and the account secret key is added at the end (without the: sign), a sha256 hash is generated from the resulting line and its hex representation is passed in the sign request parameter.
Example of signature generation for a method invoice/create:
- Determining the list of parameters. It looks as follows for the method in consideration:
Fields involved in request signature generation:
shop_idshop_order_idamountcurrencypayway
- Let's sort keys in alphabetical sequence:
"amount", "currency", "payway", "shop_id", "shop_order_id"
- The line for generating the SHA256 hash will be as follows:
"104.04:840:payway_usd:202203:1994account-secret-key"
Where account-secret-key is the secret identification key for your account. You can request a key from the support service.
- Let's get a hash expression of the generated line using Python code:
>>> string_to_sign = '104.04:840:payway_usd:202203:1994account-secret-key' >>> import hashlib >>> sign = hashlib.sha256(string_to_sign.encode()).hexdigest() >>> print(sign) '05f6d3712417f62af6cbf66ca81c2f0b249f7dc1b4cbe3a50e3f8d67a1fb35a2'
Body
Response
- Refund is successfully created
- Error response
Boolean value, in case of successful response it will be true, in case of error – false
true
A textual description of the error, in case of success - simply Ok
"Ok"
If this value is greater than 0, then the request ended with an error. Description of error codes
0
Information about created refund operations for the specified invoice
Show child attributes
Show child attributes