Create transaction state
curl --request POST \
--url https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "tx_1234567891",
"state": "cleared",
"type": "CARD_PURCHASE",
"invoice_number": null,
"original_amount": 109.38,
"original_currency": "SEK",
"accounting_amount": 109.38,
"accounting_currency": "SEK",
"exchange_rate": 1,
"vat_rate": 0.25,
"vat_amount": 21.88,
"vat_currency": "SEK",
"purchase_merchant": "Coop Vasagatan",
"purchase_time": "2025-11-17T15:35:11Z",
"purchase_country": "SE",
"purchase_city": "STOCKHOLM",
"mcc_code": "5411",
"merchant_number": "12345678",
"terminal_id": "TERM001",
"rrn": "123456789012",
"auth_code": "A1B2C3"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'tx_1234567891',
state: 'cleared',
type: 'CARD_PURCHASE',
invoice_number: null,
original_amount: 109.38,
original_currency: 'SEK',
accounting_amount: 109.38,
accounting_currency: 'SEK',
exchange_rate: 1,
vat_rate: 0.25,
vat_amount: 21.88,
vat_currency: 'SEK',
purchase_merchant: 'Coop Vasagatan',
purchase_time: '2025-11-17T15:35:11Z',
purchase_country: 'SE',
purchase_city: 'STOCKHOLM',
mcc_code: '5411',
merchant_number: '12345678',
terminal_id: 'TERM001',
rrn: '123456789012',
auth_code: 'A1B2C3'
})
};
fetch('https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states"
payload = {
"id": "tx_1234567891",
"state": "cleared",
"type": "CARD_PURCHASE",
"invoice_number": None,
"original_amount": 109.38,
"original_currency": "SEK",
"accounting_amount": 109.38,
"accounting_currency": "SEK",
"exchange_rate": 1,
"vat_rate": 0.25,
"vat_amount": 21.88,
"vat_currency": "SEK",
"purchase_merchant": "Coop Vasagatan",
"purchase_time": "2025-11-17T15:35:11Z",
"purchase_country": "SE",
"purchase_city": "STOCKHOLM",
"mcc_code": "5411",
"merchant_number": "12345678",
"terminal_id": "TERM001",
"rrn": "123456789012",
"auth_code": "A1B2C3"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states",
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([
'id' => 'tx_1234567891',
'state' => 'cleared',
'type' => 'CARD_PURCHASE',
'invoice_number' => null,
'original_amount' => 109.38,
'original_currency' => 'SEK',
'accounting_amount' => 109.38,
'accounting_currency' => 'SEK',
'exchange_rate' => 1,
'vat_rate' => 0.25,
'vat_amount' => 21.88,
'vat_currency' => 'SEK',
'purchase_merchant' => 'Coop Vasagatan',
'purchase_time' => '2025-11-17T15:35:11Z',
'purchase_country' => 'SE',
'purchase_city' => 'STOCKHOLM',
'mcc_code' => '5411',
'merchant_number' => '12345678',
'terminal_id' => 'TERM001',
'rrn' => '123456789012',
'auth_code' => 'A1B2C3'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"ok": false,
"error": "duplicate_transaction_state"
}Transaction States
Create transaction state
POST
/
api
/
v1
/
issuers
/
{slug}
/
cards
/
{cardId}
/
transaction_states
Create transaction state
curl --request POST \
--url https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "tx_1234567891",
"state": "cleared",
"type": "CARD_PURCHASE",
"invoice_number": null,
"original_amount": 109.38,
"original_currency": "SEK",
"accounting_amount": 109.38,
"accounting_currency": "SEK",
"exchange_rate": 1,
"vat_rate": 0.25,
"vat_amount": 21.88,
"vat_currency": "SEK",
"purchase_merchant": "Coop Vasagatan",
"purchase_time": "2025-11-17T15:35:11Z",
"purchase_country": "SE",
"purchase_city": "STOCKHOLM",
"mcc_code": "5411",
"merchant_number": "12345678",
"terminal_id": "TERM001",
"rrn": "123456789012",
"auth_code": "A1B2C3"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'tx_1234567891',
state: 'cleared',
type: 'CARD_PURCHASE',
invoice_number: null,
original_amount: 109.38,
original_currency: 'SEK',
accounting_amount: 109.38,
accounting_currency: 'SEK',
exchange_rate: 1,
vat_rate: 0.25,
vat_amount: 21.88,
vat_currency: 'SEK',
purchase_merchant: 'Coop Vasagatan',
purchase_time: '2025-11-17T15:35:11Z',
purchase_country: 'SE',
purchase_city: 'STOCKHOLM',
mcc_code: '5411',
merchant_number: '12345678',
terminal_id: 'TERM001',
rrn: '123456789012',
auth_code: 'A1B2C3'
})
};
fetch('https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states"
payload = {
"id": "tx_1234567891",
"state": "cleared",
"type": "CARD_PURCHASE",
"invoice_number": None,
"original_amount": 109.38,
"original_currency": "SEK",
"accounting_amount": 109.38,
"accounting_currency": "SEK",
"exchange_rate": 1,
"vat_rate": 0.25,
"vat_amount": 21.88,
"vat_currency": "SEK",
"purchase_merchant": "Coop Vasagatan",
"purchase_time": "2025-11-17T15:35:11Z",
"purchase_country": "SE",
"purchase_city": "STOCKHOLM",
"mcc_code": "5411",
"merchant_number": "12345678",
"terminal_id": "TERM001",
"rrn": "123456789012",
"auth_code": "A1B2C3"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opencard.io/api/v1/issuers/{slug}/cards/{cardId}/transaction_states",
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([
'id' => 'tx_1234567891',
'state' => 'cleared',
'type' => 'CARD_PURCHASE',
'invoice_number' => null,
'original_amount' => 109.38,
'original_currency' => 'SEK',
'accounting_amount' => 109.38,
'accounting_currency' => 'SEK',
'exchange_rate' => 1,
'vat_rate' => 0.25,
'vat_amount' => 21.88,
'vat_currency' => 'SEK',
'purchase_merchant' => 'Coop Vasagatan',
'purchase_time' => '2025-11-17T15:35:11Z',
'purchase_country' => 'SE',
'purchase_city' => 'STOCKHOLM',
'mcc_code' => '5411',
'merchant_number' => '12345678',
'terminal_id' => 'TERM001',
'rrn' => '123456789012',
'auth_code' => 'A1B2C3'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"ok": false,
"error": "duplicate_transaction_state"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Issuer slug assigned by OpenCard
Your card id from POST /cards
Body
application/json
Available options:
authorized, cleared, invoiced, deleted Available options:
CARD_PURCHASE, CASH_WITHDRAWAL, FEE_AND_DISCOUNT Response
Accepted
⌘I

