Перейти к основному содержанию
POST
/
v1
/
purchases
/
{purchase_id}
/
refund
JavaScript
import Gmt from 'gmt-typescript-sdk';

const client = new Gmt({
  apiKey: process.env['GMT_API_KEY'], // This is the default and can be omitted
});

const response = await client.purchases.refund(12345);

console.log(response.purchase);
{
  "purchase": {
    "id": 12345,
    "country_code": "US",
    "display_name": {
      "ru": "США",
      "en": "United States"
    },
    "phone_number": "+12025550123",
    "price": {
      "amount": "1.50",
      "currency_code": "USD"
    },
    "status": "SUCCESS",
    "purchase_type": "SINGLE",
    "verification": {
      "code": "12345",
      "password": "secret123",
      "received_at": "2024-11-19T07:52:00.000Z"
    },
    "created_at": "2024-11-19T07:50:00.000Z"
  },
  "refund": {
    "amount": {
      "amount": "1.50",
      "currency_code": "USD"
    },
    "reason": "Auto-refund: code not received within 20 minutes",
    "refunded_at": "2024-11-19T08:15:00.000Z"
  }
}

Авторизации

x-api-key
string
header
обязательно

API-key that you received from Telegram Bot.

Параметры пути

purchase_id
integer
обязательно

Unique purchase identifier.

Требуемый диапазон: 1 <= x <= 9007199254740991
Пример:

12345

Ответ

200 - application/json

Response for status 200

purchase
object
обязательно
refund
object
обязательно