> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# क्रेडिट टॉप अप API

> Didit बैलेंस में टॉप-अप जोड़ने के लिए Stripe चेकआउट बनाएँ: $50 से $20,000 तक, अंकित मूल्य पर, Free, Growth और Scale प्लान पर। टॉप-अप 12 महीने चलते हैं।



क्रेडिट टॉप अप करने का प्रॉम्प्ट
        प्रॉम्प्ट को क्लिपबोर्ड पर कॉपी करें



      
      

\<pre>

\``Goal: Start a manual credit top-up by creating a hosted Stripe Checkout session. Once Stripe processes the payment, Didit's invoice.paid webhook handler credits the organization's balance.

Endpoint: POST https://verification.didit.me/v3/billing/top-up/
Auth header: x-api-key: <DIDIT_API_KEY>
Content-Type: application/json

Request body:
\- amount_in_dollars (number, REQUIRED) — USD amount to charge, from $50 MINIMUM to $20,000 MAXIMUM. The balance receives the same amount: no discount or bonus. Tax is added automatically at checkout based on billing address.
\- success_url (URI, optional) — Stripe redirects here after successful payment. Currently defaults to `https://console.didit.me`. Pass a working URL explicitly; the default host is unavailable. Append literal placeholder {CHECKOUT_SESSION_ID} if you want Stripe to substitute the session id.
\- cancel_url (URI, optional) — Stripe redirects here when the customer aborts. Currently defaults to `https://console.didit.me`. Pass a working URL explicitly; the default host is unavailable.

curl:
curl -X POST 'https://verification.didit.me/v3/billing/top-up/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"amount_in_dollars": 500,
"success_url": "https://yourapp.com/billing/success",
"cancel_url": "https://yourapp.com/billing/cancel"
}'

Response 200:
\{
"checkout_session_id": "cs_test_a1B2c3D4e5F6g7H8i9J0",
"checkout_session_url": "https://checkout.stripe.com/c/pay/cs_test_..."
}
Redirect the customer's browser to checkout_session_url (or hand it off to your billing admin out-of-band) to complete payment.

Full flow:
1\. POST /v3/billing/top-up/ with amount_in_dollars and explicit success_url and cancel_url values.
2\. Redirect to checkout_session_url.
3\. Customer pays on Stripe-hosted page.
4\. Stripe redirects to success_url (or cancel_url on abort).
5\. Didit receives invoice.paid webhook, increases organization balance.
6\. Poll GET /v3/billing/balance/ to confirm balance reflects the top-up.

Failure modes:
\- 400 — the body is a JSON array with one message:
\["amount_in_dollars is required."]
\["amount_in_dollars must be a number."]
\["Amount must be at least $50."]
\["Amount must be at most $20,000."]
\["You have an annual plan. Contact your account manager to top up."]  // Enterprise annual-contract orgs cannot top up: usage beyond the contract credit is invoiced as overage.
\- 401 — missing/malformed x-api-key.
\- 403 — key valid but cannot create top-up sessions for this organization.
\- 429 — rate-limited.

Notes:
\- Top-ups are available on the Free, Growth and Scale plans, from $50 to $20,000 each. They are added at face value (pay $20,000, receive $20,000; no discount or bonus), pay for every product, and last 12 months. Each check uses the month's plan credit first, then the oldest top-up.
\- Auto top-up amounts, set in Console → Billing, follow the same $50 to $20,000 range.
\- The Stripe Checkout session is single-use, but calling this endpoint repeatedly creates NEW sessions — track completion on your side via success_url/cancel_url to avoid duplicate charges.
\- When the cardholder pays with card / SEPA / US ACH, Stripe attaches the payment method with setup_future_usage=off_session so Didit can later auto-charge it for auto-refill.
\- The organization must already have a Stripe customer set up (created automatically the first time the org configures billing).

For end-to-end Didit integration, paste in the full prompt at /integration/integration-prompt.``

\</pre>



      
      

यहाँ पेस्ट करें



## OpenAPI

````yaml hi/openapi-25.json POST /v3/billing/top-up/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: पहचान सत्यापन API। x-api-key हेडर के साथ प्रमाणीकृत करें।
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/billing/top-up/:
    post:
      tags:
        - Billing
      summary: क्रेडिट टॉप अप करें
      description: >-
        होस्ट किए गए Stripe Checkout सत्र के माध्यम से क्रेडिट जोड़ें (प्रति
        टॉप-अप **\$50 से \$20,000**)। टॉप-अप Free, Growth और Scale प्लान पर
        उपलब्ध हैं, बिना किसी छूट या बोनस के अंकित मूल्य पर जोड़े जाते हैं, और
        12 महीने तक चलते हैं; Enterprise वार्षिक अनुबंध टॉप अप नहीं कर सकते।
        ग्राहक को लौटाए गए `checkout_session_url` पर रीडायरेक्ट करें।
      operationId: billing_top_up
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amount_in_dollars
              properties:
                amount_in_dollars:
                  type: number
                  minimum: 50
                  maximum: 20000
                  description: >-
                    चार्ज की जाने वाली राशि, USD में। **50 से 20,000 के बीच होनी
                    चाहिए।** बैलेंस को बिना किसी छूट या बोनस के समान राशि
                    प्राप्त होती है। ग्राहक के बिलिंग पते के आधार पर चेकआउट पर
                    कर स्वचालित रूप से जोड़ा जाता है।
                success_url:
                  type: string
                  format: uri
                  description: >-
                    सफल भुगतान के बाद होस्टेड चेकआउट ग्राहक को जिस URL पर
                    रीडायरेक्ट करता है। वर्तमान में यह डिफ़ॉल्ट रूप से
                    `https://console.didit.me` होता है। एक कार्यशील URL स्पष्ट
                    रूप से पास करें; डिफ़ॉल्ट होस्ट अनुपलब्ध है। यदि आप चाहते
                    हैं कि होस्टेड चेकआउट सत्र ID को प्रतिस्थापित करे, तो
                    शाब्दिक प्लेसहोल्डर `{CHECKOUT_SESSION_ID}` जोड़ें।
                cancel_url:
                  type: string
                  format: uri
                  description: >-
                    चेकआउट विंडो को रद्द या बंद करने पर होस्टेड चेकआउट ग्राहक को
                    जिस URL पर रीडायरेक्ट करता है। वर्तमान में यह डिफ़ॉल्ट रूप
                    से `https://console.didit.me` होता है। एक कार्यशील URL
                    स्पष्ट रूप से पास करें; डिफ़ॉल्ट होस्ट अनुपलब्ध है।
            examples:
              Minimum top-up:
                value:
                  amount_in_dollars: 50
              Custom amount with redirects:
                value:
                  amount_in_dollars: 500
                  success_url: https://yourapp.com/billing/top-up/success
                  cancel_url: https://yourapp.com/billing/top-up/cancel
      responses:
        '200':
          description: >-
            होस्टेड चेकआउट सत्र बनाया गया। भुगतान पूरा करने के लिए उपयोगकर्ता को
            `checkout_session_url` पर रीडायरेक्ट करें।
          content:
            application/json:
              schema:
                type: object
                required:
                  - checkout_session_id
                  - checkout_session_url
                properties:
                  checkout_session_id:
                    type: string
                    description: >-
                      होस्टेड चेकआउट सत्र पहचानकर्ता (उदा. `cs_test_a1B2c3...`)।
                      सर्वर-साइड मिलान के लिए उपयोगी।
                  checkout_session_url:
                    type: string
                    format: uri
                    description: >-
                      एकल-उपयोग होस्टेड भुगतान पेज URL। भुगतान पूरा करने के लिए
                      ग्राहक को यहाँ रीडायरेक्ट करें।
              examples:
                Created:
                  value:
                    checkout_session_id: cs_test_a1B2c3D4e5F6g7H8i9J0
                    checkout_session_url: >-
                      https://checkout.example.com/c/pay/cs_test_a1B2c3D4e5F6g7H8i9J0
        '400':
          description: >-
            अमान्य payload: राशि गायब है, संख्या नहीं है, \$50 के न्यूनतम से कम
            या \$20,000 के अधिकतम से अधिक है, या संगठन Enterprise वार्षिक अनुबंध
            पर है। त्रुटि body एक JSON ऐरे है।
          content:
            application/json:
              examples:
                Missing amount:
                  value:
                    - amount_in_dollars is required.
                Not a number:
                  value:
                    - amount_in_dollars must be a number.
                Below minimum:
                  value:
                    - Amount must be at least $50.
                Above maximum:
                  value:
                    - Amount must be at most $20,000.
                Annual plan:
                  value:
                    - >-
                      You have an annual plan. Contact your account manager to
                      top up.
        '403':
          description: >-
            अनुपलब्ध, अमान्य, या निरस्त API कुंजी, या कुंजी इस संगठन के लिए
            टॉप-अप सत्र नहीं बना सकती। अनुपलब्ध कुंजी `403` लौटाती है; गलत,
            निरस्त या समय-सीमा समाप्त कुंजी `401` लौटाती है।
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    detail: You do not have permission to perform this action.
        '429':
          description: >-
            रेट लिमिट पार हो गई; थोड़ा रुकें और `Retry-After` में बताए गए अंतराल
            के बाद पुनः प्रयास करें।
          content:
            application/json:
              examples:
                Throttled:
                  value:
                    detail: Request was throttled. Expected available in 30 seconds.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl -X POST 'https://verification.didit.me/v3/billing/top-up/' \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{
                "amount_in_dollars": 500,
                "success_url": "https://yourapp.com/billing/success",
                "cancel_url": "https://yourapp.com/billing/cancel"
              }'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.billing.top_up(
                amount_in_dollars=50.0,
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // Reads DIDIT_API_KEY.
            const didit = new Didit();

            const result = await didit.billing.topUp({
              amount_in_dollars: 50.0,
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Billing.TopUp(ctx, didit.BillingTopUpParams{\n\tAmountInDollars: 50.0,\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: |-
            import me.didit.Didit;
            import me.didit.types.BillingTopUpParams;

            // Reads DIDIT_API_KEY.
            Didit client = new Didit();

            var result = client.billing().topUp(BillingTopUpParams.builder()
                    .amountInDollars(50.0)
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // Reads DIDIT_API_KEY.
            $didit = new DiditClient();

            $result = $didit->billing->topUp([
                'amount_in_dollars' => 50.0,
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # Reads DIDIT_API_KEY.
            didit = Didit::Client.new

            result = didit.billing.top_up(amount_in_dollars: 50.0)
            puts result.to_h
        - lang: csharp
          label: .NET
          source: |-
            using System;
            using System.Text.Json;
            using Didit;

            // Reads DIDIT_API_KEY.
            using var client = new DiditClient();

            var result = await client.Billing.TopUpAsync(new BillingTopUpParams
            {
                AmountInDollars = 50.0,
            });
            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        आपकी एप्लिकेशन की API कुंजी, Business Console में Developers -> API keys
        से। प्राथमिक कुंजी के पास पूर्ण एक्सेस होता है। एक नामित कुंजी को स्कोप
        किया जा सकता है: प्रति संसाधन none, read या write, कुछ वर्कफ़्लो या
        स्वीकृत सत्रों तक सीमित, IP पतों की सूची तक सीमित, और समाप्ति तिथि तक
        सीमित। 401 का अर्थ है कि कुंजी गलत है, निरस्त कर दी गई है या उसकी
        समय-सीमा समाप्त हो गई है; 403 का अर्थ है कि कोई कुंजी नहीं भेजी गई थी,
        कुंजी के पास इस संसाधन या कार्रवाई का एक्सेस नहीं है, या अनुरोध उसकी IP
        सूची से बाहर के पते से आया था; सत्र रूट पर 404 का अर्थ है कि सत्र कुंजी
        के वर्कफ़्लो या स्थितियों से बाहर है। मीडिया एक्सेस के बिना एक कुंजी को
        छवि, वीडियो और PDF URL null के रूप में प्राप्त होते हैं, और सत्र write
        के बिना एक कुंजी को सत्र लिंक और token null के रूप में प्राप्त होते हैं।
        देखें https://docs.didit.me/console/api-keys।

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.