> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Make microdeposit

POST https://api-sandbox.payabli.com/api/MoneyIn/makecredit
Content-Type: application/json

Make a temporary microdeposit in a customer account to verify the customer's ownership and access to the target account. Reverse the microdeposit with `reverseCredit`. Payabli doesn't automatically make microdeposits when you add a bank account, you must manually make the requests.

This feature must be enabled by Payabli on a per-merchant basis. Contact support for help.

Reference: https://docs.payabli.com/developers/api-reference/moneyin/make-an-ach-credit-transaction

## Authentication

- `Authorization` header (bearer token, required)
- `requestToken` header (required) — Long-lived API token sent in the `requestToken` header. See [API token authentication](/developers/api-tokens).

## Servers

- `https://api-sandbox.payabli.com/api` (Sandbox, default)
- `https://api.payabli.com/api` (Production)

## Request

### Query parameters

- `forceCustomerCreation` (boolean, optional) — When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer. Defaults to `false`.

### Headers

- `idempotencyKey` (string, optional) — _Optional but recommended_ A unique ID that you can include to prevent duplicating objects or transactions in the case that a request is sent more than once. This key isn't generated in Payabli, you must generate it yourself. This key persists for 2 minutes. After 2 minutes, you can reuse the key if needed.

### Body (application/json)

- `customerData` (object, required) — Object describing the customer/payor.
  - `additionalData` (map from string to map from string to any, optional) — Custom dictionary of key:value pairs. You can use this field to store any data related to the object or for your system. If you are using [custom identifiers](/developers/developer-guides/entities-customers), pass those in this object. Max length for a value is 100 characters. Example usage: ```json { "additionalData": { "key1": "value1", "key2": "value2", "key3": "value3" } } ```
  - `billingAddress1` (string, optional) — Billing address.
  - `billingAddress2` (string, optional) — Additional line for the billing address.
  - `billingCity` (string, optional) — Billing city.
  - `billingCountry` (string, optional) — Billing address country.
  - `billingEmail` (string, optional) — Email address.
  - `billingPhone` (string, optional) — Phone number.
  - `billingState` (string, optional) — Billing state. Must be a 2-letter state code for addresses in the US.
  - `billingZip` (string, optional) — Customer's billing ZIP code. For Pay In functions, this field supports 5-digit and 9-digit ZIP codes and alphanumeric Canadian postal codes. For example: "37615-1234" or "37615".
  - `company` (string, optional) — Customer's company name.
  - `customerId` (long, optional) — The Payabli-generated unique ID for the customer.
  - `customerNumber` (string, optional) — User-provided unique identifier for the customer. This is typically the customer ID from your own system.
  - `firstName` (string, optional) — Customer/Payor first name.
  - `identifierFields` (list of string, optional) — List of fields acting as customer identifiers, to be used instead of CustomerNumber.
  - `lastName` (string, optional) — Customer/Payor last name.
  - `shippingAddress1` (string, optional) — The shipping address.
  - `shippingAddress2` (string, optional) — Additional line for shipping address.
  - `shippingCity` (string, optional) — Shipping city.
  - `shippingCountry` (string, optional) — Shipping address country.
  - `shippingState` (string, optional) — Shipping state or province.
  - `shippingZip` (string, optional) — Shipping ZIP code. For Pay In functions, this field supports 5-digit and 9-digit ZIP codes and alphanumeric Canadian postal codes. For example: `37615-1234` or `37615`.
- `paymentDetails` (object, required) — The PaymentDetail object for microdeposit (MakeCredit) transactions.
  - `totalAmount` (double, required) — Total amount to be charged. If a service fee is provided, then this amount should include the service fee.
  - `currency` (string, optional) — Currency code ISO-4217. If not code is provided the currency in the paypoint setting is taken. Default is **USD**
  - `serviceFee` (double, optional) — Service fee to be deducted from the total amount. This amount must be a number, percentages aren't accepted. If you are using a percentage-based fee schedule, you must calculate the value manually.
- `paymentMethod` (object, required) — Object describing the ACH payment method to use for transaction.
  - `method` ("ach", required) — Method to use for the transaction. Must be ACH.
  - `achAccount` (string, optional) — Bank account number.
  - `achAccountType` (enum, optional) — Bank account type: Checking or Savings.
    - Allowed values: `Checking`, `Savings`
  - `achCode` (string, optional) — Standard Entry Class (SEC) code is a three letter code that describes how an ACH payment was authorized. Supported values are: - **PPD** (Prearranged Payment and Deposit) — Used for credits or debits where an accountholder authorizes a company to initiate either a single or recurring transaction to their personal bank account. Common examples include direct deposit of payroll, mortgage payments, or utility bills. This is the default value for subscription payments. - **WEB** (Internet-Initiated/Mobile Entry) — Used for debit entries when authorization is obtained from an accountholder via the internet or a wireless network. Common examples are online bill payments, ecommerce purchases, and mobile app payments where the consumer enters their banking information online. - **TEL** (Telephone-Initiated Entry) — Used for one-time debit entries where authorization is obtained from a consumer via telephone. Common examples are phone-based purchases or bill payments where the consumer provides their banking information over the phone. - **CCD** (Corporate Credit or Debit) — Used for fund transfers between business accounts. This code is specifically for business-to-business transactions. Common examples include vendor payments and other business-to-business payments. - **BOC** (Back Office Conversion) — Used to convert paper checks received in-person at a point-of-sale or staffed payment location into electronic ACH debits. Required for Remote Deposit Capture (RDC) transactions. Only supports consumer checks; business, government, and mailed checks aren't eligible.
  - `achHolder` (string, optional) — Bank account holder.
  - `achRouting` (string, optional) — ABA/routing number of Bank account.
- `accountId` (string, optional) — Custom identifier for payment connector.
- `entrypoint` (string, optional) — The entrypoint identifier.
- `orderDescription` (string, optional) — Text description of the transaction.
- `orderId` (string, optional) — Custom identifier for the transaction.
- `source` (string, optional) — Custom identifier to indicate the transaction or request source.
- `subdomain` (string, optional) — Refers to the payment page identifier. If provided, then the transaction is linked to the payment page.

## Response

### 200

Success. The `referenceId` returned in a successful response is the `transId` value you need to reverse the microdeposit. A "Missing Gateway Data" message can indicate that the entrypoint targeted in the request isn't set up for ACH payments.

- `responseText` (string, required) — Response text for operation: 'Success' or 'Declined'.
- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `pageIdentifier` (string, optional) — Auxiliary validation used internally by payment pages and components.
- `responseData` (object, optional)
  - `AuthCode` (string, optional) — Authorization code for the transaction.
  - `avsResponseText` (string, optional) — Text code describing the result for address validation (applies only for card transactions).
  - `CustomerId` (long, optional) — Payabli-generated unique ID of customer owner of transaction. Returns `0` if the transaction wasn't assigned to an existing customer or no customer was created.
  - `cvvResponseText` (string, optional) — Text code describing the result for CVV validation (applies only for card transactions).
  - `methodReferenceId` (string, optional) — The stored method's identifier (sometimes referred to as 'token') in Payabli. When `null`, the method wasn't created, or doesn't exist, depending on the operation performed.
  - `ReferenceId` (string, optional) — The transaction identifier in Payabli.
  - `ResultCode` (integer, optional) — Result code for the operation. Value `1` indicates a successful operation, values `2` and `3` indicate errors. A value of `10` indicates that an operation has been initiated and is pending.
  - `ResultText` (string, optional) — Text describing the result. If `ResultCode` = 1, will return `Approved` or a general success message. If `ResultCode` = 2 or 3, will contain the cause of the error or decline.

## Examples

### MinimumFields

**Request**

```json
{
  "customerData": {
    "billingAddress1": "5127 Linkwood ave",
    "customerNumber": "C-90010"
  },
  "paymentDetails": {
    "totalAmount": 1,
    "serviceFee": 0
  },
  "paymentMethod": {
    "method": "ach",
    "achAccount": "88354454",
    "achAccountType": "Checking",
    "achHolder": "John Smith",
    "achRouting": "021000021"
  },
  "entrypoint": "8cfec329267"
}
```

**Response**

```json
{
  "responseText": "Success",
  "isSuccess": true,
  "pageIdentifier": "null",
  "responseData": {
    "AuthCode": "AuthCode",
    "CustomerId": 4440,
    "methodReferenceId": null,
    "ReferenceId": "129-219",
    "ResultCode": 1,
    "ResultText": "Approved"
  }
}
```

**SDK Code**

```typescript MinimumFields
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        clientId: "YOUR_CLIENT_ID",
        clientSecret: "YOUR_CLIENT_SECRET",
    });
    await client.moneyIn.credit({
        idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA",
        customerData: {
            billingAddress1: "5127 Linkwood ave",
            customerNumber: "C-90010",
        },
        entrypoint: "8cfec329267",
        paymentDetails: {
            serviceFee: 0,
            totalAmount: 1,
        },
        paymentMethod: {
            achAccount: "88354454",
            achAccountType: "Checking",
            achHolder: "John Smith",
            achRouting: "021000021",
            method: "ach",
        },
    });
}
main();

```

```python MinimumFields
from payabli import payabli, PayorDataRequest, PaymentDetailCredit, RequestCreditPaymentMethod

client = payabli(
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

client.money_in.credit(
    idempotency_key="6B29FC40-CA47-1067-B31D-00DD010662DA",
    customer_data=PayorDataRequest(
        billing_address_1="5127 Linkwood ave",
        customer_number="C-90010",
    ),
    entrypoint="8cfec329267",
    payment_details=PaymentDetailCredit(
        service_fee=0,
        total_amount=1,
    ),
    payment_method=RequestCreditPaymentMethod(
        ach_account="88354454",
        ach_account_type="Checking",
        ach_holder="John Smith",
        ach_routing="021000021",
        method="ach",
    ),
)

```

```java MinimumFields
package com.example.usage;

import io.github.payabli.api.PayabliApiClient;
import io.github.payabli.api.resources.moneyin.requests.RequestCredit;
import io.github.payabli.api.types.Achaccounttype;
import io.github.payabli.api.types.PaymentDetailCredit;
import io.github.payabli.api.types.PayorDataRequest;
import io.github.payabli.api.types.RequestCreditPaymentMethod;
import io.github.payabli.api.types.RequestCreditPaymentMethodMethod;

public class Example {
    public static void main(String[] args) {
        PayabliApiClient client = PayabliApiClient.withCredentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
            .build()
        ;

        client.moneyIn().credit(
            RequestCredit
                .builder()
                .customerData(
                    PayorDataRequest
                        .builder()
                        .billingAddress1("5127 Linkwood ave")
                        .customerNumber("C-90010")
                        .build()
                )
                .paymentDetails(
                    PaymentDetailCredit
                        .builder()
                        .totalAmount(1.0)
                        .serviceFee(0.0)
                        .build()
                )
                .paymentMethod(
                    RequestCreditPaymentMethod
                        .builder()
                        .method(RequestCreditPaymentMethodMethod.ACH)
                        .achAccount("88354454")
                        .achAccountType(Achaccounttype.CHECKING)
                        .achHolder("John Smith")
                        .achRouting("021000021")
                        .build()
                )
                .idempotencyKey("6B29FC40-CA47-1067-B31D-00DD010662DA")
                .entrypoint("8cfec329267")
                .build()
        );
    }
}
```

```ruby MinimumFields
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.money_in.credit(
  idempotency_key: "6B29FC40-CA47-1067-B31D-00DD010662DA",
  customer_data: {
    billing_address_1: "5127 Linkwood ave",
    customer_number: "C-90010"
  },
  entrypoint: "8cfec329267",
  payment_details: {
    total_amount: 1,
    service_fee: 0
  },
  payment_method: {
    method_: "ach",
    ach_account: "88354454",
    ach_account_type: "Checking",
    ach_holder: "John Smith",
    ach_routing: "021000021"
  }
)

```

```csharp MinimumFields
using PayabliApi;
using System.Threading.Tasks;

public partial class Examples
{
    public async Task Example() {
        var client = new PayabliApiClient(
            clientId: "YOUR_CLIENT_ID",
            clientSecret: "YOUR_CLIENT_SECRET"
        );

        await client.MoneyIn.CreditAsync(
            new RequestCredit {
                IdempotencyKey = "6B29FC40-CA47-1067-B31D-00DD010662DA",
                CustomerData = new PayorDataRequest {
                    BillingAddress1 = "5127 Linkwood ave",
                    CustomerNumber = "C-90010"
                },
                Entrypoint = "8cfec329267",
                PaymentDetails = new PaymentDetailCredit {
                    ServiceFee = 0,
                    TotalAmount = 1
                },
                PaymentMethod = new RequestCreditPaymentMethod {
                    AchAccount = "88354454",
                    AchAccountType = Achaccounttype.Checking,
                    AchHolder = "John Smith",
                    AchRouting = "021000021",
                    Method = RequestCreditPaymentMethodMethod.Ach
                }
            }
        );
    }

}

```

```go MinimumFields
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithClientCredentials(
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET",
        ),
    )
    request := &payabli.RequestCredit{
        IdempotencyKey: payabli.String(
            "6B29FC40-CA47-1067-B31D-00DD010662DA",
        ),
        CustomerData: &payabli.PayorDataRequest{
            BillingAddress1: payabli.String(
                "5127 Linkwood ave",
            ),
            CustomerNumber: payabli.String(
                "C-90010",
            ),
        },
        PaymentDetails: &payabli.PaymentDetailCredit{
            TotalAmount: 1,
            ServiceFee: payabli.Float64(
                0,
            ),
        },
        PaymentMethod: &payabli.RequestCreditPaymentMethod{
            Method: payabli.RequestCreditPaymentMethodMethodAch,
            AchAccount: payabli.String(
                "88354454",
            ),
            AchAccountType: payabli.AchaccounttypeChecking.Ptr(),
            AchHolder: payabli.String(
                "John Smith",
            ),
            AchRouting: payabli.String(
                "021000021",
            ),
        },
        Entrypoint: payabli.String(
            "8cfec329267",
        ),
    }
    client.MoneyIn.Credit(
        context.TODO(),
        request,
    )
}

```

```php MinimumFields
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\MoneyIn\Requests\RequestCredit;
use Payabli\Types\PayorDataRequest;
use Payabli\Types\PaymentDetailCredit;
use Payabli\Types\RequestCreditPaymentMethod;
use Payabli\Types\Achaccounttype;
use Payabli\Types\RequestCreditPaymentMethodMethod;

$client = new PayabliClient(
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
);
$client->moneyIn->credit(
    new RequestCredit([
        'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA',
        'customerData' => new PayorDataRequest([
            'billingAddress1' => '5127 Linkwood ave',
            'customerNumber' => 'C-90010',
        ]),
        'entrypoint' => '8cfec329267',
        'paymentDetails' => new PaymentDetailCredit([
            'serviceFee' => 0,
            'totalAmount' => 1,
        ]),
        'paymentMethod' => new RequestCreditPaymentMethod([
            'achAccount' => '88354454',
            'achAccountType' => Achaccounttype::Checking->value,
            'achHolder' => 'John Smith',
            'achRouting' => '021000021',
            'method' => RequestCreditPaymentMethodMethod::Ach->value,
        ]),
    ]),
);

```

```swift MinimumFields
import Foundation

let headers = [
  "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "customerData": [
    "billingAddress1": "5127 Linkwood ave",
    "customerNumber": "C-90010"
  ],
  "paymentDetails": [
    "totalAmount": 1,
    "serviceFee": 0
  ],
  "paymentMethod": [
    "method": "ach",
    "achAccount": "88354454",
    "achAccountType": "Checking",
    "achHolder": "John Smith",
    "achRouting": "021000021"
  ],
  "entrypoint": "8cfec329267"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/makecredit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### ComplexFields

**Request**

```json
{
  "customerData": {
    "billingAddress1": "125 Main Street",
    "billingCity": "Kingsport",
    "billingEmail": "johnnyp@email.com",
    "company": "Acme, Inc",
    "customerNumber": "C-90010",
    "firstName": "Johnny",
    "lastName": "Poulsbo"
  },
  "paymentDetails": {
    "totalAmount": 1,
    "serviceFee": 0
  },
  "paymentMethod": {
    "method": "ach",
    "achAccount": "88354554",
    "achAccountType": "Checking",
    "achHolder": "John Poulsbo",
    "achRouting": "029000021"
  },
  "entrypoint": "8cfec329267"
}
```

**Response**

```json
{
  "responseText": "Success",
  "isSuccess": true,
  "pageIdentifier": "null",
  "responseData": {
    "AuthCode": "AuthCode",
    "CustomerId": 4440,
    "methodReferenceId": null,
    "ReferenceId": "129-219",
    "ResultCode": 1,
    "ResultText": "Approved"
  }
}
```

**SDK Code**

```typescript ComplexFields
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        clientId: "YOUR_CLIENT_ID",
        clientSecret: "YOUR_CLIENT_SECRET",
    });
    await client.moneyIn.credit({
        idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA",
        customerData: {
            billingAddress1: "125 Main Street",
            billingCity: "Kingsport",
            billingEmail: "johnnyp@email.com",
            company: "Acme, Inc",
            customerNumber: "C-90010",
            firstName: "Johnny",
            lastName: "Poulsbo",
        },
        entrypoint: "8cfec329267",
        paymentDetails: {
            serviceFee: 0,
            totalAmount: 1,
        },
        paymentMethod: {
            achAccount: "88354554",
            achAccountType: "Checking",
            achHolder: "John Poulsbo",
            achRouting: "029000021",
            method: "ach",
        },
    });
}
main();

```

```python ComplexFields
from payabli import payabli, PayorDataRequest, PaymentDetailCredit, RequestCreditPaymentMethod

client = payabli(
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

client.money_in.credit(
    idempotency_key="6B29FC40-CA47-1067-B31D-00DD010662DA",
    customer_data=PayorDataRequest(
        billing_address_1="125 Main Street",
        billing_city="Kingsport",
        billing_email="johnnyp@email.com",
        company="Acme, Inc",
        customer_number="C-90010",
        first_name="Johnny",
        last_name="Poulsbo",
    ),
    entrypoint="8cfec329267",
    payment_details=PaymentDetailCredit(
        service_fee=0,
        total_amount=1,
    ),
    payment_method=RequestCreditPaymentMethod(
        ach_account="88354554",
        ach_account_type="Checking",
        ach_holder="John Poulsbo",
        ach_routing="029000021",
        method="ach",
    ),
)

```

```java ComplexFields
package com.example.usage;

import io.github.payabli.api.PayabliApiClient;
import io.github.payabli.api.resources.moneyin.requests.RequestCredit;
import io.github.payabli.api.types.Achaccounttype;
import io.github.payabli.api.types.PaymentDetailCredit;
import io.github.payabli.api.types.PayorDataRequest;
import io.github.payabli.api.types.RequestCreditPaymentMethod;
import io.github.payabli.api.types.RequestCreditPaymentMethodMethod;

public class Example {
    public static void main(String[] args) {
        PayabliApiClient client = PayabliApiClient.withCredentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
            .build()
        ;

        client.moneyIn().credit(
            RequestCredit
                .builder()
                .customerData(
                    PayorDataRequest
                        .builder()
                        .billingAddress1("125 Main Street")
                        .billingCity("Kingsport")
                        .billingEmail("johnnyp@email.com")
                        .company("Acme, Inc")
                        .customerNumber("C-90010")
                        .firstName("Johnny")
                        .lastName("Poulsbo")
                        .build()
                )
                .paymentDetails(
                    PaymentDetailCredit
                        .builder()
                        .totalAmount(1.0)
                        .serviceFee(0.0)
                        .build()
                )
                .paymentMethod(
                    RequestCreditPaymentMethod
                        .builder()
                        .method(RequestCreditPaymentMethodMethod.ACH)
                        .achAccount("88354554")
                        .achAccountType(Achaccounttype.CHECKING)
                        .achHolder("John Poulsbo")
                        .achRouting("029000021")
                        .build()
                )
                .idempotencyKey("6B29FC40-CA47-1067-B31D-00DD010662DA")
                .entrypoint("8cfec329267")
                .build()
        );
    }
}
```

```ruby ComplexFields
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.money_in.credit(
  idempotency_key: "6B29FC40-CA47-1067-B31D-00DD010662DA",
  customer_data: {
    billing_address_1: "125 Main Street",
    billing_city: "Kingsport",
    billing_email: "johnnyp@email.com",
    company: "Acme, Inc",
    customer_number: "C-90010",
    first_name: "Johnny",
    last_name: "Poulsbo"
  },
  entrypoint: "8cfec329267",
  payment_details: {
    total_amount: 1,
    service_fee: 0
  },
  payment_method: {
    method_: "ach",
    ach_account: "88354554",
    ach_account_type: "Checking",
    ach_holder: "John Poulsbo",
    ach_routing: "029000021"
  }
)

```

```csharp ComplexFields
using PayabliApi;
using System.Threading.Tasks;

public partial class Examples
{
    public async Task Example() {
        var client = new PayabliApiClient(
            clientId: "YOUR_CLIENT_ID",
            clientSecret: "YOUR_CLIENT_SECRET"
        );

        await client.MoneyIn.CreditAsync(
            new RequestCredit {
                IdempotencyKey = "6B29FC40-CA47-1067-B31D-00DD010662DA",
                CustomerData = new PayorDataRequest {
                    BillingAddress1 = "125 Main Street",
                    BillingCity = "Kingsport",
                    BillingEmail = "johnnyp@email.com",
                    Company = "Acme, Inc",
                    CustomerNumber = "C-90010",
                    FirstName = "Johnny",
                    LastName = "Poulsbo"
                },
                Entrypoint = "8cfec329267",
                PaymentDetails = new PaymentDetailCredit {
                    ServiceFee = 0,
                    TotalAmount = 1
                },
                PaymentMethod = new RequestCreditPaymentMethod {
                    AchAccount = "88354554",
                    AchAccountType = Achaccounttype.Checking,
                    AchHolder = "John Poulsbo",
                    AchRouting = "029000021",
                    Method = RequestCreditPaymentMethodMethod.Ach
                }
            }
        );
    }

}

```

```go ComplexFields
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithClientCredentials(
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET",
        ),
    )
    request := &payabli.RequestCredit{
        IdempotencyKey: payabli.String(
            "6B29FC40-CA47-1067-B31D-00DD010662DA",
        ),
        CustomerData: &payabli.PayorDataRequest{
            BillingAddress1: payabli.String(
                "125 Main Street",
            ),
            BillingCity: payabli.String(
                "Kingsport",
            ),
            BillingEmail: payabli.String(
                "johnnyp@email.com",
            ),
            Company: payabli.String(
                "Acme, Inc",
            ),
            CustomerNumber: payabli.String(
                "C-90010",
            ),
            FirstName: payabli.String(
                "Johnny",
            ),
            LastName: payabli.String(
                "Poulsbo",
            ),
        },
        PaymentDetails: &payabli.PaymentDetailCredit{
            TotalAmount: 1,
            ServiceFee: payabli.Float64(
                0,
            ),
        },
        PaymentMethod: &payabli.RequestCreditPaymentMethod{
            Method: payabli.RequestCreditPaymentMethodMethodAch,
            AchAccount: payabli.String(
                "88354554",
            ),
            AchAccountType: payabli.AchaccounttypeChecking.Ptr(),
            AchHolder: payabli.String(
                "John Poulsbo",
            ),
            AchRouting: payabli.String(
                "029000021",
            ),
        },
        Entrypoint: payabli.String(
            "8cfec329267",
        ),
    }
    client.MoneyIn.Credit(
        context.TODO(),
        request,
    )
}

```

```php ComplexFields
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\MoneyIn\Requests\RequestCredit;
use Payabli\Types\PayorDataRequest;
use Payabli\Types\PaymentDetailCredit;
use Payabli\Types\RequestCreditPaymentMethod;
use Payabli\Types\Achaccounttype;
use Payabli\Types\RequestCreditPaymentMethodMethod;

$client = new PayabliClient(
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
);
$client->moneyIn->credit(
    new RequestCredit([
        'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA',
        'customerData' => new PayorDataRequest([
            'billingAddress1' => '125 Main Street',
            'billingCity' => 'Kingsport',
            'billingEmail' => 'johnnyp@email.com',
            'company' => 'Acme, Inc',
            'customerNumber' => 'C-90010',
            'firstName' => 'Johnny',
            'lastName' => 'Poulsbo',
        ]),
        'entrypoint' => '8cfec329267',
        'paymentDetails' => new PaymentDetailCredit([
            'serviceFee' => 0,
            'totalAmount' => 1,
        ]),
        'paymentMethod' => new RequestCreditPaymentMethod([
            'achAccount' => '88354554',
            'achAccountType' => Achaccounttype::Checking->value,
            'achHolder' => 'John Poulsbo',
            'achRouting' => '029000021',
            'method' => RequestCreditPaymentMethodMethod::Ach->value,
        ]),
    ]),
);

```

```swift ComplexFields
import Foundation

let headers = [
  "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "customerData": [
    "billingAddress1": "125 Main Street",
    "billingCity": "Kingsport",
    "billingEmail": "johnnyp@email.com",
    "company": "Acme, Inc",
    "customerNumber": "C-90010",
    "firstName": "Johnny",
    "lastName": "Poulsbo"
  ],
  "paymentDetails": [
    "totalAmount": 1,
    "serviceFee": 0
  ],
  "paymentMethod": [
    "method": "ach",
    "achAccount": "88354554",
    "achAccountType": "Checking",
    "achHolder": "John Poulsbo",
    "achRouting": "029000021"
  ],
  "entrypoint": "8cfec329267"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/makecredit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```