Skip to main content
POST
/
transactions
Create transaction
curl --request POST \
  --url https://api.fernhq.com/transactions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-idempotency-key: <x-idempotency-key>' \
  --data '
{
  "quoteId": "c88ebfc2-3356-48b5-b2bb-6fca7b618c96",
  "correlationId": "03b7030f-6da1-4e76-3352-3debd82112c8"
}
'
import requests

url = "https://api.fernhq.com/transactions"

payload = {
"quoteId": "c88ebfc2-3356-48b5-b2bb-6fca7b618c96",
"correlationId": "03b7030f-6da1-4e76-3352-3debd82112c8"
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
quoteId: 'c88ebfc2-3356-48b5-b2bb-6fca7b618c96',
correlationId: '03b7030f-6da1-4e76-3352-3debd82112c8'
})
};

fetch('https://api.fernhq.com/transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fernhq.com/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'quoteId' => 'c88ebfc2-3356-48b5-b2bb-6fca7b618c96',
'correlationId' => '03b7030f-6da1-4e76-3352-3debd82112c8'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-idempotency-key: <x-idempotency-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.fernhq.com/transactions"

payload := strings.NewReader("{\n \"quoteId\": \"c88ebfc2-3356-48b5-b2bb-6fca7b618c96\",\n \"correlationId\": \"03b7030f-6da1-4e76-3352-3debd82112c8\"\n}")

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

req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.fernhq.com/transactions")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"quoteId\": \"c88ebfc2-3356-48b5-b2bb-6fca7b618c96\",\n \"correlationId\": \"03b7030f-6da1-4e76-3352-3debd82112c8\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.fernhq.com/transactions")

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

request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quoteId\": \"c88ebfc2-3356-48b5-b2bb-6fca7b618c96\",\n \"correlationId\": \"03b7030f-6da1-4e76-3352-3debd82112c8\"\n}"

response = http.request(request)
puts response.read_body
{
  "transactionId": "1d8beb26-b4d1-47ee-8e5d-0d3905f200c7",
  "customerId": "0423300f-ae6d-4e82-8afb-a3b430e22e29",
  "quoteId": "1d8beb26-b4d1-47ee-8e5d-0d3905f200c7",
  "transactionStatus": "PROCESSING",
  "source": {
    "sourceCurrency": {
      "label": "USDC",
      "chain": "ETHEREUM",
      "contractAddress": "0x123456789abcd123456789abcd123456789abcd",
      "currencyDecimals": 18
    },
    "sourcePaymentMethod": "ACH",
    "sourceAmount": "100.00",
    "sourcePaymentAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77",
    "sourceReferenceId": "0x5332ee2726b7a1b818447d116f81af3be3518a801fb229ebf43e563c0ac4b4bc"
  },
  "destination": {
    "destinationPaymentAccountId": "072a8b7b-38c7-429a-a6cf-35dae7f2fb77",
    "destinationPaymentMethod": "ETHEREUM",
    "destinationCurrency": {
      "label": "USDC",
      "chain": "ETHEREUM",
      "contractAddress": "0x123456789abcd123456789abcd123456789abcd",
      "currencyDecimals": 18
    },
    "exchangeRate": "1.2",
    "destinationAmount": "100",
    "destinationReferenceId": "0x5332ee2726b7a1b818447d116f81af3be3518a801fb229ebf43e563c0ac4b4bc"
  },
  "fees": {
    "feeCurrency": {
      "label": "USDC",
      "chain": "ETHEREUM",
      "contractAddress": "0x123456789abcd123456789abcd123456789abcd",
      "currencyDecimals": 18
    },
    "fernFee": {
      "feeAmount": "5.45",
      "feeUSDAmount": "5.45"
    },
    "developerFee": {
      "feeAmount": "5.45",
      "feeUSDAmount": "5.45"
    }
  },
  "createdAt": "2023-08-01T12:00:00Z",
  "updatedAt": "2023-08-01T12:00:00Z",
  "correlationId": "03b7030f-6da1-4e76-3352-3debd82112c8",
  "transferInstructions": {
    "type": "fiat",
    "transferMessage": "Payment for order #12345",
    "transferBankName": "First National Bank",
    "transferBankAddress": "123 Bank St, Finance City",
    "transferBankAccountNumber": "987654321",
    "transferRoutingNumber": "123456789",
    "transferBankBeneficiaryName": "John Doe",
    "transferIban": "GB29NWBK60161331926819",
    "transferBicSwift": "DEUTDEFF",
    "transferIfscCode": "SBIN0005943",
    "transferSortCode": "40-47-36",
    "transferBsbNumber": "082-902",
    "transferTransitNumber": "12345",
    "transferBankCode": "001",
    "transferClabeNumber": "002010077777777771",
    "transferRoutingCode": "ROUT1234",
    "transferBranchCode": "0001",
    "transferClearingCode": "110000",
    "transferCnapsCode": "102033003330",
    "transferNubanCode": "1234567890",
    "transferPixCode": "user@bank.com",
    "transferPaymentLink": "https://secure.payzen.lat/t/paxsz1d7"
  },
  "expiresAt": "2023-08-01T12:05:00Z"
}

Authorizations

Authorization
string
header
required

To authenticate server-side requests

Headers

x-idempotency-key
string
required

Body

application/json

Schema for creating a new transaction

Schema for creating a new transaction

quoteId
string<uuid>
required

Identifier of the quote to initiate the transaction

Example:

"c88ebfc2-3356-48b5-b2bb-6fca7b618c96"

correlationId
string

Optional: You can add your own correlationId to match the transaction to your own internal records.

Example:

"03b7030f-6da1-4e76-3352-3debd82112c8"

Response

Response schema for a transaction creation request

Response schema for a transaction creation request

transactionId
string<uuid>
required

Unique identifier of the transaction

Example:

"1d8beb26-b4d1-47ee-8e5d-0d3905f200c7"

customerId
string
required

ID of the customer associated with this transaction

Example:

"0423300f-ae6d-4e82-8afb-a3b430e22e29"

quoteId
string
required

ID of the quote used for this transaction

Example:

"1d8beb26-b4d1-47ee-8e5d-0d3905f200c7"

transactionStatus
enum<string>
required

Current status of the transaction

Available options:
AWAITING_TRANSFER,
PROCESSING,
COMPLETED,
FAILED,
CANCELLED,
CREATED,
EXPIRED
Example:

"PROCESSING"

source
object
required
destination
object
required
fees
Fees Schema · object
required

Fee structure for a transaction

createdAt
string
required

ISO timestamp when this transaction was created

Example:

"2023-08-01T12:00:00Z"

updatedAt
string
required

ISO timestamp when this transaction was last updated

Example:

"2023-08-01T12:00:00Z"

correlationId
string

Optional: You can add your own correlationId to match the transaction to your own internal records.

Example:

"03b7030f-6da1-4e76-3352-3debd82112c8"

transferInstructions
Fiat Transfer Instructions · object

Instructions for the customer to initiate the fiat transfer

expiresAt
string

ISO timestamp when this transaction expires (only for AWAITING_TRANSFER status)

Example:

"2023-08-01T12:05:00Z"