Transactions
Create Transaction Enterprise
Creates a new transaction.
POST
https://api.basistheory.com/transactionsPermissions
None
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/transactions" \
-H "BT-API-KEY: <API_KEY>" \
-X "POST"
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<API_KEY>");
const transaction = await bt.transactions.create();
using BasisTheory.net.Transactions;
var client = new TransactionClient("<API_KEY>");
var transaction = await client.CreateAsync();
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<API_KEY>");
TransactionsApi apiInstance = new TransactionsApi(defaultClient);
Transaction transaction = apiInstance.create();
}
}
import basistheory
from basistheory.api import transactions_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<API_KEY>")) as api_client:
transactions_client = transactions_api.TransactionsApi(api_client)
transaction = transactions_client.create()
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<API_KEY>"},
})
transaction, httpResponse, err := apiClient.TransactionsApi.Create(contextWithAPIKey).Execute()
}
Response
Returns a transaction object if the transaction was created successfully.
{
"id": "683b3e4a-b50c-4fc2-9dea-c48e544b1603",
"created_at": "2023-05-30T18:12:16.4033481+00:00",
"created_by": "9cce23ec-5848-47c2-8a67-f7539077e423",
"expires_at": "2023-05-30T19:12:16.3826804+00:00"
}
Commit Transaction Enterprise
Commits an open transaction.
POST
https://api.basistheory.com/transactions/{id}/commitPermissions
None
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/transactions/683b3e4a-b50c-4fc2-9dea-c48e544b1603/commit" \
-H "BT-API-KEY: <API_KEY>" \
-X "POST"
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<API_KEY>");
const transactionId = '683b3e4a-b50c-4fc2-9dea-c48e544b1603';
await bt.transactions.commit(transactionId);
using BasisTheory.net.Transactions;
var client = new TransactionClient("<API_KEY>");
var transactionId = Guid.Parse("683b3e4a-b50c-4fc2-9dea-c48e544b1603");
await client.CommitAsync(transactionId);
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<API_KEY>");
TransactionsApi apiInstance = new TransactionsApi(defaultClient);
UUID transactionId = UUID.fromString("683b3e4a-b50c-4fc2-9dea-c48e544b1603");
apiInstance.commit(transactionId);
}
}
import basistheory
from basistheory.api import transactions_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<API_KEY>")) as api_client:
transactions_client = transactions_api.TransactionsApi(api_client)
transaction_id = "683b3e4a-b50c-4fc2-9dea-c48e544b1603";
transactions_client.commit(transaction_id)
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<API_KEY>"},
})
transactionId := "683b3e4a-b50c-4fc2-9dea-c48e544b1603";
httpResponse, err := apiClient.TransactionsApi.Commit(contextWithAPIKey, transactionId).Execute()
}
Response
Returns an empty 200
response when successful.
Rollback Transaction Enterprise
Rolls back an open transaction.
POST
https://api.basistheory.com/transactions/{id}/rollbackPermissions
None
Request
- cURL
- JavaScript
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/transactions/683b3e4a-b50c-4fc2-9dea-c48e544b1603/rollback" \
-H "BT-API-KEY: <API_KEY>" \
-X "POST"
import { BasisTheory } from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<API_KEY>");
const transactionId = '683b3e4a-b50c-4fc2-9dea-c48e544b1603';
await bt.transactions.rollback(transactionId);
using BasisTheory.net.Transactions;
var client = new TransactionClient("<API_KEY>");
var transactionId = Guid.Parse("683b3e4a-b50c-4fc2-9dea-c48e544b1603");
await client.RollbackAsync(transactionId);
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("<API_KEY>");
TransactionsApi apiInstance = new TransactionsApi(defaultClient);
UUID transactionId = UUID.fromString("683b3e4a-b50c-4fc2-9dea-c48e544b1603");
apiInstance.rollback(transactionId);
}
}
import basistheory
from basistheory.api import transactions_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<API_KEY>")) as api_client:
transactions_client = transactions_api.TransactionsApi(api_client)
transaction_id = "683b3e4a-b50c-4fc2-9dea-c48e544b1603";
transactions_client.rollback(transaction_id)
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<API_KEY>"},
})
transactionId := "683b3e4a-b50c-4fc2-9dea-c48e544b1603";
httpResponse, err := apiClient.TransactionsApi.Rollback(contextWithAPIKey, transactionId).Execute()
}
Response
Returns an empty 200
response when successful.
Transaction Object
Attribute | Type | Description |
---|---|---|
id | uuid | The transaction ID |
created_at | date | The date and time the transaction was created, in ISO 8601 format |
created_by | uuid | The Application ID which created the transaction |
expires_at | date | The date and time at which this transaction expires, in ISO 8601 format |