The sandbox reports a failure in one of three places, and each place says something different about what went wrong.
| Where | What it means | What to do |
|---|---|---|
| The HTTP status, 4xx or 5xx | The request never reached GraphQL: no valid token, a body that isn't JSON, a wrong method or address. | Fix the request. |
errors in a 200 answer |
GraphQL refused the operation, or an argument is out of range. | Fix the operation or the argument. |
A problem in data |
The request was valid, and a rule of the API stopped the mutation. | Read the problem's type and fields, and act on them. |
HTTP Errors#
| Status | When | The answer |
|---|---|---|
| 400 | The body of a GraphQL request isn't JSON, or has no query. A token request isn't form-encoded, has no grant_type or a grant type other than client_credentials, or sends the secret two ways. |
errors with a message; for a token request, an OAuth 2.0 error. |
| 401 | A GraphQL request has no token, an unknown one or an expired one. A token request has a wrong client ID or secret. | A WWW-Authenticate header, and UNAUTHENTICATED or invalid_client. See Authentication. |
| 404 | The address isn't /graphql or /oauth/token. |
A message naming both. |
| 405 | The method isn't POST. |
An Allow: POST header. |
| 413 | The body is larger than 1 MB. | A message. |
| 500 | The sandbox failed. | A message; the sandbox's terminal shows the cause. |
Example: Send a body that isn't JSON
curl -s -X POST http://localhost:4100/graphql \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $TOKEN" \
-d '{query: payment}'
Response, HTTP 400:
{
"errors": [
{
"message": "The request body isn't valid JSON."
}
]
}
Example: Send a GET request
curl -s http://localhost:4100/graphql \
-H "Authorization: Bearer $TOKEN"
Response, HTTP 405, with the header Allow: POST:
{
"errors": [
{
"message": "Send a POST request."
}
]
}
GraphQL Errors#
GraphQL errors come in the errors list of an answer with HTTP status 200. Each has a message, the locations in your operation, and often a path and an extensions.code. When a field fails, data holds null in its place.
extensions.code |
Cause | What to do |
|---|---|---|
BAD_USER_INPUT |
An argument is out of range: first outside 1 to 100. extensions.argument names it. |
Change the argument. |
| None | The operation doesn't match the schema, so GraphQL refused it before running it. | Check the field and its type in the schema. |
Example: Ask for more events than a page holds
query Events {
webhookEvents(first: 500) { id }
}
Response, HTTP 200:
{
"errors": [
{
"message": "`first` must be between 1 and 100.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"webhookEvents"
],
"extensions": {
"code": "BAD_USER_INPUT",
"argument": "first"
}
}
],
"data": null
}
Example: Ask for a field that doesn't exist
query Payment($id: ID!) {
payment(id: $id) { id status fee }
}
Variables:
{
"id": "pay_0001"
}
Response, HTTP 200:
{
"errors": [
{
"message": "Cannot query field \"fee\" on type \"Payment\".",
"locations": [
{
"line": 2,
"column": 32
}
]
}
]
}
An ID that matches nothing isn't an error: the query answers null.
Example: Read a payment that doesn't exist
query Payment($id: ID!) {
payment(id: $id) { id status }
}
Variables:
{
"id": "pay_9999"
}
Response, HTTP 200:
{
"data": {
"payment": null
}
}
Problems#
A problem is a rule of the API that stopped a mutation. It comes in data, as one of the types in the mutation's union, and every problem type implements the Problem interface, so every one has a message. A mutation that is stopped changes nothing.
Ask for __typename and ... on Problem { message } in every mutation, then add the fields of the problems you handle. Your code can then switch on __typename, and still show a message for a problem it doesn't know yet.
| Problem | Returned by | Cause | Its own fields | What to do |
|---|---|---|---|---|
InvalidFieldProblem |
onboardCompany, openAccount, initiateCreditTransfer |
A field is empty, too long or in the wrong format. | field: its path, such as creditor.name |
Fix the field field names. |
AccountHolderNotFoundProblem |
openAccount, sandboxSetVerificationStatus |
No account holder has the ID. | accountHolderId |
Check the ID. |
AccountHolderNotVerifiedProblem |
openAccount |
The verification is PENDING or REFUSED. |
accountHolderId, verificationStatus |
Wait for VERIFIED: an account_ event says when. |
VerificationAlreadyDecidedProblem |
sandboxSetVerificationStatus |
The verification already ended. A result is final. | accountHolderId, verificationStatus |
Onboard the company again to test another result. |
AccountNotFoundProblem |
initiateCreditTransfer, sandboxCreditAccount |
No payment account has the ID. | accountId |
Check the ID. |
InvalidAmountProblem |
initiateCreditTransfer, sandboxCreditAccount |
The amount isn't above zero with at most two decimals. | value |
Send a string such as 1250.50. |
UnsupportedCurrencyProblem |
initiateCreditTransfer, sandboxCreditAccount |
The currency isn't EUR. |
currency, supportedCurrencies |
Send euros. |
InvalidIbanProblem |
initiateCreditTransfer |
The creditor's IBAN fails a check. | iban, reason: FORMAT, COUNTRY, LENGTH or CHECKSUM |
Ask the creditor for the IBAN again. See Payments. |
InsufficientFundsProblem |
initiateCreditTransfer |
The available balance is lower than the amount. | availableBalance, requestedAmount |
Send less, or wait for money to arrive. |
IdempotencyKeyReusedProblem |
initiateCreditTransfer |
The key was used for a payment with a different input. | idempotencyKey, paymentId |
Use a new key for a new payment. See Payments. |
PaymentNotFoundProblem |
sandboxSettlePayment |
No payment has the ID. | paymentId |
Check the ID. |
PaymentAlreadySettledProblem |
sandboxSettlePayment |
The payment is BOOKED or REJECTED. Those statuses are final. |
paymentId, status |
Nothing: the payment's result is final. |
WebhookEventNotFoundProblem |
sandboxResendWebhookEvent |
No event has the ID. | eventId |
Check the ID with webhookEvents. |
WebhookEndpointNotSetProblem |
sandboxResendWebhookEvent |
The sandbox started without WEBHOOK_URL. |
None | Restart the sandbox with WEBHOOK_URL. |
When a request breaks more than one rule, you get one problem: the first, in this order. The fields, then the idempotency key, then the objects the input names, then the amount and the currency, then the IBAN, and last the balance.
Example: Open an account before the verification ends
mutation OpenAccount($input: OpenAccountInput!) {
openAccount(input: $input) {
__typename
... on OpenAccountSuccess {
account {
id name iban
availableBalance { value currency }
}
}
... on Problem { message }
... on AccountHolderNotVerifiedProblem { verificationStatus }
}
}
Variables:
{
"input": {
"accountHolderId": "ah_0001",
"name": "Main account"
}
}
Response, HTTP 200:
{
"data": {
"openAccount": {
"__typename": "AccountHolderNotVerifiedProblem",
"message": "The account holder's verification is PENDING. An account opens only once it is VERIFIED.",
"verificationStatus": "PENDING"
}
}
}
Example: Set the verification of an account holder that is already verified
mutation Verify($input: SandboxSetVerificationStatusInput!) {
sandboxSetVerificationStatus(input: $input) {
__typename
... on SandboxSetVerificationStatusSuccess {
accountHolder { id verificationStatus }
}
... on Problem { message }
}
}
Variables:
{
"input": {
"accountHolderId": "ah_0001",
"status": "REFUSED",
"reason": "Documents expired."
}
}
Response, HTTP 200:
{
"data": {
"sandboxSetVerificationStatus": {
"__typename": "VerificationAlreadyDecidedProblem",
"message": "The verification already ended in VERIFIED. A result is final."
}
}
}
Example: Onboard a company with a country name instead of a code
mutation Onboard($input: OnboardCompanyInput!) {
onboardCompany(input: $input) {
__typename
... on OnboardCompanySuccess {
accountHolder { id legalName verificationStatus createdAt }
}
... on Problem { message }
... on InvalidFieldProblem { field }
}
}
Variables:
{
"input": {
"legalName": "Example Bakery SAS",
"registrationNumber": "SANDBOX-0042",
"country": "France"
}
}
Response, HTTP 200:
{
"data": {
"onboardCompany": {
"__typename": "InvalidFieldProblem",
"message": "country must be a two-letter ISO 3166 code in capitals, such as FR.",
"field": "country"
}
}
}
Payments shows the problems of a transfer: an IBAN with wrong check digits, a sandbox IBAN, a reused key, too little money, a currency other than the euro and an amount of zero.
Troubleshooting#
| What you see | Cause | Fix |
|---|---|---|
Connection refused on port 4100 |
The sandbox isn't running, or runs on another port. | Start it with node content/, and check PORT. |
HTTP 401, invalid_client |
The client ID or secret differs from the sandbox's. | Use the values of SANDBOX_CLIENT_ID and SANDBOX_CLIENT_SECRET, or the defaults if they aren't set. |
HTTP 401, error="invalid_ |
The token expired, or the sandbox restarted and forgot it. | Get a new token. |
| HTTP 400, The request body isn't valid JSON. | A quote in the shell broke the JSON. | Send the body from a file or a heredoc, as the Quickstart does. |
IdempotencyKeyReusedProblem when you send a payment again |
The input changed between the two attempts. | Send the first input unchanged, or use a new key if it is a new payment. |
| The available and booked balances differ | A payment is INITIATED or PENDING: its amount is reserved. |
Nothing: they meet again when the payment is BOOKED or REJECTED. |
Your endpoint receives nothing, and deliveries is empty |
The sandbox started without WEBHOOK_URL. |
Restart it with WEBHOOK_URL. |
| Your endpoint answers 400 to every delivery | The secrets differ, or the body was parsed before it was verified. | Use the same WEBHOOK_SECRET for both, and verify the raw bytes. See Webhooks. |
| Signatures fail only on some deliveries | Your server's clock is more than 300 seconds off. | Synchronize the clock. |
| An event is handled twice | The endpoint doesn't keep the IDs of the events it accepted. | Deduplicate by event ID. See Webhooks. |
Cannot query field |
The operation asks for a field the type doesn't have. | Check the schema, or ask the sandbox with an introspection query. |