# 

## Prerequisites

* A valid API key — see [Obtain API credentials](/docs/how-tos/setup/obtain-credentials)
* A processor integration configured for card payments (TSYS)


## Step 1: Authorize the payment

Send `POST /v1/transactions` with `type: auth`. This places a hold on the person's card without capturing funds.

curl
```shell
curl -X POST \
  https://api.dev.paradisegateway.net/v1/transactions \
  -H "Content-Type: application/json" \
  -H "APIKEY: YOUR-API-KEY" \
  -d '{
    "type": "auth",
    "amount": 25000,
    "tip": 1000,
    "payment_method": {
      "type": "card",
      "pan": "5500000000005678",
      "expiry_month": "07",
      "expiry_year": "2029",
      "cardholder_name": "Nyota Uhura",
      "cvv": "789",
      "address_line1": "42 Subspace Ln",
      "zip": "30301"
    },
    "recurring": false,
    "purchase_description": "Starfleet uniform"
  }'
```

Python
```python
import requests

resp = requests.post(
    "https://api.dev.paradisegateway.net/v1/transactions",
    headers={"Content-Type": "application/json", "APIKEY": "YOUR-API-KEY"},
    json={
        "type": "auth",
        "amount": 25000,
        "tip": 1000,
        "payment_method": {
            "type": "card",
            "pan": "5500000000005678",
            "expiry_month": "07",
            "expiry_year": "2029",
            "cardholder_name": "Nyota Uhura",
            "cvv": "789",
            "address_line1": "42 Subspace Ln",
            "zip": "30301",
        },
        "recurring": False,
        "purchase_description": "Starfleet uniform",
    },
)
data = resp.json()
transaction_id = data["id"]
print(f"Authorization ID: {transaction_id}")
```

JavaScript
```javascript
const resp = await fetch(
  "https://api.dev.paradisegateway.net/v1/transactions",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "APIKEY": "YOUR-API-KEY",
    },
    body: JSON.stringify({
      type: "auth",
      amount: 25000,
      tip: 1000,
      payment_method: {
        type: "card",
        pan: "5500000000005678",
        expiry_month: "07",
        expiry_year: "2029",
        cardholder_name: "Nyota Uhura",
        cvv: "789",
        address_line1: "42 Subspace Ln",
        zip: "30301",
      },
      recurring: false,
      purchase_description: "Starfleet uniform",
    }),
  }
);
const data = await resp.json();
console.log("Authorization ID:", data.id);
```

C#
```csharp
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("APIKEY", "YOUR-API-KEY");

var payload = new
{
    type = "auth", amount = 25000, tip = 1000,
    payment_method = new
    {
        type = "card", pan = "5500000000005678",
        expiry_month = "07", expiry_year = "2029",
        cardholder_name = "Nyota Uhura", cvv = "789",
        address_line1 = "42 Subspace Ln", zip = "30301"
    },
    recurring = false, purchase_description = "Starfleet uniform"
};
var resp = await client.PostAsJsonAsync(
    "https://api.dev.paradisegateway.net/v1/transactions", payload);
Console.WriteLine(await resp.Content.ReadAsStringAsync());
```

Java
```java
HttpClient client = HttpClient.newHttpClient();
String body = """
    {
      "type": "auth", "amount": 25000, "tip": 1000,
      "payment_method": {
        "type": "card", "pan": "5500000000005678",
        "expiry_month": "07", "expiry_year": "2029",
        "cardholder_name": "Nyota Uhura", "cvv": "789",
        "address_line1": "42 Subspace Ln", "zip": "30301"
      },
      "recurring": false, "purchase_description": "Starfleet uniform"
    }
    """;
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.dev.paradisegateway.net/v1/transactions"))
    .header("Content-Type", "application/json")
    .header("APIKEY", "YOUR-API-KEY")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();
HttpResponse<String> resp = client.send(request,
    HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());
```

Go
```go
payload := strings.NewReader(`{
  "type": "auth", "amount": 25000, "tip": 1000,
  "payment_method": {
    "type": "card", "pan": "5500000000005678",
    "expiry_month": "07", "expiry_year": "2029",
    "cardholder_name": "Nyota Uhura", "cvv": "789",
    "address_line1": "42 Subspace Ln", "zip": "30301"
  },
  "recurring": false, "purchase_description": "Starfleet uniform"
}`)
req, _ := http.NewRequest("POST",
    "https://api.dev.paradisegateway.net/v1/transactions", payload)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("APIKEY", "YOUR-API-KEY")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
```

PHP
```php
$ch = curl_init("https://api.dev.paradisegateway.net/v1/transactions");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ["Content-Type: application/json", "APIKEY: YOUR-API-KEY"],
    CURLOPT_POSTFIELDS => json_encode([
        "type" => "auth", "amount" => 25000, "tip" => 1000,
        "payment_method" => [
            "type" => "card", "pan" => "5500000000005678",
            "expiry_month" => "07", "expiry_year" => "2029",
            "cardholder_name" => "Nyota Uhura", "cvv" => "789",
            "address_line1" => "42 Subspace Ln", "zip" => "30301",
        ],
        "recurring" => false, "purchase_description" => "Starfleet uniform",
    ]),
]);
echo curl_exec($ch); curl_close($ch);
```

Ruby
```ruby
require "net/http"; require "json"
uri = URI("https://api.dev.paradisegateway.net/v1/transactions")
req = Net::HTTP::Post.new(uri, {
  "Content-Type" => "application/json", "APIKEY" => "YOUR-API-KEY",
})
req.body = {
  type: "auth", amount: 25000, tip: 1000,
  payment_method: { type: "card", pan: "5500000000005678",
    expiry_month: "07", expiry_year: "2029",
    cardholder_name: "Nyota Uhura", cvv: "789",
    address_line1: "42 Subspace Ln", zip: "30301" },
  recurring: false, purchase_description: "Starfleet uniform",
}.to_json
resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts resp.body
```

Save the `id` from the response — you need it for the capture step.

```json
{
  "id": "TRANSACTION-02KNUHURA8YWP4LT9G3X5V7Z0",
  "type": "auth",
  "transaction_state": "authorized",
  "response_status": "Approved",
  "response_code": "00",
  "amount": 25000
}
```

## Step 2: Capture the payment

When ready (for example, the order ships), send `POST /v1/transactions/{id}/capture`.

curl
```shell
curl -X POST \
  https://api.dev.paradisegateway.net/v1/transactions/TRANSACTION-02KNUHURA8YWP4LT9G3X5V7Z0/capture \
  -H "Content-Type: application/json" \
  -H "APIKEY: YOUR-API-KEY" \
  -d '{
    "type": "capture",
    "amount": 30000,
    "tip": 5000
  }'
```

Python
```python
resp = requests.post(
    f"https://api.dev.paradisegateway.net/v1/transactions/{transaction_id}/capture",
    headers={"Content-Type": "application/json", "APIKEY": "YOUR-API-KEY"},
    json={"type": "capture", "amount": 30000, "tip": 5000},
)
print(resp.json())
```

JavaScript
```javascript
const captureResp = await fetch(
  `https://api.dev.paradisegateway.net/v1/transactions/${transactionId}/capture`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "APIKEY": "YOUR-API-KEY",
    },
    body: JSON.stringify({
      type: "capture",
      amount: 30000,
      tip: 5000,
    }),
  }
);
console.log(await captureResp.json());
```

C#
```csharp
var capturePayload = new { type = "capture", amount = 30000, tip = 5000 };
var captureResp = await client.PostAsJsonAsync(
    $"https://api.dev.paradisegateway.net/v1/transactions/{transactionId}/capture",
    capturePayload);
Console.WriteLine(await captureResp.Content.ReadAsStringAsync());
```

Java
```java
String captureBody = """
    {"type": "capture", "amount": 30000, "tip": 5000}
    """;
HttpRequest captureReq = HttpRequest.newBuilder()
    .uri(URI.create(
        "https://api.dev.paradisegateway.net/v1/transactions/"
        + transactionId + "/capture"))
    .header("Content-Type", "application/json")
    .header("APIKEY", "YOUR-API-KEY")
    .POST(HttpRequest.BodyPublishers.ofString(captureBody))
    .build();
HttpResponse<String> captureResp = client.send(captureReq,
    HttpResponse.BodyHandlers.ofString());
System.out.println(captureResp.body());
```

Go
```go
capturePayload := strings.NewReader(
    `{"type": "capture", "amount": 30000, "tip": 5000}`)
captureReq, _ := http.NewRequest("POST",
    "https://api.dev.paradisegateway.net/v1/transactions/"+transactionID+"/capture",
    capturePayload)
captureReq.Header.Set("Content-Type", "application/json")
captureReq.Header.Set("APIKEY", "YOUR-API-KEY")
captureResp, _ := http.DefaultClient.Do(captureReq)
defer captureResp.Body.Close()
captureBody, _ := io.ReadAll(captureResp.Body)
fmt.Println(string(captureBody))
```

PHP
```php
$ch = curl_init(
    "https://api.dev.paradisegateway.net/v1/transactions/$transactionId/capture");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ["Content-Type: application/json", "APIKEY: YOUR-API-KEY"],
    CURLOPT_POSTFIELDS => json_encode([
        "type" => "capture", "amount" => 30000, "tip" => 5000,
    ]),
]);
echo curl_exec($ch); curl_close($ch);
```

Ruby
```ruby
uri = URI(
  "https://api.dev.paradisegateway.net/v1/transactions/#{transaction_id}/capture")
req = Net::HTTP::Post.new(uri, {
  "Content-Type" => "application/json", "APIKEY" => "YOUR-API-KEY",
})
req.body = { type: "capture", amount: 30000, tip: 5000 }.to_json
resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts resp.body
```

The capture response confirms the transaction is ready for settlement.

```json
{
  "id": "TRANSACTION-02KNUHURA8YWP4LT9G3X5V7Z0",
  "type": "capture",
  "transaction_state": "completed",
  "response_status": "Approved",
  "response_code": "00",
  "amount": 30000,
  "tip": 5000
}
```

## Canceling an uncaptured authorization

If you decide not to fulfill the order, cancel the authorization to release the hold immediately.

```shell
curl -X POST \
  https://api.dev.paradisegateway.net/v1/transactions/TRANSACTION-02KNUHURA8YWP4LT9G3X5V7Z0/cancel \
  -H "Content-Type: application/json" \
  -H "APIKEY: YOUR-API-KEY" \
  -d '{"type": "cancel", "amount": 25000}'
```

Authorization expiry
Uncaptured authorizations expire after 7–30 days (varies by issuing bank). Always cancel explicitly to release funds sooner.

## Next steps

* [Handle partial captures](/docs/how-tos/process-payments/handle-partial-capture) — capture less than the authorized amount
* [Add a tip or surcharge](/docs/how-tos/process-payments/add-tip) — update the amount between auth and capture
* [About sale vs. authorization](/docs/concepts/transactions/sale-vs-auth)