SelectwinDOCS

Catálogo de Códigos de Erro

Este catálogo lista os valores de error.code que a API pode retornar, agrupados por status HTTP e

Este catálogo lista os valores de error.code que a API pode retornar, agrupados por status HTTP e por recurso. Para a estrutura do objeto de erro (envelope), veja Tratamento de Erros.

Trate erros pelo error.code, não pela message. O code é o identificador estável e legível por máquina (faz parte do contrato); a message é texto e pode mudar. Sempre presente na resposta.

Status HTTP

A API usa códigos de status HTTP padrão. O error.statusCode/error.category derivam do status:

StatuscategorySignificado
400validationRequisição malformada ou parâmetro inválido
401authenticationSelectKey ausente, inválida ou revogada
402paymentPagamento requerido / recusado
403authorizationAutenticado, mas sem permissão / limite atingido
404clientRecurso não encontrado
409clientConflito (estado incompatível, duplicidade)
412clientPré-condição falhou
422validationEntidade não processável (regra de negócio)
429rate_limitLimite de requisições excedido (veja API Limits)
500serverErro interno — tente novamente; se persistir, contate o suporte
502 / 503 / 504serverIndisponibilidade temporária de um serviço/adquirente — repita com backoff

Em erros que admitem nova tentativa (ex.: 429), a resposta pode incluir error.retryAfterMinutes indicando quanto esperar antes de repetir. Respeite esse valor no seu backoff.

Códigos comuns (cross-cutting)

error.codeHTTPQuando ocorre
invalidParameters400Falha de validação genérica (veja error.params para os campos)
invalidEmail400E-mail inválido em algum campo
invalidPassword400Senha não atende aos requisitos
serverError500Erro interno inesperado

Erros de validação de campos trazem detalhes por campo em error.params:

{
  "error": {
    "code": "invalidParameters",
    "statusCode": 400,
    "category": "validation",
    "message": "Validation errors occurred.",
    "params": [{ "amount": "amount must be a positive integer" }]
  }
}

Por recurso

Transactions

error.codeHTTPMensagem
transactionIdIsInvalid400Transaction ID is invalid
transactionNotFound404Transaction not found
transactionDisputeInProcess409Transaction dispute in process
transactionRefundNotProcessable409Transaction refund not processable
transactionCaptureNotProcessable409Transaction capture not processable
transactionCaptureNotAllowed403Transaction capture not allowed
transactionMethodCaptureNotAllowed403Transaction method capture not allowed
traCaptureMinAmount400Capture amount is lower than the minimum allowed
traCaptureAmountExceedsAuthorized400Capture amount exceeds authorized amount
traCaptureAmountAfterFeesExceedsAuthorized400Capture amount after fees exceeds authorized amount
traCaptureFailed503Transaction capture failed
missingFeeConfiguration422Missing fee configuration
paymentProcessingFailed503Payment processing service unavailable

Subscriptions

/v1/subscriptions é Stripe-strict: a precificação vem das variantes; campos manuais são rejeitados.

error.codeHTTPMensagem
billingNotAcceptedInStripeStrict422billing[*] fields are not accepted
amountOnlyNotAllowedInSubscription422amount is not accepted in subscription create
manualItemNotAllowedInSubscription422Manual items are not allowed in subscription create
oneTimeVariantNotAllowedInSubscription422One-time variant cannot be used in subscription
variantScheduleDivergent422Variants have divergent schedules

Customers

error.codeHTTPMensagem
customerNotFound / customerIdNotFound404Customer not found
customerAlreadyExists409Customer already exists
customerIdIsInvalid400Customer ID is invalid
customerCreateNotProcessable422Customer create not processable
customerDeleteNotProcessable422Customer delete not processable
customerReadNotProcessable422Customer read not processable
customerParametersInvalid400Customer parameters are invalid

Cards

error.codeHTTPMensagem
cardNotFound / cardIdNotFound404Card not found
cardIdIsInvalid / transactionCardIdInvalid400Card ID is invalid
transactionCardInvalid400Transaction card is invalid
cardExpired400Card expired
invalidCardData422Invalid card data
cardBrandNotSupported422Card brand not supported
cardCreateNotProcessable422Card create not processable
cardAndCustomerOfCompanyNotSame422Card and customer of company are not the same
limitReached403Card limit reached

Wallets

error.codeHTTPMensagem
walletNotFound404Wallet not found
walletIdIsInvalid400Wallet ID is invalid
invalidWallet / invalidWalletData400 / 422Wallet is invalid / Invalid wallet data
bankCodeNotSupported400This bank code is not supported
bankAccountCreateNotProcessable422Bank account is not processable
bankAccountNotReadable422Bank account is not readable
bankAccountNotDeletable422Bank account is not deletable

Withdrawals

error.codeHTTPMensagem
withdrawalIdIsInvalid400Withdrawal ID is invalid
withdrawalInvalid400Withdrawal is invalid
withdrawalAmountLessThanMinimum422Withdrawal amount is less than minimum
withdrawalCreateNotProcessable422Withdrawal is not processable
withdrawalStatusNotAcceptable422Withdrawal status is not acceptable
withdrawalProcessFailedByWalletNotRegistered422Withdrawal failed: wallet not registered
withdrawalNotProcessed422Withdrawal is not processed
withdrawalNotReadable422Withdrawal is not readable
withdrawalNotDeletable422Withdrawal is not deletable

Finance (Balance)

error.codeHTTPMensagem
balanceIsInsufficient422Balance funds is insufficient for this operation
balanceNotFound404Your balance not found

Products & Variants

error.codeHTTPMensagem
productIdNotFound404Product not found
productIdIsInvalid400Product ID is invalid or does not exist
variantIdNotFound404Variant not found
variantIdIsInvalid / productVariantIdIsInvalid400Variant ID is invalid or does not exist
productVariantIdIsRequired400Product variant ID is required
pricingTypeImmutable422pricing.type is immutable
pricingSchemaImmutable422pricing.schema is immutable
variantRecurringNotAllowedInTransaction422Recurring variant not allowed in one-time transaction
productCreationFailed / productDeleteFailed422Product creation / delete failed
productCreateLimitReached403Product create limit reached

Coupons

error.codeHTTPMensagem
couponIdNotFound404Coupon not found
couponIdIsInvalid400Coupon ID is invalid
couponCreateItemIdIsInvalid400Coupon item ID is invalid
couponCreateCustomerIdIsInvalid400Coupon customer ID is invalid
couponCreateFailed / couponUpdateFailed / couponDeleteFailed400Coupon create / update / delete failed

Addresses

error.codeHTTPMensagem
addressIdNotFound404Address not found

Webhooks

error.codeHTTPMensagem
webhookEndpointUrlExists400Webhook endpoint URL already exists
invalidWebhookEndpointId400Webhook endpoint ID is invalid
invalidWebhookEventId / webhookEventIdInvalid400Webhook event ID is invalid
webhookDispatchIdInvalid400Webhook dispatch ID is invalid
eventTypeInvalid / webhookEventInvalid400Webhook event / type is invalid
webhookEventsValidationFailed400Webhook events validation failed

Domains

error.codeHTTPMensagem
domainIdNotFound404Domain not found
domainIdIsInvalid400Domain ID is invalid
domainHasAlreadyBeenTaken409Domain has already been taken
domainLimitReached403Domain limit reached
domainCreateNotProcessable / domainUpdateNotProcessable422Domain create / update not processable
domainEdgeProvisionFailed422Domain could not be provisioned at the edge

Exports

error.codeHTTPMensagem
validationError400Export request is invalid
permissionDenied403Permission denied
resourceNotFound404Export not found
exportTooLarge / rowCapExceededDuringGeneration422Export exceeds the row limit
exportNotCancelable409Export cannot be canceled
queryTimeout / estimateTimeout422Export query / estimate timed out
serializationError / uploadFailed500Export serialization / upload failed

Como tratar erros (recomendado)

const res = await fetch(url, { headers: { SelectKey: process.env.SELECTWIN_API_KEY } });
if (!res.ok) {
  const { error } = await res.json();
  switch (error.code) {                       // ← key no code, nunca na message
    case 'customerNotFound':
      return handleMissingCustomer();
    case 'balanceIsInsufficient':
      return promptTopUp();
    default:
      if (error.statusCode === 429) return retryWithBackoff();   // rate limit
      if (error.statusCode >= 500)  return retryWithBackoff();   // transitório
      throw new Error(`${error.code}: ${error.message}`);
  }
}

Esta lista cobre os erros mais comuns voltados ao desenvolvedor para cada recurso público. Outros códigos específicos podem aparecer; trate sempre o default pelo error.statusCode/category.

On this page