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.
A API usa códigos de status HTTP padrão. O error.statusCode/error.category derivam do status:
Status categorySignificado 400validationRequisição malformada ou parâmetro inválido 401authenticationSelectKey ausente, inválida ou revogada402paymentPagamento 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 .
error.codeHTTP Quando ocorre invalidParameters400 Falha de validação genérica (veja error.params para os campos) invalidEmail400 E-mail inválido em algum campo invalidPassword400 Senha não atende aos requisitos serverError500 Erro 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" }]
}
}
error.codeHTTP Mensagem transactionIdIsInvalid400 Transaction ID is invalid transactionNotFound404 Transaction not found transactionDisputeInProcess409 Transaction dispute in process transactionRefundNotProcessable409 Transaction refund not processable transactionCaptureNotProcessable409 Transaction capture not processable transactionCaptureNotAllowed403 Transaction capture not allowed transactionMethodCaptureNotAllowed403 Transaction method capture not allowed traCaptureMinAmount400 Capture amount is lower than the minimum allowed traCaptureAmountExceedsAuthorized400 Capture amount exceeds authorized amount traCaptureAmountAfterFeesExceedsAuthorized400 Capture amount after fees exceeds authorized amount traCaptureFailed503 Transaction capture failed missingFeeConfiguration422 Missing fee configuration paymentProcessingFailed503 Payment processing service unavailable
/v1/subscriptions é Stripe-strict : a precificação vem das variantes; campos manuais são rejeitados.
error.codeHTTP Mensagem billingNotAcceptedInStripeStrict422 billing[*] fields are not accepted amountOnlyNotAllowedInSubscription422 amount is not accepted in subscription create manualItemNotAllowedInSubscription422 Manual items are not allowed in subscription create oneTimeVariantNotAllowedInSubscription422 One-time variant cannot be used in subscription variantScheduleDivergent422 Variants have divergent schedules
error.codeHTTP Mensagem customerNotFound / customerIdNotFound404 Customer not found customerAlreadyExists409 Customer already exists customerIdIsInvalid400 Customer ID is invalid customerCreateNotProcessable422 Customer create not processable customerDeleteNotProcessable422 Customer delete not processable customerReadNotProcessable422 Customer read not processable customerParametersInvalid400 Customer parameters are invalid
error.codeHTTP Mensagem cardNotFound / cardIdNotFound404 Card not found cardIdIsInvalid / transactionCardIdInvalid400 Card ID is invalid transactionCardInvalid400 Transaction card is invalid cardExpired400 Card expired invalidCardData422 Invalid card data cardBrandNotSupported422 Card brand not supported cardCreateNotProcessable422 Card create not processable cardAndCustomerOfCompanyNotSame422 Card and customer of company are not the same limitReached403 Card limit reached
error.codeHTTP Mensagem walletNotFound404 Wallet not found walletIdIsInvalid400 Wallet ID is invalid invalidWallet / invalidWalletData400 / 422 Wallet is invalid / Invalid wallet data bankCodeNotSupported400 This bank code is not supported bankAccountCreateNotProcessable422 Bank account is not processable bankAccountNotReadable422 Bank account is not readable bankAccountNotDeletable422 Bank account is not deletable
error.codeHTTP Mensagem withdrawalIdIsInvalid400 Withdrawal ID is invalid withdrawalInvalid400 Withdrawal is invalid withdrawalAmountLessThanMinimum422 Withdrawal amount is less than minimum withdrawalCreateNotProcessable422 Withdrawal is not processable withdrawalStatusNotAcceptable422 Withdrawal status is not acceptable withdrawalProcessFailedByWalletNotRegistered422 Withdrawal failed: wallet not registered withdrawalNotProcessed422 Withdrawal is not processed withdrawalNotReadable422 Withdrawal is not readable withdrawalNotDeletable422 Withdrawal is not deletable
error.codeHTTP Mensagem balanceIsInsufficient422 Balance funds is insufficient for this operation balanceNotFound404 Your balance not found
error.codeHTTP Mensagem productIdNotFound404 Product not found productIdIsInvalid400 Product ID is invalid or does not exist variantIdNotFound404 Variant not found variantIdIsInvalid / productVariantIdIsInvalid400 Variant ID is invalid or does not exist productVariantIdIsRequired400 Product variant ID is required pricingTypeImmutable422 pricing.type is immutable pricingSchemaImmutable422 pricing.schema is immutable variantRecurringNotAllowedInTransaction422 Recurring variant not allowed in one-time transaction productCreationFailed / productDeleteFailed422 Product creation / delete failed productCreateLimitReached403 Product create limit reached
error.codeHTTP Mensagem couponIdNotFound404 Coupon not found couponIdIsInvalid400 Coupon ID is invalid couponCreateItemIdIsInvalid400 Coupon item ID is invalid couponCreateCustomerIdIsInvalid400 Coupon customer ID is invalid couponCreateFailed / couponUpdateFailed / couponDeleteFailed400 Coupon create / update / delete failed
error.codeHTTP Mensagem addressIdNotFound404 Address not found
error.codeHTTP Mensagem webhookEndpointUrlExists400 Webhook endpoint URL already exists invalidWebhookEndpointId400 Webhook endpoint ID is invalid invalidWebhookEventId / webhookEventIdInvalid400 Webhook event ID is invalid webhookDispatchIdInvalid400 Webhook dispatch ID is invalid eventTypeInvalid / webhookEventInvalid400 Webhook event / type is invalid webhookEventsValidationFailed400 Webhook events validation failed
error.codeHTTP Mensagem domainIdNotFound404 Domain not found domainIdIsInvalid400 Domain ID is invalid domainHasAlreadyBeenTaken409 Domain has already been taken domainLimitReached403 Domain limit reached domainCreateNotProcessable / domainUpdateNotProcessable422 Domain create / update not processable domainEdgeProvisionFailed422 Domain could not be provisioned at the edge
error.codeHTTP Mensagem validationError400 Export request is invalid permissionDenied403 Permission denied resourceNotFound404 Export not found exportTooLarge / rowCapExceededDuringGeneration422 Export exceeds the row limit exportNotCancelable409 Export cannot be canceled queryTimeout / estimateTimeout422 Export query / estimate timed out serializationError / uploadFailed500 Export serialization / upload failed
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.