> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://beta-docs.payabli.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://beta-docs.payabli.com/_mcp/server.

# Validate card

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

Validates a card number without running a transaction or authorizing a charge.

Reference: https://beta-docs.payabli.com/api-reference/moneyin/validate-card

## Authentication

- `requestToken` header (required) — API Key authentication via header

## Servers

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

## Request

### 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 is not generated in Payabli, you must generate it yourself.

### Body (application/json)

This endpoint expects an object.

- `paymentMethod` (RequestPaymentValidatePaymentMethod, required) — Object describing payment method to use for transaction.
- `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.

## Response

### 200

Ok

- `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` (PayabliApiResponse0ResponseData, optional)
- `responseText` (string, optional) — Response text for operation: 'Success' or 'Declined'.

## Errors

### 400 Bad Request Error

Bad request/ invalid data

- `any`

### 401 Unauthorized Error

Unauthorized request.

- `any`

### 500 Internal Server Error

Internal API Error

- `any`

### 503 Service Unavailable Error

Database connection error

- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `responseData` (map from string to any, optional) — The object containing the response data.
- `responseText` (string, optional) — Response text for operation: 'Success' or 'Declined'.

## Types

### RequestPaymentValidatePaymentMethod

Object describing payment method to use for transaction.

- `cardnumber` (string, required) — The card number. Required when method is `card` and a `storedMethodId` isn't included.
- `method` (enum, required) — The card to validate.
  - Allowed values: `card`, `cloud`
- `cardcvv` (string, optional) — Card Verification Value (CVV) associated with the card number. We **strongly recommend** that you include this field when using `card` as a method.
- `cardexp` (string, optional) — Card expiration date in format MMYY or MM/YY. Required for card transactions.
- `cardHolder` (string, optional) — Cardholder name.
- `cardzip` (string, optional) — ZIP code for the billing address of cardholder. We **strongly recommend** that you include this field when using `card` as a method.

### PayabliApiResponse0ResponseData

- `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 was not 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

**Request**

```json
{
  "paymentMethod": {
    "cardnumber": "4111111111111111",
    "method": "card"
  }
}
```

**Response**

```json
{
  "isSuccess": true,
  "pageIdentifier": "null",
  "responseData": {
    "AuthCode": "A0000",
    "avsResponseText": "null,",
    "CustomerId": 4440,
    "cvvResponseText": "null,",
    "ReferenceId": " ",
    "ResultCode": 1,
    "ResultText": "Validated"
  },
  "responseText": "Success"
}
```

**SDK Code**

```python Success
import requests

url = "https://api-sandbox.payabli.com/api/MoneyIn/validate"

payload = { "paymentMethod": {
        "cardnumber": "4111111111111111",
        "method": "card"
    } }
headers = {
    "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA",
    "requestToken": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Success
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/validate';
const options = {
  method: 'POST',
  headers: {
    idempotencyKey: '6B29FC40-CA47-1067-B31D-00DD010662DA',
    requestToken: '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"paymentMethod":{"cardnumber":"4111111111111111","method":"card"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Success
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/MoneyIn/validate"

	payload := strings.NewReader("{\n  \"paymentMethod\": {\n    \"cardnumber\": \"4111111111111111\",\n    \"method\": \"card\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("idempotencyKey", "6B29FC40-CA47-1067-B31D-00DD010662DA")
	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Success
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/MoneyIn/validate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["idempotencyKey"] = '6B29FC40-CA47-1067-B31D-00DD010662DA'
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentMethod\": {\n    \"cardnumber\": \"4111111111111111\",\n    \"method\": \"card\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Success
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyIn/validate")
  .header("idempotencyKey", "6B29FC40-CA47-1067-B31D-00DD010662DA")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentMethod\": {\n    \"cardnumber\": \"4111111111111111\",\n    \"method\": \"card\"\n  }\n}")
  .asString();
```

```php Success
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/MoneyIn/validate', [
  'body' => '{
  "paymentMethod": {
    "cardnumber": "4111111111111111",
    "method": "card"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Success
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/MoneyIn/validate");
var request = new RestRequest(Method.POST);
request.AddHeader("idempotencyKey", "6B29FC40-CA47-1067-B31D-00DD010662DA");
request.AddHeader("requestToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"paymentMethod\": {\n    \"cardnumber\": \"4111111111111111\",\n    \"method\": \"card\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Success
import Foundation

let headers = [
  "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA",
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["paymentMethod": [
    "cardnumber": "4111111111111111",
    "method": "card"
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/validate")! 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()
```