# 

## Prerequisites

* A valid API key — see [Obtain API credentials](/docs/how-tos/setup/obtain-credentials)
* A `token` value — obtained from a previous transaction response or from `POST /v1/payment_tokens`


## Step 1: Build the request

Set `payment_method.type` to `token` and include the token.

| Field | Required | Description |
|  --- | --- | --- |
| `type` | Yes | `sale`, `auth`, `payment`, `payout` |
| `amount` | Yes | Amount in cents |
| `payment_method.type` | Yes | `token` |
| `payment_method.payment_token` | Yes | Token from a prior transaction or the Payment Tokens API |
| `recurring` | Tes | Set to `true` for merchant-initiated recurring charges |


## Step 2: Send the request

curl
```shell
curl -X POST \
  https://api.dev.paradisegateway.net/v1/transactions \
  -H "Content-Type: application/json" \
  -H "APIKEY: YOUR-API-KEY" \
  -d '{
    "type": "sale",
    "amount": 15000,
    "tip": 0,
    "payment_method": {
      "type": "payment_token",
      "payment_token": "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA"
    },
    "recurring": true,
    "purchase_description": "Monthly subscription"
  }'
```

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": "sale",
        "amount": 15000,
        "tip": 0,
        "payment_method": {
            "type": "token",
            "payment_token": "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA",
        },
        "recurring": True,
        "purchase_description": "Monthly subscription",
    },
)
print(resp.json())
```

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: "sale",
      amount: 15000,
      tip: 0,
      payment_method: {
        type: "token",
        payment_token: "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA",
      },
      recurring: true,
      purchase_description: "Monthly subscription",
    }),
  }
);
console.log(await resp.json());
```

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

var payload = new
{
    type = "sale",
    amount = 15000,
    tip = 0,
    payment_method = new
    {
        type = "token",
        payment_token = "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA"
    },
    recurring = true,
    purchase_description = "Monthly subscription"
};

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": "sale",
      "amount": 0,
      "tip": 1000,
      "payment_method": {
        "type": "token",
        "payment_token": "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA"
      },
      "recurring": true,
      "purchase_description": "Monthly subscription"
    }
    """;
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": "sale",
  "amount": 15000,
  "tip": 0,
  "payment_method": {
    "type": "token",
    "payment_token": "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA"
  },
  "recurring": true,
  "purchase_description": "Monthly subscription"
}`)
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" => "sale",
        "amount" => 15000,
        "tip" => 0,
        "payment_method" => [
            "type" => "token",
            "payment_token" => "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA",
        ],
        "recurring" => true,
        "purchase_description" => "Monthly subscription",
    ]),
]);
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: "sale", amount: 15000, tip: 0,
  payment_method: {
    type: "token",
    payment_token: "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA",
  },
  recurring: true, purchase_description: "Monthly subscription",
}.to_json
resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts resp.body
```

## Step 3: Handle the response

The response is identical in structure to a raw-card sale. The `payment_method` section echoes the token and masked card details.

```json
{
  "id": "TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y",
  "object": "transaction",
  "type": "sale",
  "transaction_state": "authorized",
  "response_status": "Approved",
  "response_code": "00",
  "amount": 15000,
  "tip": 0,
  "payment_method": {
    "type": "token",
    "payment_token": "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA",
  },
  "correlation_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}
```

CVV not required for tokens
When using a stored token, CVV is not sent (PCI-DSS prohibits storing CVV). AVS results may not be available on tokenized transactions unless address data was stored with the token.

## When to use tokens

| Scenario | Set `recurring` |
|  --- | --- |
| Returning customer checks out again | `false` |
| Subscription or scheduled billing | `true` |
| One-click reorder | `false` |
| Installment payments | `true` |


Setting `recurring: true` flags the transaction as merchant-initiated, which meets card network rules and can improve authorization rates.

## Next steps

* [About tokenization](/docs/concepts/tokenization/what-is-tokenization)
* [About stored payment methods](/docs/concepts/tokenization/stored-payment-methods)
* [Authorize and capture separately](/docs/how-tos/process-payments/authorize-capture-separately)