Lewati ke konten

Error

Setiap error API Baiyar punya bentuk yang sama dan kode yang tetap. Cari arti sebuah kode dan apa yang harus dilakukan.


Setiap error dijawab dengan status HTTP non-2xx dan body JSON yang sama. Tangani lewat error.code (tetap), bukan teks error.detail (untuk manusia, bisa berubah).

{
"error": {
"type": "request_error",
"code": "invalid_field",
"detail": "Request does not pass validation.",
"documentation_url": "https://docs.baiyar.com/resources/errors/invalid_field/",
"errors": [{ "field": "amount", "message": "must be at least 1" }]
},
"meta": { "request_id": "req_…" }
}
  • error.type mengelompokkan kode; error.code menjelaskan persis apa yang terjadi.
  • error.errors muncul pada kegagalan validasi, satu entri per field.
  • meta.request_id mengenali request: sebutkan saat menghubungi kami. Ada juga di setiap respons.
  • 429 dan 409 idempotency_in_progress membawa Retry-After (detik).

Masalahnya ada di request atau di keadaan resource. Ubah sesuatu sebelum mengirim lagi.

Kode HTTP Arti (pesan dari API, Inggris)
invalid_field 400 Request does not pass validation.
invalid_request 400 Request body is invalid.
not_found 404 Resource was not found.
already_exists 409 A resource with the same unique value already exists.
invalid_state 409 Resource is not in a valid state for this action.
data_unreadable 409 The stored data was sealed with a key this environment does not have, so it cannot be shown.
version_conflict 409 The resource changed since you loaded it. Reload and try again.
limit_exceeded 409 A usage limit has been reached.
method_not_allowed 405 This HTTP method is not allowed for this endpoint.
unsupported_media_type 415 Content-Type is not supported for this endpoint.
request_body_too_large 413 Request body is too large.
payment_method_not_enabled 422 This payment method is not enabled for this project.
payment_rejected 422 The payment could not be created with these values.
webhook_endpoint_limit 409 The limit of webhook endpoints was reached. Delete one before adding another.
payment_link_unavailable 404 This payment link is not available.
payment_link_in_use 409 This payment link is already being paid or was paid.
payment_link_limit_reached 409 This payment link has reached the number of payments it allows.
checkout_session_invalid 401 This checkout session is not valid. Open the payment link again.

Kami tidak bisa mengenali siapa yang memanggil. Periksa kredensial yang kamu kirim.

Kode HTTP Arti (pesan dari API, Inggris)
invalid_credentials 401 Invalid email or password.
invalid_current_password 401 Invalid current password.
session_required 401 Authentication is required.
invalid_two_factor_code 401 Invalid or expired verification code.
invalid_or_expired_token 401 Invalid or expired token.
invalid_api_key 401 The API key is not valid.

Kami tahu siapa kamu, tetapi hal ini tidak diizinkan untuk key atau akun itu.

Kode HTTP Arti (pesan dari API, Inggris)
forbidden 403 You are not allowed to perform this action.
verification_required 403 Additional verification is required before this action.
insufficient_scope 403 This API key does not have the permission this request needs.
ip_not_allowed 403 This API key cannot be used from this IP address.
project_not_approved 403 This project has not been approved for live yet.
project_not_active 403 This project is not active.

Terlalu banyak request. Perlambat dan coba lagi setelah jeda.

Kode HTTP Arti (pesan dari API, Inggris)
rate_limited 429 Too many requests. Please try again later.

Ada yang salah dengan Idempotency-Key pada request.

Kode HTTP Arti (pesan dari API, Inggris)
idempotency_key_reused 409 This Idempotency-Key was used with a different request.
idempotency_in_progress 409 A request with this Idempotency-Key is still being processed.

Ada masalah di pihak kami, atau provider tidak menjawab. Aman mengulang request yang membawa Idempotency-Key.

Kode HTTP Arti (pesan dari API, Inggris)
provider_unavailable 503 This payment method is not available right now.
provider_not_configured 503 This provider is not connected on this server: its credentials are not set.
provider_unclear 502 The payment provider did not give a clear answer. Check the payment before retrying.
internal_error 500 An unexpected error occurred.
service_unavailable 503 Service is temporarily unavailable.