Skip to main content

Error Handling

Token Request Errors​

401 Unauthorized:

  • Invalid client_id or client_secret
  • Solution: Verify your credentials

400 Bad Request:

  • Missing required fields
  • Solution: Ensure grant_type, client_id, and client_secret are provided

Contract Creation Errors​

401 Unauthorized:

  • Invalid or expired access token
  • Solution: Request a new token

400 Bad Request:

  • Missing required fields
  • Invalid field values
  • Check `validationErrors` array in response for details

Example Error Response:

{
"message": "Validation failed",
"status": 400,
"validationErrors": [
{
"field": "amount",
"message": "Amount must be greater than 0"
}
]
}

Contract Fee Errors​

These errors relate to setting your platform fee on a contract. See Contract Fees for the full guide.

HTTPCodeMessageCause
4031887ContractLevelFeeNotEligibleYou sent a fee field, but contract-level fee is not enabled
400—BuyerOrSellerFeeRequiredcontract-level fee is enabled, but no fee was specified
400—NoFeesAppliedCannotCombineWithFeesnoFeesApplied sent together with a fee percentage
400—BuyerFeePercentageOutOfRangebuyerFeePercentage is outside 0–100
400—SellerFeePercentageOutOfRangesellerFeePercentage is outside 0–100

403 · ContractLevelFeeNotEligible (code 1887)

  • You sent buyerFeePercentage, sellerFeePercentage or noFeesApplied but your account uses the fee agreed with WePay for every contract.
  • Solution: remove the fee fields, or contact WePay to enable contract-level fee for your account.

400 · BuyerOrSellerFeeRequired

  • contract-level fee is enabled for your account, so WePay expects you to state the fee on every contract. It does not fall back to your agreed fee.
  • Solution: send buyerFeePercentage and/or sellerFeePercentage. If you intend to charge nothing on this contract, send noFeesApplied: true.