Create
transactions.create(TransactionCreateParams**kwargs) -> TransactionCreateResponse
POST/transactions
Creates a transaction.
Parameters
amount: str
Transaction amount, as a string in the smallest currency unit, such as cents for USD.
external_id: str
User-provided unique ID.
posted: Union[str, datetime]
Timestamp when the transaction was posted. Uses ISO 8601 format.
formatdate-time
Returns
Create
from datetime import datetime
from fragment import Fragment
client = Fragment()
transaction = client.transactions.create(
account={},
allocations=[{
"amount": "1000",
"invoice_id": "inv_abc123",
"type": "invoice_payin",
"user": {
"id": "user_abc123"
},
}],
amount="-1000",
currency="USD",
external_id="bank_txn_123",
posted=datetime.fromisoformat("2024-01-13T00:00:00"),
)
print(transaction.data){
"data": {
"id": "txn_dHhuX2ZyYWdfMDAx",
"account": {
"id": "ext_account_YWJjMTIz",
"external_id": "acct_external_123"
},
"allocations": [
{
"amount": "1000",
"invoice_id": "inv_abc123",
"type": "invoice_payin",
"user": {
"id": "user_abc123",
"external_id": "user_ext_001"
}
}
],
"amount": "-1000",
"created": "2024-01-13T00:00:00Z",
"currency": "USD",
"external_id": "bank_txn_123",
"posted": "2024-01-13T00:00:00Z",
"tags": [
{
"key": "department",
"value": "engineering"
}
],
"unallocated_amount": "-1000",
"version": 1,
"modified": "2024-01-13T00:00:00Z"
}
}Returns Examples
{
"data": {
"id": "txn_dHhuX2ZyYWdfMDAx",
"account": {
"id": "ext_account_YWJjMTIz",
"external_id": "acct_external_123"
},
"allocations": [
{
"amount": "1000",
"invoice_id": "inv_abc123",
"type": "invoice_payin",
"user": {
"id": "user_abc123",
"external_id": "user_ext_001"
}
}
],
"amount": "-1000",
"created": "2024-01-13T00:00:00Z",
"currency": "USD",
"external_id": "bank_txn_123",
"posted": "2024-01-13T00:00:00Z",
"tags": [
{
"key": "department",
"value": "engineering"
}
],
"unallocated_amount": "-1000",
"version": 1,
"modified": "2024-01-13T00:00:00Z"
}
}