> 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

# Capture transaction

POST https://api-sandbox.payabli.com/api/MoneyIn/capture/{transId}
Content-Type: application/json

<Warning>
  This endpoint is deprecated. Use it only to capture transactions originally authorized with the legacy [Authorize endpoint](/developers/api-reference/moneyin/authorize-a-transaction). New integrations should use the [Capture endpoint](/developers/api-reference/moneyinV2/capture-an-authorized-transaction), which only works on transactions authorized with the current [Authorize endpoint](/developers/api-reference/moneyinV2/authorize-a-transaction).
</Warning>

Capture an [authorized transaction](/developers/api-reference/moneyin/authorize-a-transaction) to complete the transaction and move funds from the customer to merchant account.

You can use this endpoint to capture both full and partial amounts of the original authorized transaction. See [Capture an authorized transaction](/developers/developer-guides/pay-in-auth-and-capture) for more information about this endpoint.


Reference: https://docs.payabli.com/developers/api-reference/moneyin/capture-an-authorized-transaction

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi-oas
  version: 1.0.0
paths:
  /MoneyIn/capture/{transId}:
    post:
      operationId: CaptureAuth
      summary: Capture Auth
      description: >
        <Warning>
          This endpoint is deprecated. Use it only to capture transactions originally authorized with the legacy [Authorize endpoint](/developers/api-reference/moneyin/authorize-a-transaction). New integrations should use the [Capture endpoint](/developers/api-reference/moneyinV2/capture-an-authorized-transaction), which only works on transactions authorized with the current [Authorize endpoint](/developers/api-reference/moneyinV2/authorize-a-transaction).
        </Warning>


        Capture an [authorized
        transaction](/developers/api-reference/moneyin/authorize-a-transaction)
        to complete the transaction and move funds from the customer to merchant
        account.


        You can use this endpoint to capture both full and partial amounts of
        the original authorized transaction. See [Capture an authorized
        transaction](/developers/developer-guides/pay-in-auth-and-capture) for
        more information about this endpoint.
      tags:
        - moneyIn
      parameters:
        - name: transId
          in: path
          description: ReferenceId for the transaction (PaymentId).
          required: true
          schema:
            type: string
        - name: requestToken
          in: header
          description: >
            Long-lived API token sent in the `requestToken` header. See [API
            token authentication](/developers/api-tokens).
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CaptureResponse'
        '400':
          description: Bad request / invalid data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '503':
          description: Database connection error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CaptureRequest'
servers:
  - url: https://api-sandbox.payabli.com/api
    description: Sandbox
  - url: https://api.payabli.com/api
    description: Production
components:
  schemas:
    CapturePaymentDetails:
      type: object
      properties:
        totalAmount:
          type: number
          format: double
          description: >-
            Total amount to be captured, including the `serviceFee` amount. The
            amount can't be greater the original

            total amount of the transaction, and can't be more than 15% lower
            than the original amount.
        serviceFee:
          type: number
          format: double
          description: Service fee to capture for the transaction.
      required:
        - totalAmount
      title: CapturePaymentDetails
    CaptureRequest:
      type: object
      properties:
        paymentDetails:
          $ref: '#/components/schemas/CapturePaymentDetails'
      required:
        - paymentDetails
      title: CaptureRequest
    Responsecode:
      type: integer
      description: |
        Code for the response. Learn more in
        [API Response Codes](/developers/api-reference/api-responses).
      title: Responsecode
    PageIdentifier:
      type: string
      description: Auxiliary validation used internally by payment pages and components.
      title: PageIdentifier
    RoomIdNotInUse:
      type: integer
      format: int64
      description: Field not in use on this endpoint. It always returns `0`.
      title: RoomIdNotInUse
    IsSuccess:
      type: boolean
      description: |
        Boolean indicating whether the operation was successful. A `true` value
        indicates success. A `false` value indicates failure.
      title: IsSuccess
    ResponseText:
      type: string
      description: |
        Response text for operation: 'Success' or 'Declined'.
      title: ResponseText
    Authcode:
      type: string
      description: Authorization code for the transaction.
      title: Authcode
    Referenceidtrans:
      type: string
      description: The transaction identifier in Payabli.
      title: Referenceidtrans
    ResultCode:
      type: integer
      description: |
        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.
      title: ResultCode
    Resulttext:
      type: string
      description: |
        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.
      title: Resulttext
    AvsResponseText:
      type: string
      description: |
        Text code describing the result for address validation (applies only for
        card transactions).
      title: AvsResponseText
    CvvResponseText:
      type: string
      description: >
        Text code describing the result for CVV validation (applies only for
        card

        transactions).
      title: CvvResponseText
    Customeridtrans:
      type: integer
      format: int64
      description: >
        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.
      title: Customeridtrans
    MethodReferenceId:
      type: string
      description: |
        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.
      title: MethodReferenceId
    CaptureResponseData:
      type: object
      properties:
        authCode:
          $ref: '#/components/schemas/Authcode'
        referenceId:
          $ref: '#/components/schemas/Referenceidtrans'
        resultCode:
          $ref: '#/components/schemas/ResultCode'
        resultText:
          $ref: '#/components/schemas/Resulttext'
        avsResponseText:
          oneOf:
            - $ref: '#/components/schemas/AvsResponseText'
            - type: 'null'
        cvvResponseText:
          oneOf:
            - $ref: '#/components/schemas/CvvResponseText'
            - type: 'null'
        customerId:
          oneOf:
            - $ref: '#/components/schemas/Customeridtrans'
            - type: 'null'
        methodReferenceId:
          oneOf:
            - $ref: '#/components/schemas/MethodReferenceId'
            - type: 'null'
      required:
        - authCode
        - referenceId
        - resultCode
        - resultText
        - avsResponseText
        - cvvResponseText
        - customerId
        - methodReferenceId
      description: Response data for capture transactions
      title: CaptureResponseData
    CaptureResponse:
      type: object
      properties:
        responseCode:
          $ref: '#/components/schemas/Responsecode'
        pageIdentifier:
          oneOf:
            - $ref: '#/components/schemas/PageIdentifier'
            - type: 'null'
        roomId:
          $ref: '#/components/schemas/RoomIdNotInUse'
        isSuccess:
          $ref: '#/components/schemas/IsSuccess'
        responseText:
          $ref: '#/components/schemas/ResponseText'
        responseData:
          $ref: '#/components/schemas/CaptureResponseData'
      required:
        - responseCode
        - pageIdentifier
        - roomId
        - isSuccess
        - responseText
        - responseData
      description: Response for MoneyIn/capture endpoint
      title: CaptureResponse
    PayabliErrorBodyResponseData:
      type: object
      properties:
        explanation:
          type: string
          description: Human-readable explanation of what happened.
        todoAction:
          type: string
          description: Suggested resolution.
      description: Object with detailed error context.
      title: PayabliErrorBodyResponseData
    PayabliErrorBody:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: Always `false` for error responses.
        responseCode:
          type: integer
          description: |
            Code for the response. Learn more in
            [API Response Codes](/developers/api-reference/api-responses).
        responseText:
          type: string
          description: Error text describing what went wrong.
        responseData:
          $ref: '#/components/schemas/PayabliErrorBodyResponseData'
          description: Object with detailed error context.
      required:
        - isSuccess
        - responseText
      description: |
        Shape returned by every Payabli API error response. The `responseData`
        object carries human-readable error context.
      title: PayabliErrorBody
  securitySchemes:
    APIKeyAuth:
      type: apiKey
      in: header
      name: requestToken
      description: >
        Long-lived API token sent in the `requestToken` header. See [API token
        authentication](/developers/api-tokens).
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        OAuth2 Bearer access token from the client-credentials flow. See [OAuth
        authentication](/developers/oauth-authentication).

```

## Examples

### CaptureFullAmountwithFee



**Request**

```json
{
  "paymentDetails": {
    "totalAmount": 105,
    "serviceFee": 5
  }
}
```

**Response**

```json
{
  "responseCode": 1,
  "pageIdentifier": null,
  "roomId": 0,
  "isSuccess": true,
  "responseText": "Success",
  "responseData": {
    "authCode": "123456",
    "referenceId": "129-219",
    "resultCode": 1,
    "resultText": "SUCCESS",
    "avsResponseText": null,
    "cvvResponseText": null,
    "customerId": null,
    "methodReferenceId": null
  }
}
```

**SDK Code**

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

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", {
        paymentDetails: {
            totalAmount: 105,
            serviceFee: 5,
        },
    });
}
main();

```

```python CaptureFullAmountwithFee
from payabli import payabli, CapturePaymentDetails

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.money_in.capture_auth(
    trans_id="10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
    payment_details=CapturePaymentDetails(
        total_amount=105,
        service_fee=5,
    ),
)

```

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

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.types.CapturePaymentDetails;
import io.github.payabli.api.types.CaptureRequest;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.moneyIn().captureAuth(
            "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
            CaptureRequest
                .builder()
                .paymentDetails(
                    CapturePaymentDetails
                        .builder()
                        .totalAmount(105.0)
                        .serviceFee(5.0)
                        .build()
                )
                .build()
        );
    }
}
```

```ruby CaptureFullAmountwithFee
require "payabli"

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

client.money_in.capture_auth(
  trans_id: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
  payment_details: {
    total_amount: 105,
    service_fee: 5
  }
)

```

```csharp CaptureFullAmountwithFee
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.MoneyIn.CaptureAuthAsync(
            "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
            new CaptureRequest {
                PaymentDetails = new CapturePaymentDetails {
                    TotalAmount = 105,
                    ServiceFee = 5
                }
            }
        );
    }

}

```

```go CaptureFullAmountwithFee
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.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.CaptureRequest{
        PaymentDetails: &payabli.CapturePaymentDetails{
            TotalAmount: 105,
            ServiceFee: payabli.Float64(
                5,
            ),
        },
    }
    client.MoneyIn.CaptureAuth(
        context.TODO(),
        "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
        request,
    )
}

```

```php CaptureFullAmountwithFee
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Types\CaptureRequest;
use Payabli\Types\CapturePaymentDetails;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->moneyIn->captureAuth(
    '10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13',
    new CaptureRequest([
        'paymentDetails' => new CapturePaymentDetails([
            'totalAmount' => 105,
            'serviceFee' => 5,
        ]),
    ]),
);

```

```swift CaptureFullAmountwithFee
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["paymentDetails": [
    "totalAmount": 105,
    "serviceFee": 5
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/capture/10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13")! 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()
```

### CapturePartialAmountwithFee



**Request**

```json
{
  "paymentDetails": {
    "totalAmount": 89,
    "serviceFee": 4
  }
}
```

**Response**

```json
{
  "responseCode": 1,
  "pageIdentifier": null,
  "roomId": 0,
  "isSuccess": true,
  "responseText": "Success",
  "responseData": {
    "authCode": "123456",
    "referenceId": "129-219",
    "resultCode": 1,
    "resultText": "SUCCESS",
    "avsResponseText": null,
    "cvvResponseText": null,
    "customerId": null,
    "methodReferenceId": null
  }
}
```

**SDK Code**

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

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", {
        paymentDetails: {
            totalAmount: 89,
            serviceFee: 4,
        },
    });
}
main();

```

```python CapturePartialAmountwithFee
from payabli import payabli, CapturePaymentDetails

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.money_in.capture_auth(
    trans_id="10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
    payment_details=CapturePaymentDetails(
        total_amount=89,
        service_fee=4,
    ),
)

```

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

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.types.CapturePaymentDetails;
import io.github.payabli.api.types.CaptureRequest;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.moneyIn().captureAuth(
            "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
            CaptureRequest
                .builder()
                .paymentDetails(
                    CapturePaymentDetails
                        .builder()
                        .totalAmount(89.0)
                        .serviceFee(4.0)
                        .build()
                )
                .build()
        );
    }
}
```

```ruby CapturePartialAmountwithFee
require "payabli"

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

client.money_in.capture_auth(
  trans_id: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
  payment_details: {
    total_amount: 89,
    service_fee: 4
  }
)

```

```csharp CapturePartialAmountwithFee
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.MoneyIn.CaptureAuthAsync(
            "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
            new CaptureRequest {
                PaymentDetails = new CapturePaymentDetails {
                    TotalAmount = 89,
                    ServiceFee = 4
                }
            }
        );
    }

}

```

```go CapturePartialAmountwithFee
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.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.CaptureRequest{
        PaymentDetails: &payabli.CapturePaymentDetails{
            TotalAmount: 89,
            ServiceFee: payabli.Float64(
                4,
            ),
        },
    }
    client.MoneyIn.CaptureAuth(
        context.TODO(),
        "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
        request,
    )
}

```

```php CapturePartialAmountwithFee
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Types\CaptureRequest;
use Payabli\Types\CapturePaymentDetails;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->moneyIn->captureAuth(
    '10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13',
    new CaptureRequest([
        'paymentDetails' => new CapturePaymentDetails([
            'totalAmount' => 89,
            'serviceFee' => 4,
        ]),
    ]),
);

```

```swift CapturePartialAmountwithFee
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["paymentDetails": [
    "totalAmount": 89,
    "serviceFee": 4
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/capture/10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13")! 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()
```

### CaptureNoFee



**Request**

```json
{
  "paymentDetails": {
    "totalAmount": 100
  }
}
```

**Response**

```json
{
  "responseCode": 1,
  "pageIdentifier": null,
  "roomId": 0,
  "isSuccess": true,
  "responseText": "Success",
  "responseData": {
    "authCode": "123456",
    "referenceId": "129-219",
    "resultCode": 1,
    "resultText": "SUCCESS",
    "avsResponseText": null,
    "cvvResponseText": null,
    "customerId": null,
    "methodReferenceId": null
  }
}
```

**SDK Code**

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

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", {
        paymentDetails: {
            totalAmount: 100,
        },
    });
}
main();

```

```python CaptureNoFee
from payabli import payabli, CapturePaymentDetails

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.money_in.capture_auth(
    trans_id="10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
    payment_details=CapturePaymentDetails(
        total_amount=100,
    ),
)

```

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

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.types.CapturePaymentDetails;
import io.github.payabli.api.types.CaptureRequest;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.moneyIn().captureAuth(
            "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
            CaptureRequest
                .builder()
                .paymentDetails(
                    CapturePaymentDetails
                        .builder()
                        .totalAmount(100.0)
                        .build()
                )
                .build()
        );
    }
}
```

```ruby CaptureNoFee
require "payabli"

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

client.money_in.capture_auth(
  trans_id: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
  payment_details: {
    total_amount: 100
  }
)

```

```csharp CaptureNoFee
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.MoneyIn.CaptureAuthAsync(
            "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
            new CaptureRequest {
                PaymentDetails = new CapturePaymentDetails {
                    TotalAmount = 100
                }
            }
        );
    }

}

```

```go CaptureNoFee
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.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.CaptureRequest{
        PaymentDetails: &payabli.CapturePaymentDetails{
            TotalAmount: 100,
        },
    }
    client.MoneyIn.CaptureAuth(
        context.TODO(),
        "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
        request,
    )
}

```

```php CaptureNoFee
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Types\CaptureRequest;
use Payabli\Types\CapturePaymentDetails;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->moneyIn->captureAuth(
    '10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13',
    new CaptureRequest([
        'paymentDetails' => new CapturePaymentDetails([
            'totalAmount' => 100,
        ]),
    ]),
);

```

```swift CaptureNoFee
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["paymentDetails": ["totalAmount": 100]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/capture/10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13")! 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()
```