Purchases by Hash

Request verification code by hash

Changed on

Requests verification code and password from provider using purchase hash code. Updates purchase status to SUCCESS.

No authentication required. The hash code serves as the access token.

Idempotent Operation. Safe to retry on network errors - will not generate duplicate codes.

Path parameter hash. If it is missing or empty before /request-code (e.g. /v1/purchases-by-hash/request-code), the API returns 400 with fieldViolations on hash.

post/v1/purchases-by-hash/{hash}/request-code

Request

  • Base URL
    https://api.getmytg.com
  • URL
    https://api.getmytg.com/v1/purchases-by-hash/{hash}/request-code
  • Auth
    • API key in header x-api-key
    • or HTTP bearer

Path parameters

hashstring required

Unique hash code of the purchase

Example:abc-def-1234567890

Request body

callback_urlstring uri

URL to receive webhook notification when code is received. POST request will be sent with either WebhookSuccessPayload or WebhookFailedPayload.

Retry policy. If your endpoint does not return HTTP 200, webhook will be retried up to 3 times with delays: immediately, after 10 seconds, after 30 seconds. Any non-200 response triggers retry.

Example request

{
  "callback_url": "https://example.com/webhooks/code-received"
}

Response

Response for status 200

Example response

{
  "purchase": {
    "id": 12345,
    "country_code": "US",
    "emoji": "🇺🇸",
    "display_name": {
      "ru": "США",
      "en": "United States"
    },
    "phone_number": "+12025550123",
    "price": {
      "amount": "1.50",
      "currency_code": "USD"
    },
    "status": "SUCCESS",
    "purchase_type": "SINGLE",
    "purchase_source": "BOT",
    "verification": {
      "code": "12345",
      "password": "secret123",
      "received_at": "2024-11-19T07:52:00.000Z"
    },
    "created_at": "2024-11-19T07:50:00.000Z"
  },
  "code_request": {
    "status": "pending",
    "attempt": 1,
    "max_attempts": 18,
    "next_attempt_at": "2024-01-15T10:30:00.000Z",
    "retry_after": 10
  }
}

Changes