Skip to main content

Transactions

Checking on transactions, cancelling transactions, and making a payment.

Create Transaction

To create a transaction, use the /create_transaction route, provide an access token, customer email, amount to pay (in USD), the specific type of crypto currency that will be used, and label.

Curl Example

curl --header "Content-Type: application/json" \ --request POST \ --data '{"access_token": "test_access_token", "email": "[email protected]", "amount": 0.05, "crypto_selected": "MARS", "label": "another_identifier_123456789"}' \ https://quinix.byteconnect.us/create_transaction

Python Example

import requests
from os import getenv


access_token = getenv("access_token")
customer_email = "[email protected]"
payment_amount = 0.05
crypto_ticker_name = "MARS"
label = "another_identifier_123456789"
body = {"access_token" : access_token, "email": customer_email, "amount": payment_amount, "crypto_selected": crypto_ticker_name, "label": label}

url = getenv("bytefederal_api_url")

request = requests.post(f"{url}/create_transaction", json=body)
response = request.json()
print(response)

NodeJs Example

async function CreateTransaction() {
const accessToken = process.env.ACCESSTOKEN;
const customerEmail = "[email protected]";
const payAmount = 0.05;
const cryptoTickerName = "MARS";
const label = "another_identifier_123456789";
const bodyData = {
"access_token": accessToken,
"email": customerEmail,
"amount": payAmount,
"crypto_selected": cryptoTickerName,
"label": label
}
const url = `${process.env.BYTECONNECTURL}/create_transaction`;
const request = await fetch(url, {
method: "POST",
body=JSON,stringify(bodyData),
headers: {
"Content-Type": "application/json"
}
});
const response = await request.json();
console.log(response);
}

HTTP Codes

200

Returns a JSON encoded response with the id, email used, description, wallet address, crypto amount, usd amount, created timestamp, label, crypto currency, status, and qr code.

401

One of the provided payload responses is incorrect.

Checking transaction status

To check a transaction current status, an access token, transaction id, and email needs to be provided.

Curl Example

curl --header "Content-Type: application/json" \ --request POST \ --data '{"access_token": "test_access_token", "transaction_id": 012345}' \ https://quinix.byteconnect.us/check_transaction

Python Example

import requests
from os import getenv

access_token = getenv("access_token")
transaction_id = 012345
body = {"access_token" : access_token, "transaction_id": transaction_id}

url = getenv("bytefederal_api_url")

request = requests.post(f"{url}/check_transaction", json=body)
response = request.json()
print(response)

NodeJs Example

async function CheckTransaction() {
const accessToken = process.env.ACCESSTOKEN;
const transactionID = 012345
const bodyData = {
"access_token": accessToken,
"transaction_id": transactionID
}
const url = `${process.env.BYTECONNECTURL}/check_transaction`;
const request = await fetch(url, {
method: "POST",
body=JSON,stringify(bodyData),
headers: {
"Content-Type": "application/json"
}
});
const response = await request.json();
console.log(response);
}

HTTP Codes

200

Returns a JSON encoded response with the status, transaction id, email, description, wallet address, crypto amount, usd amount, created timestamp in iso string format, label of the transaction, currency selected, and status.

401

One of the payload items provided is incorrect.

Cancelling a transaction

To cancel an ongoing transaction, an access token, and transaction id will need to be provided. After providing these fields, the transaction will change into the state of "Cancelled".

Curl Example

curl --header "Content-Type: application/json" \ --request POST \ --data '{"access_token": "test_access_token", "transaction_id": 0.12345}' \ https://quinix.byteconnect.us/cancel_transaction

Python Example

import requests
from os import getenv


access_token = getenv("access_token")
transaction_id = 012345
body = {"access_token" : access_token, "transaction_id": transaction_id}

url = getenv("bytefederal_api_url")

request = requests.post(f"{url}/cancel_transaction", json=body)
response = request.json()
print(response)

NodeJs Example

async function CancelTransaction() {
const accessToken = process.env.ACCESSTOKEN;
const transactionID = 012345
const bodyData = {
"access_token": accessToken,
"transaction_id": transactionID
}
const url = `${process.env.BYTECONNECTURL}/cancel_transaction`;
const request = await fetch(url, {
method: "POST",
body=JSON,stringify(bodyData),
headers: {
"Content-Type": "application/json"
}
});
const response = await request.json();
console.log(response);
}

HTTP Codes

200

Returns a JSON encoded response with the transaction status being cancelled, and the refresh token.

401

Payload could not be parsed, there is an incorrect field.

Transaction Status Codes

Below are the transaction status codes when using /check_transaction

  • Started: When transaction is created
  • Timedout: After 15 minutes of waiting
  • Cancelled: If the /canceltransaction route is called
  • Pending: Money was received but not confirmed
  • Confirmed: Crypto was confirmed on the blockchain
  • Succeeded: Transaction completed