Hydrus.gg
  • Português
    • Jogos
      • FiveM
        • Comandos
          • Créditos
          • vRP
          • QBCore
        • Criando comandos
        • Crédito personalizado
        • Framework personalizado
        • Créditos personalizados
        • Exports
          • add_credit
          • base64_decode
          • base64_encode
          • consume_credit
          • create_command
          • find_order
          • find_product
          • get_group_expiration
          • migrate_player_id
          • random_uuid
          • run
          • schedule
          • sql_insert
          • testdrive
        • Eventos
          • hydrus:vehicle-redeem
          • hydrus:system-notify
          • hydrus:vip-notify
          • hydrus:insert
          • hydrus:inserted
        • Configuração
      • RedM
        • VORP
      • Minecraft
      • Standalone
    • Webhooks
    • Variáveis
    • Layout próprio
    • Temas exclusivos
      • Premium
    • Fast Checkout
    • Bot do Discord
      • Hospedando o Bot
      • Comandos
    • API
      • Autenticação
      • Cupons
Powered by GitBook
On this page
  • Obter todos os cupons
  • Criar um cupom
  • Atualizar um cupom
  • Excluir um cupom
  1. Português
  2. API

Cupons

Obter todos os cupons

GET /stores/<storeId>/coupons

Headers

Name
Value

Authorization

<token>

Response

{
	"current_page": 1,
	"data": [
		{
			"id": 887932,
			"store_id": 1,
			"name": "PLACEHOLDER",
			"value": 10,
			"is_flat": false,
			"minimum": 0,
			"remaining": null,
			"created_at": "2024-07-09T00:05:55.000000Z",
			"updated_at": "2024-07-09T00:05:55.000000Z",
			"unique_criteria": null,
			"is_ephemeral": false,
			"deleted_at": null,
			"partner_commission": 0,
			"starts_at": null,
			"ends_at": "2024-07-09T00:06:05.000000Z",
			"orders_count": 0
		},
		{
			"id": 889079,
			"store_id": 1,
			"name": "PLACEHOLDER_2",
			"value": 80,
			"is_flat": false,
			"minimum": 0,
			"remaining": 1,
			"created_at": "2024-07-27T00:25:55.000000Z",
			"updated_at": "2024-07-27T00:25:55.000000Z",
			"unique_criteria": null,
			"is_ephemeral": true,
			"deleted_at": null,
			"partner_commission": 0,
			"starts_at": null,
			"ends_at": "2024-08-03T00:25:58.000000Z",
			"orders_count": 0
		},
		{
			"id": 62433,
			"store_id": 1,
			"name": "PLACEHOLDER_3",
			"value": 10,
			"is_flat": false,
			"minimum": 0,
			"remaining": null,
			"created_at": "2023-02-15T19:44:18.000000Z",
			"updated_at": "2024-07-27T05:22:49.000000Z",
			"unique_criteria": null,
			"is_ephemeral": false,
			"deleted_at": null,
			"partner_commission": 10,
			"starts_at": null,
			"ends_at": null,
			"orders_count": 1
		}
	],
	"first_page_url": "http:\/\/api.hydrus.gg\/stores\/1\/coupons?page=1",
	"from": 1,
	"last_page": 1,
	"last_page_url": "http:\/\/api.hydrus.gg\/stores\/1\/coupons?page=1",
	"links": [
		{
			"url": null,
			"label": "&laquo; Previous",
			"active": false
		},
		{
			"url": "http:\/\/api.hydrus.gg\/stores\/1\/coupons?page=1",
			"label": "1",
			"active": true
		},
		{
			"url": null,
			"label": "Next &raquo;",
			"active": false
		}
	],
	"next_page_url": null,
	"path": "http:\/\/api.hydrus.gg\/stores\/1\/coupons",
	"per_page": 15,
	"prev_page_url": null,
	"to": 3,
	"total": 3
}
{
  "error": "Invalid request"
}

Criar um cupom

POST /stores/<storeId>/coupons

Headers

Name
Value

Content-Type

application/json

Authorization

<token>

Body

Name
Type
Description

name

string

Código do cupom

value

number

Valor do cupom

is_flat

boolean

Se o cupom é fixo ou percentual

minimum

number

Valor mínimo do pedido para aplicar o cupom

remaining

number

Limite de usos do cupom (estoque)

is_ephemeral

boolean

Se o cupom será arquivado após o primeiro uso

partner_commission

number

Porcentagem de comissão do parceiro (entre 1 e 100)

starts_at

datetime

Data de início do cupom

ends_at

datetime

Data de fim do cupom

unique_criteria

enum

Critério único de identificação, que limita um uso por comprador. variables.username variables.uuid variables.user_id variables.steam variables.discord

Response

{
	"name": "PLACEHOLDER",
	"value": 10,
	"is_flat": false,
	"store_id": 1,
	"updated_at": "2025-01-01T00:00:00.000000Z",
	"created_at": "2025-01-01T00:00:00.000000Z",
	"id": 123456789
}
{
	"message": "The name has already been taken. (and 1 more error)",
	"errors": {
		"name": [
			"The name has already been taken."
		],
		"value": [
			"The value field is required."
		]
	}
}

Atualizar um cupom

PUT /stores/<storeId>/coupons/<couponId>

Headers

Name
Value

Content-Type

application/json

Authorization

<token>

Body

O corpo desta requisição segue as mesmas regras de criação.

Response

A resposta desta requisição retorna o próprio cupom após o update.

Excluir um cupom

DELETE /stores/<storeId>/coupons/<couponId>

Headers

Name
Value

Authorization

<token>

Response

{
	"message": "Entity Coupon not found"
}

PreviousAutenticação

Last updated 3 months ago