> ## Documentation Index
> Fetch the complete documentation index at: https://dodopayments-mintlify-external-integration-datafast-autosen.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Customer Wallet Ledger Entry

> Create a credit or debit ledger entry in a customer's wallet.



## OpenAPI

````yaml post /customers/{customer_id}/wallets/ledger-entries
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.61.5
servers:
  - url: https://test.dodopayments.com/
    description: Test Mode Server Host
  - url: https://live.dodopayments.com/
    description: Live Mode Server Host
security: []
tags:
  - name: Products
  - name: Payments
  - name: Subscriptions
  - name: Addons
  - name: Customers
  - name: Refunds
  - name: Disputes
  - name: Events
  - name: License Keys
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
paths:
  /customers/{customer_id}/wallets/ledger-entries:
    post:
      tags:
        - Customers
      operationId: create_customer_ledger_entry
      parameters:
        - name: customer_id
          in: path
          description: Customer ID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerLedgerEntryRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerWalletResponse'
        '400':
          description: Insufficient balance for debit
        '422':
          description: Invalid Request Object or Parameters
        '500':
          description: Something went wrong :(
      security:
        - API_KEY: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import DodoPayments from 'dodopayments';


            const client = new DodoPayments({
              bearerToken: 'My Bearer Token',
            });


            const customerWallet = await
            client.customers.wallets.ledgerEntries.create('customer_id', {
              amount: 0,
              currency: 'AED',
              entry_type: 'credit',
            });


            console.log(customerWallet.customer_id);
        - lang: Python
          source: |-
            from dodopayments import DodoPayments

            client = DodoPayments(
                bearer_token="My Bearer Token",
            )
            customer_wallet = client.customers.wallets.ledger_entries.create(
                customer_id="customer_id",
                amount=0,
                currency="AED",
                entry_type="credit",
            )
            print(customer_wallet.customer_id)
        - lang: Go
          source: |
            package main

            import (
              "context"
              "fmt"

              "github.com/dodopayments/dodopayments-go"
              "github.com/dodopayments/dodopayments-go/option"
            )

            func main() {
              client := dodopayments.NewClient(
                option.WithBearerToken("My Bearer Token"),
              )
              customerWallet, err := client.Customers.Wallets.LedgerEntries.New(
                context.TODO(),
                "customer_id",
                dodopayments.CustomerWalletLedgerEntryNewParams{
                  Amount: dodopayments.F(int64(0)),
                  Currency: dodopayments.F(dodopayments.CurrencyAed),
                  EntryType: dodopayments.F(dodopayments.CustomerWalletLedgerEntryNewParamsEntryTypeCredit),
                },
              )
              if err != nil {
                panic(err.Error())
              }
              fmt.Printf("%+v\n", customerWallet.CustomerID)
            }
        - lang: Java
          source: >-
            package com.dodopayments.api.example;


            import com.dodopayments.api.client.DodoPaymentsClient;

            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;

            import com.dodopayments.api.models.customers.wallets.CustomerWallet;

            import
            com.dodopayments.api.models.customers.wallets.ledgerentries.LedgerEntryCreateParams;

            import com.dodopayments.api.models.misc.Currency;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

                    LedgerEntryCreateParams params = LedgerEntryCreateParams.builder()
                        .customerId("customer_id")
                        .amount(0L)
                        .currency(Currency.AED)
                        .entryType(LedgerEntryCreateParams.EntryType.CREDIT)
                        .build();
                    CustomerWallet customerWallet = client.customers().wallets().ledgerEntries().create(params);
                }
            }
        - lang: Kotlin
          source: >-
            package com.dodopayments.api.example


            import com.dodopayments.api.client.DodoPaymentsClient

            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient

            import com.dodopayments.api.models.customers.wallets.CustomerWallet

            import
            com.dodopayments.api.models.customers.wallets.ledgerentries.LedgerEntryCreateParams

            import com.dodopayments.api.models.misc.Currency


            fun main() {
                val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

                val params: LedgerEntryCreateParams = LedgerEntryCreateParams.builder()
                    .customerId("customer_id")
                    .amount(0L)
                    .currency(Currency.AED)
                    .entryType(LedgerEntryCreateParams.EntryType.CREDIT)
                    .build()
                val customerWallet: CustomerWallet = client.customers().wallets().ledgerEntries().create(params)
            }
        - lang: Ruby
          source: >-
            require "dodopayments"


            dodo_payments = Dodopayments::Client.new(
              bearer_token: "My Bearer Token",
              environment: "test_mode" # defaults to "live_mode"
            )


            customer_wallet =
            dodo_payments.customers.wallets.ledger_entries.create(
              "customer_id",
              amount: 0,
              currency: :AED,
              entry_type: :credit
            )


            puts(customer_wallet)
components:
  schemas:
    CustomerLedgerEntryRequest:
      type: object
      required:
        - entry_type
        - currency
        - amount
      properties:
        amount:
          type: integer
          format: int64
        currency:
          $ref: '#/components/schemas/Currency'
          description: Currency of the wallet to adjust
        entry_type:
          $ref: '#/components/schemas/CustomerLedgerEntryType'
          description: Type of ledger entry - credit or debit
        idempotency_key:
          type:
            - string
            - 'null'
          description: Optional idempotency key to prevent duplicate entries
        reason:
          type:
            - string
            - 'null'
    CustomerWalletResponse:
      type: object
      required:
        - customer_id
        - currency
        - balance
        - created_at
        - updated_at
      properties:
        balance:
          type: integer
          format: int64
        created_at:
          type: string
          format: date-time
        currency:
          $ref: '#/components/schemas/Currency'
        customer_id:
          type: string
        updated_at:
          type: string
          format: date-time
    Currency:
      type: string
      enum:
        - AED
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BWP
        - BYN
        - BZD
        - CAD
        - CHF
        - CLP
        - CNY
        - COP
        - CRC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SEK
        - SGD
        - SHP
        - SLE
        - SLL
        - SOS
        - SRD
        - SSP
        - STN
        - SVC
        - SZL
        - THB
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
    CustomerLedgerEntryType:
      type: string
      enum:
        - credit
        - debit
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````