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

# Process a prepare Debit

POST https://gateway.ixopay.com/api/v3/transaction/{apiKey}/prepare-debit
Content-Type: application/json

Reference: https://ixopay.ferndocs.com/developer-hub/api-reference/transaction-api/prepare-transaction/process-prepare-debit

## Authentication

- `Authorization` header (basic auth, required) — Basic authentication of the form `Basic <base64(username:password)>`.

## Request

### Path parameters

- `apiKey` (string, required) — API Key of Connector

### Body (application/json)

This endpoint expects a PrepareDebitRequest.

- `amount` (string, required)
- `currency` (enum, required) — ISO 4217 three-letter currency code (e.g. EUR, USD, GBP).
  - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `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`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAD`, `XAF`, `XCD`, `XCG`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWG`
- `merchantTransactionId` (string, optional)
- `additionalId1` (string, optional)
- `additionalId2` (string, optional)
- `extraData` (map from string to string, optional)
- `merchantMetaData` (string, optional)
- `referenceUuid` (string, optional)
- `successUrl` (string, optional)
- `cancelUrl` (string, optional)
- `errorUrl` (string, optional)
- `callbackUrl` (string, optional)
- `transactionToken` (string, optional)
- `description` (string, optional)
- `items` (list of ItemsItems, optional)
- `withRegister` (boolean, optional)
- `transactionIndicator` (enum, optional)
  - Allowed values: `SINGLE`, `INITIAL`, `RECURRING`, `FIRST-CARDONFILE`, `CARDONFILE`, `CARDONFILE-MERCHANT-INITIATED`
- `customer` (Customer, optional)
- `schedule` (Schedule, optional)
- `customerProfileData` (CustomerProfileData, optional)
- `threeDSecureData` (ThreeDSecureData, optional)
- `language` (string, optional)

## Response

### 200

Prepare Debit response

- `success` (boolean, optional)
- `error` (string, optional)

## Types

### ItemsItems

- `identification` (string, optional)
- `name` (string, optional)
- `description` (string, optional)
- `quantity` (ItemsItemsQuantity, optional)
- `price` (ItemsItemsPrice, optional)
- `currency` (enum, optional) — ISO 4217 three-letter currency code (e.g. EUR, USD, GBP).
  - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `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`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAD`, `XAF`, `XCD`, `XCG`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWG`
- `l2l3Data` (ItemsItemsL2L3Data, optional)
- `extraData` (map from string to string, optional)

### Customer

- `identification` (string, optional) — Your own identifier for this customer, used to link transactions/profiles to the same person.
- `firstName` (string, optional) — Customer's first name.
- `lastName` (string, optional) — Customer's last name.
- `birthDate` (string, optional)
- `gender` (enum, optional) — Customer's gender, where known.
  - Allowed values: `M`, `F`
- `billingAddress1` (string, optional) — First line of the customer's billing address.
- `billingAddress2` (string, optional) — Second line of the customer's billing address.
- `billingCity` (string, optional) — City of the customer's billing address.
- `billingPostcode` (string, optional) — Postal code of the customer's billing address.
- `billingState` (string, optional) — State or region of the customer's billing address.
- `billingCountry` (string, optional)
- `billingPhone` (string, optional) — Customer's billing phone number.
- `shippingFirstName` (string, optional) — First name on the shipping address.
- `shippingLastName` (string, optional) — Last name on the shipping address.
- `shippingCompany` (string, optional) — Company name on the shipping address, if shipping to a business.
- `shippingAddress1` (string, optional) — First line of the shipping address.
- `shippingAddress2` (string, optional) — Second line of the shipping address.
- `shippingCity` (string, optional) — City of the shipping address.
- `shippingPostcode` (string, optional) — Postal code of the shipping address.
- `shippingState` (string, optional) — State or region of the shipping address.
- `shippingCountry` (string, optional)
- `shippingPhone` (string, optional) — Phone number on the shipping address.
- `company` (string, optional) — Customer's company name, for business/B2B transactions.
- `email` (string, optional) — Customer's email address.
- `emailVerified` (boolean, optional) — Whether the merchant has already verified this customer's email address.
- `ipAddress` (string, optional) — Customer's IP address at the time of the transaction, used for fraud/risk screening.
- `nationalId` (string, optional) — Customer's national ID or tax identification number, where required by the acquirer or local regulation.
- `extraData` (map from string to string, optional)
- `paymentData` (PaymentData, optional)

### Schedule

- `amount` (string, required)
- `currency` (enum, required) — ISO 4217 three-letter currency code (e.g. EUR, USD, GBP).
  - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `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`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAD`, `XAF`, `XCD`, `XCG`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWG`
- `periodLength` (integer, required)
- `periodUnit` (enum, required)
  - Allowed values: `DAY`, `WEEK`, `MONTH`, `YEAR`
- `startDateTime` (string, optional)
- `merchantMetaData` (string, optional)
- `callbackUrl` (string, optional)

### CustomerProfileData

- `profileGuid` (string, optional)
- `customerIdentification` (string, optional)
- `paymentToken` (string, optional)
- `markAsPreferred` (boolean, optional)

### ThreeDSecureData

- `3dsecure` (enum, optional)
  - Allowed values: `OFF`, `OPTIONAL`, `MANDATORY`
- `schemeId` (enum, optional)
  - Allowed values: `CB`, `Eftpos`
- `channel` (enum, optional)
  - Allowed values: `01`, `02`, `03`
- `authenticationIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`
- `cardholderAuthenticationMethod` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`
- `cardholderAuthenticationDateTime` (string, optional)
- `cardHolderAuthenticationData` (string, optional)
- `challengeIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`, `07`, `08`, `09`
- `priorReference` (string, optional)
- `priorAuthenticationMethod` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`
- `priorAuthenticationDateTime` (string, optional)
- `priorAuthenticationData` (string, optional)
- `cardholderAccountType` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`
- `cardholderAccountAgeIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`
- `cardholderAccountDate` (string, optional)
- `cardholderAccountChangeIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`
- `cardholderAccountLastChange` (string, optional)
- `cardholderAccountPasswordChangeIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`
- `cardholderAccountLastPasswordChange` (string, optional)
- `shippingAddressUsageIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`
- `shippingAddressFirstUsage` (string, optional)
- `transactionActivityDay` (double, optional)
- `transactionActivityYear` (double, optional)
- `addCardAttemptsDay` (double, optional)
- `purchaseCountSixMonths` (double, optional)
- `suspiciousAccountActivityIndicator` (enum, optional)
  - Allowed values: `01`, `02`
- `shippingNameEqualIndicator` (enum, optional)
  - Allowed values: `01`, `02`
- `paymentAccountAgeIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`
- `paymentAccountAgeDate` (string, optional)
- `billingAddressLine3` (string, optional)
- `shippingAddressLine3` (string, optional)
- `billingShippingAddressMatch` (enum, optional)
  - Allowed values: `Y`, `N`
- `homePhoneCountryPrefix` (string, optional)
- `homePhoneNumber` (string, optional)
- `mobilePhoneCountryPrefix` (string, optional)
- `mobilePhoneNumber` (string, optional)
- `workPhoneCountryPrefix` (string, optional)
- `workPhoneNumber` (string, optional)
- `purchaseInstalData` (double, optional)
- `shipIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`, `07`
- `deliveryTimeframe` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`
- `deliveryEmailAddress` (string, optional)
- `reorderItemsIndicator` (enum, optional)
  - Allowed values: `01`, `02`
- `preOrderPurchaseIndicator` (enum, optional)
  - Allowed values: `01`, `02`
- `preOrderDate` (string, optional)
- `giftCardAmount` (double, optional)
- `giftCardCurrency` (enum, optional) — ISO 4217 three-letter currency code (e.g. EUR, USD, GBP).
  - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `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`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAD`, `XAF`, `XCD`, `XCG`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWG`
- `giftCardCount` (double, optional)
- `purchaseDate` (string, optional)
- `recurringExpiry` (string, optional)
- `recurringFrequency` (double, optional)
- `transType` (enum, optional)
  - Allowed values: `01`, `03`, `10`, `11`, `28`
- `exemptionIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`, `07`
- `threeRIIndicator` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`, `07`, `08`, `09`, `10`, `11`, `12`
- `browserChallengeWindowSize` (enum, optional)
  - Allowed values: `01`, `02`, `03`, `04`, `05`
- `browserAcceptHeader` (string, optional)
- `browserIpAddress` (string, optional)
- `browserJavaEnabled` (boolean, optional)
- `browserLanguage` (string, optional)
- `browserColorDepth` (ThreeDSecureDataBrowserColorDepth, optional)
- `browserScreenHeight` (ThreeDSecureDataBrowserScreenHeight, optional)
- `browserScreenWidth` (ThreeDSecureDataBrowserScreenWidth, optional)
- `browserTimezone` (ThreeDSecureDataBrowserTimezone, optional)
- `browserUserAgent` (string, optional)
- `browserPlatform` (string, optional)
- `sdkInterface` (enum, optional)
  - Allowed values: `01`, `02`, `03`
- `sdkUiType` (string, optional)
- `sdkAppID` (string, optional)
- `sdkEncData` (string, optional)
- `sdkEphemPubKey` (string, optional)
- `sdkMaxTimeout` (double, optional)
- `sdkReferenceNumber` (string, optional)
- `sdkTransID` (string, optional)

### ItemsItemsQuantity

### ItemsItemsPrice

### ItemsItemsL2L3Data

- `type` (string, optional)
- `unit` (string, optional)
- `unitPrice` (string, optional)
- `discount` (string, optional)
- `discountRate` (string, optional)
- `shippingAmount` (string, optional)
- `taxAmount` (string, optional)
- `taxRate` (string, optional)
- `commodityCode` (string, optional)
- `taxDetails` (list of TaxDetailsItems, optional)

### PaymentData

### ThreeDSecureDataBrowserColorDepth

### ThreeDSecureDataBrowserScreenHeight

### ThreeDSecureDataBrowserScreenWidth

### ThreeDSecureDataBrowserTimezone

### TaxDetailsItems

- `type` (string, optional)
- `amount` (string, optional)
- `rate` (string, optional)
- `code` (string, optional)
- `taxId` (string, optional)
- `applied` (string, optional)
- `exemptionCode` (string, optional)

### IbanData

- `ibanData` (IbanDataIbanData, optional)

### WalletData

- `walletData` (WalletDataWalletData, optional)

### IbanDataIbanData

- `iban` (string, optional)
- `bic` (string, optional)
- `mandateId` (string, optional)
- `mandateDate` (string, optional)

### WalletDataWalletData

- `walletReferenceId` (string, optional)
- `walletOwner` (string, optional)
- `walletType` (string, optional)

## Examples

### success

**Request**

```json
{
  "amount": "string",
  "currency": "AED"
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "data1": "data1",
    "data2": "data2"
  }
}
```

**SDK Code**

```python success
import requests

url = "https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit"

payload = {
    "amount": "string",
    "currency": "AED"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript success
const url = 'https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"amount":"string","currency":"AED"}'
};

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://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit"

	payload := strings.NewReader("{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\n}")

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

	req.SetBasicAuth("<username>", "<password>")
	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://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\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://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit', [
  'body' => '{
  "amount": "string",
  "currency": "AED"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp success
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift success
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": "string",
  "currency": "AED"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit")! 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()
```

### error

**Request**

```json
{
  "amount": "string",
  "currency": "AED"
}
```

**Response**

```json
{
  "success": false,
  "errorMessage": "Given identifier 'someIdentifier' is invalid."
}
```

**SDK Code**

```python error
import requests

url = "https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit"

payload = {
    "amount": "string",
    "currency": "AED"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript error
const url = 'https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"amount":"string","currency":"AED"}'
};

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

```go error
package main

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

func main() {

	url := "https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit"

	payload := strings.NewReader("{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\n}")

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

	req.SetBasicAuth("<username>", "<password>")
	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 error
require 'uri'
require 'net/http'

url = URI("https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit', [
  'body' => '{
  "amount": "string",
  "currency": "AED"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp error
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": \"string\",\n  \"currency\": \"AED\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift error
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": "string",
  "currency": "AED"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://gateway.ixopay.com/api/v3/transaction/apiKey/prepare-debit")! 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()
```