Modem Pay returns errors in a consistent JSON format to make it easy to handle issues in your application. Each error includes a simple message explaining the issue, with HTTP status codes indicating the type of error.
Check the message field in the response to understand the cause of the error. If the status code is 400 or higher, review your request parameters and API key to ensure they meet Modem Pay’s requirements.
Modem Pay offers automatic retry handling for certain types of errors. By default, Modem Pay retries up to three times if a request fails due to transient issues, such as network errors or temporary server overloads. This is configurable via the maxRetries option, which you can set during initialization:
const modempay = new ModemPay(process.env.MODEM_API_KEY, { maxRetries: 3, // Sets the maximum number of retry attempts});
Retries are triggered for errors that are likely temporary, typically with 5xx server errors. Each retry is delayed slightly to give the server time to recover, helping ensure more reliable payment handling.
Modem Pay lets you configure request timeouts to prevent your application from waiting indefinitely for a response. By default, requests will time out after 60 seconds (1 minute).You can easily customize the timeout duration by specifying the timeout option (in seconds) when initializing the Modem Pay client:
const modempay = new ModemPay(process.env.MODEM_API_KEY, { timeout: 20, // Timeout set to 20 seconds});
To maintain the stability and security of our platform, Modem Pay enforces rate limiting on all API requests.Each API key is allowed up to 100 consecutive requests within a 15-minute rolling window. If this limit is exceeded, further requests will be temporarily blocked until the window resets.We recommend implementing retries with exponential backoff and monitoring your request patterns to stay within the allowed limits.If your application requires a higher throughput, please contact us at info@modempay.com to discuss increased rate limits based on your business needs.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Modem Pay Inc.","colors":{"primary":"#08a591","light":"#08a591","dark":"#08a591"},"logo":{"light":"https://mintcdn.com/modem/yM7VtPyYTpEqFm00/logo/logo.png?fit=max\u0026auto=format\u0026n=yM7VtPyYTpEqFm00\u0026q=85\u0026s=583edb50d45d5f0c7c7cfe8bed561521","dark":"https://mintcdn.com/modem/yM7VtPyYTpEqFm00/logo/logo.png?fit=max\u0026auto=format\u0026n=yM7VtPyYTpEqFm00\u0026q=85\u0026s=583edb50d45d5f0c7c7cfe8bed561521"},"favicon":"https://mintcdn.com/modem/yM7VtPyYTpEqFm00/favicon.png?fit=max\u0026auto=format\u0026n=yM7VtPyYTpEqFm00\u0026q=85\u0026s=7904dfabeae04746c6800ed6c3b3d49d","api":{"playground":{"display":"interactive"},"examples":{"defaults":"required","languages":["curl","python","javascript","php","go","java","ruby"],"prefill":false}},"navbar":{"links":[{"href":"mailto:info@modempay.com","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://merchant.modempay.com"}},"footer":{"socials":{"linkedin":"https://linkedin.com/company/modempay"}},"contextual":{"options":["copy","chatgpt","claude","mcp","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"modem","hasAudioNarration":false,"actualSubdomain":"modem","customDomains":["docs.modempay.com"],"gitSource":{"type":"github","owner":"chibuike-okpara","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6acfcc00ce70f2827c57b9c3","collectionId":"a716447e-06cb-447e-b600-f408ed4937a2","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6acfcc00ce70f2827c57b9c3"},"entitlements":{},"buildId":"6acfcc00ce70f2827c57b9c3","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"Documentation","count":37},{"language":"default","tag":"Core API Resources","count":8},{"language":"default","tag":"Collections","count":6},{"language":"default","tag":"Billing","count":5},{"language":"default","tag":"Invoices","count":5},{"language":"default","tag":"Drop-ins","count":5},{"language":"default","tag":"Stablecoins","count":5},{"language":"default","tag":"API Reference","count":5},{"language":"default","tag":"Start Here","count":4},{"language":"default","tag":"Payouts","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"documentation/errors","slug":"/documentation/errors","pageMetadata":{"title":"Handling Errors","description":null,"href":"/documentation/errors"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Modem Pay returns errors in a consistent JSON format to make it easy to handle issues in your application. Each error includes a simple message explaining the issue, with HTTP status codes indicating the type of error.`}),`\n`,_jsx(Heading,{level:`4`,id:`error-format`,children:`Error Format`}),`\n`,_jsx(_components.p,{children:`All error responses follow this structure:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Description of the error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"statusCode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Error status code\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`common-status-codes`,children:`Common Status Codes`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`4xx Client Errors`}),`: These indicate issues in the request sent to the server.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`400 Bad Request`}),`: The request was invalid or missing required fields.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`401 Unauthorized`}),`: Missing or invalid API key.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`403 Forbidden`}),`: You don’t have permission to access this resource.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`404 Not Found`}),`: The requested resource doesn’t exist or was entered incorrectly.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`405 Method Not Allowed`}),`: The HTTP method used is not supported for this endpoint.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`422 Unprocessable Entity`}),`: The request was well-formed but contained semantic errors.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`427 Too Many Requests`}),`: You’ve exceeded the rate limit for API requests.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`5xx Server Errors`}),`: These signify an issue on Modem Pay’s end.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`500 Internal Server Error`}),`: General server error; retry the request or contact support if it persists.`]}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`handling-errors`,children:`Handling Errors`}),`\n`,_jsxs(_components.p,{children:[`Check the `,_jsx(_components.code,{children:`message`}),` field in the response to understand the cause of the error. If the status code is 400 or higher, review your request parameters and API key to ensure they meet Modem Pay’s requirements.`]}),`\n`,_jsx(Heading,{level:`2`,id:`error-retries`,children:`Error Retries`}),`\n`,_jsxs(_components.p,{children:[`Modem Pay offers automatic retry handling for certain types of errors. By default, Modem Pay retries up to three times if a request fails due to transient issues, such as network errors or temporary server overloads. This is configurable via the `,_jsx(_components.code,{children:`maxRetries`}),` option, which you can set during initialization:`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`javascript`,numberOfLines:`3`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` modempay`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` ModemPay`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`MODEM_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxRetries:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Sets the maximum number of retry attempts`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`python`,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`modem_pay `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModemPay(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_MODEM_PAY_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"maxRetries\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`3`,id:`when-retries-occur`,children:`When Retries Occur`}),`\n`,_jsxs(_components.p,{children:[`Retries are triggered for errors that are likely temporary, typically with `,_jsx(_components.strong,{children:`5xx server errors`}),`. Each retry is delayed slightly to give the server time to recover, helping ensure more reliable payment handling.`]}),`\n`,_jsx(Heading,{level:`3`,id:`adjusting-or-disabling-retries`,children:`Adjusting or Disabling Retries`}),`\n`,_jsxs(_components.p,{children:[`To reduce or increase the retry count, simply adjust the `,_jsx(_components.code,{children:`maxRetries`}),` value. Setting it to `,_jsx(_components.code,{children:`0`}),` disables retries entirely:`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`javascript`,numberOfLines:`3`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` modempay`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` ModemPay`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`MODEM_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxRetries:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Disables retries`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`python`,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`modem_pay `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModemPay(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_MODEM_PAY_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"maxRetries\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})]}),`\n`]})})})]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`To disable error retry logs, add `,_jsx(_components.code,{children:`RETRY_LOGGING=false`}),` to your `,_jsx(_components.code,{children:`.env`}),` file. This will suppress the retry attempt logs while still performing the retries.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`request-timeouts`,children:`Request Timeouts`}),`\n`,_jsx(_components.p,{children:`Modem Pay lets you configure request timeouts to prevent your application from waiting indefinitely for a response. By default, requests will time out after 60 seconds (1 minute).`}),`\n`,_jsx(_components.p,{children:`You can easily customize the timeout duration by specifying the timeout option (in seconds) when initializing the Modem Pay client:`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`javascript`,numberOfLines:`3`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` modempay`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` ModemPay`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`MODEM_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` timeout:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Timeout set to 20 seconds`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`python`,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`modem_pay `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModemPay(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_MODEM_PAY_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"timeout\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`rate-limiting`,children:`Rate Limiting`}),`\n`,_jsxs(_components.p,{children:[`To maintain the stability and security of our platform, `,_jsx(_components.strong,{children:`Modem Pay`}),` enforces rate limiting on all API requests.`]}),`\n`,_jsxs(_components.p,{children:[`Each API key is allowed up to `,_jsx(_components.strong,{children:`100 consecutive requests`}),` within a `,_jsx(_components.strong,{children:`15-minute rolling window`}),`. If this limit is exceeded, further requests will be temporarily blocked until the window resets.`]}),`\n`,_jsx(_components.p,{children:`We recommend implementing retries with exponential backoff and monitoring your request patterns to stay within the allowed limits.`}),`\n`,_jsxs(_components.p,{children:[`If your application requires a higher throughput, please contact us at `,_jsx(_components.strong,{children:_jsx(_components.a,{href:`mailto:info@modempay.com`,children:`info@modempay.com`})}),` to discuss increased rate limits based on your business needs.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Handling Errors","description":null,"href":"/documentation/errors"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Error Format","slug":"error-format","depth":4,"children":[]},{"title":"Common Status Codes","slug":"common-status-codes","depth":4,"children":[]},{"title":"Handling Errors","slug":"handling-errors","depth":4,"children":[]},{"title":"Error Retries","slug":"error-retries","depth":2,"children":[{"title":"When Retries Occur","slug":"when-retries-occur","depth":3,"children":[]},{"title":"Adjusting or Disabling Retries","slug":"adjusting-or-disabling-retries","depth":3,"children":[]}]},{"title":"Request Timeouts","slug":"request-timeouts","depth":2,"children":[]},{"title":"Rate Limiting","slug":"rate-limiting","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"modem","siteName":"Modem Pay Inc.","title":"Handling Errors - Modem Pay Inc.","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-14T18:38:16.810Z","originalFileLocation":"documentation/errors.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Modem Pay Inc.\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Handling Errors - Modem Pay Inc.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Modem Pay Inc.\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.modempay.com/documentation/errors\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://modem.mintlify.app/_mintlify/api/og/v2?division=Start+Here\u0026amp;title=Handling+Errors\u0026amp;theme=9d91f8d1b7877be469dfbcb5\u0026amp;signature=525bf7ac30ff9619421a08cd3f5ee1c9d6bebf2e47c5507c6345f54b2fba5909\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Handling Errors - Modem Pay Inc.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://modem.mintlify.app/_mintlify/api/og/v2?division=Start+Here\u0026amp;title=Handling+Errors\u0026amp;theme=9d91f8d1b7877be469dfbcb5\u0026amp;signature=525bf7ac30ff9619421a08cd3f5ee1c9d6bebf2e47c5507c6345f54b2fba5909\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/modem/9S6xKPPgd1tjvN3Y/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Modem Pay Inc.\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#08a591\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.modempay.com/documentation/errors\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/documentation/errors.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.modempay.com/#organization\",\"name\":\"Modem Pay Inc.\",\"url\":\"https://docs.modempay.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/modem/yM7VtPyYTpEqFm00/logo/logo.png?fit=max\u0026auto=format\u0026n=yM7VtPyYTpEqFm00\u0026q=85\u0026s=583edb50d45d5f0c7c7cfe8bed561521\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.modempay.com#website\",\"name\":\"Modem Pay Inc.\",\"url\":\"https://docs.modempay.com\",\"publisher\":{\"@id\":\"https://docs.modempay.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.modempay.com/documentation/errors#webpage\",\"url\":\"https://docs.modempay.com/documentation/errors\",\"name\":\"Handling Errors\",\"dateModified\":\"2026-10-14T18:38:16.810Z\",\"isPartOf\":{\"@id\":\"https://docs.modempay.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.modempay.com/documentation/errors#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.modempay.com/documentation/errors#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Start Here\",\"item\":\"https://docs.modempay.com/documentation/quickstart\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Handling Errors\",\"item\":\"https://docs.modempay.com/documentation/errors\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.modempay.com/documentation/errors#article\",\"headline\":\"Handling Errors\",\"name\":\"Handling Errors\",\"url\":\"https://docs.modempay.com/documentation/errors\",\"mainEntityOfPage\":{\"@id\":\"https://docs.modempay.com/documentation/errors#webpage\"},\"dateModified\":\"2026-10-14T18:38:16.810Z\",\"publisher\":{\"@id\":\"https://docs.modempay.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.modempay.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Modem Pay Inc.\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Modem Pay Inc.","nav":{"global":{"anchors":[]},"tabs":[{"tab":"Documentation","groups":[{"group":"Start Here","expanded":true,"pages":[{"title":"Quickstart Guide","href":"/documentation/quickstart"},{"title":"Installation","href":"/documentation/installation"},{"title":"Authentication","description":null,"href":"/documentation/authentication"},{"title":"Handling Errors","href":"/documentation/errors"}]},{"group":"Collections","expanded":false,"pages":[{"title":"Payment Intents","description":null,"href":"/documentation/payment-intents/overview"},{"title":"Create a Payment Intent","href":"/documentation/payment-intents/create"},{"title":"Direct Charge","href":"/documentation/payment-intents/direct-charge"},{"title":"Payment Intent Callbacks","href":"/documentation/payment-intents/callback_url"},{"title":"Refunds","href":"/documentation/payment-intents/refund"},{"title":"Manage Payment Intent","href":"/documentation/payment-intents/management"}]},{"group":"Split Payments","expanded":false,"pages":[{"title":"Overview","href":"/documentation/split-payments/overview"},{"title":"Sub-Accounts","href":"/documentation/split-payments/sub-accounts"},{"title":"Sub-Account Groups","href":"/documentation/split-payments/sub-account-groups"},{"title":"Initialize Split Payment","href":"/documentation/split-payments/initialize-payment"}]},{"group":"Payouts","expanded":false,"pages":[{"title":"Overview","href":"/documentation/payouts/overview"},{"title":"Mobile Money Payouts","href":"/documentation/payouts/mobile-money"},{"title":"Payout Fees","href":"/documentation/payouts/fees"},{"title":"Bulk Payouts","href":"/documentation/payouts/bulk-payout"}]},{"group":"Stablecoins","pages":[{"title":"Stablecoins overview","sidebarTitle":"Overview","href":"/documentation/stablecoins/overview"},{"title":"Accept stablecoin payments","sidebarTitle":"Accept payments","href":"/documentation/stablecoins/accept-payments"},{"title":"Convert stablecoins to dalasi","sidebarTitle":"Convert to dalasi","href":"/documentation/stablecoins/convert-to-dalasi"},{"title":"Price estimates","href":"/documentation/stablecoins/price-estimates"},{"title":"Resell conversions","sidebarTitle":"Resellers","href":"/documentation/stablecoins/resellers"}]},{"group":"Drop-ins","pages":[{"title":"Overview","href":"/documentation/payments/overview"},{"title":"Modem Pay Button","href":"/documentation/payments/drop-in"},{"title":"Modem Pay Checkout Modal","href":"/documentation/payments/modem-inline"},{"title":"HTML Checkout","href":"/documentation/payments/html-checkout"},{"title":"Modem Standard","href":"/documentation/payments/custom"}]},{"group":"Core API Resources","expanded":false,"pages":[{"title":"Balances","href":"/documentation/core/balances"},{"title":"Managing Customers","href":"/documentation/core/customers"},{"title":"Mandate","href":"/documentation/core/mandates"},{"title":"Payment Links","href":"/documentation/core/payment-links"},{"title":"Transactions","href":"/documentation/core/transactions"},{"title":"Webhooks","href":"/documentation/core/webhooks"},{"title":"Webhook Tester (CLI)","href":"/documentation/core/webhook-cli"},{"title":"Coupons","href":"/documentation/core/coupons"}]},{"group":"Terminals","expanded":false,"pages":[{"title":"Virtual Terminals","href":"/documentation/virtual-terminal"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/create-a-payment-intent"}]},{"tab":"Billing","pages":[{"title":"Billing","href":"/billing/invoices/introduction"}]},{"tab":"Laravel Integration","pages":[{"title":"Laravel Integration","href":"/laravel/quickstart"}]},{"tab":"Plugins","pages":[{"title":"Plugins","href":"/plugins/woocommerce"}]}]},"basePath":"","title":"Handling Errors - Modem Pay Inc.","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":[],"chunks":[]}