Customers

This end point handles the customers related to your account

Get all customers

This endpoint gets all account customers

GET

https://api.coinforbarter.com/v1/customers

Sample Response

{
	"status": "success",
	"data": [
		{
			"id": "60bf88fecac9a606fc2f92df",
			"email": "nwachukwu.kingsley01@gmail.com",
			"fullName": "Nwachukwu Tochukwu",
			"phoneNumber": "08145678112",
			"isBlacklisted": false,
			"createdAt": "2021-06-08T15:13:02.687Z"
		},
		"...,"
	],
	"message": "Customers fetched"
}

Get a customer

This endpoint gets a particular customer with id {{customer_id}}

{{customer_id}} is the id gotten from the get all customers end point

GET

https://api.coinforbarter.com/v1/customers/{{customer_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "60bf88fecac9a606fc2f92df",
        "email": "nwachukwu.kingsley01@gmail.com",
        "fullName": "Nwachukwu Tochukwu",
        "phoneNumber": "08145678112",
        "isBlacklisted": false,
        "createdAt": "2021-06-08T15:13:02.687Z"
    },
    "message": "Customer fetched"
}

Create customer

This endpoint creates a customer for your account

POST

https://api.coinforbarter.com/v1/customers

Body params

email (text)

Email of the customer that will be created

fullName (text)

Full name of the customer

phoneNumber (text)

Customers phone number

isBlacklisted (text)

(optional) if the customer created should be black listed

Sample Response

{
    "status": "success",
    "data": {
        "id": "60bfc090ffeeb84f049044bc",
        "email": "nwachukwu.tochukwu01@gmail.com",
        "fullName": "Nwachukwu Tochukwu",
        "phoneNumber": "08145678112",
        "isBlacklisted": false,
        "createdAt": "2021-06-08T19:10:08.670Z"
    },
    "message": "Customers fetched"
}

Update

This endpoint updates a customer information. {{customer_id}} is the id gotten from the get all customers end point

PATCH

https://api.coinforbarter.com/v1/customers/{{customer_id}}

Body params

phoneNumber (text)

New customer phone number to be updated with

isBlacklisted (text)

A boolean if the customer should be blacklisted.

fullName (text)

Name to update the customer

email (text)

New customer email to be updated

Sample Response

{
    "status": "success",
    "data": {
        "id": "60bf88fecac9a606fc2f92df",
        "email": "nwachukwu.kingsley01@gmail.com",
        "fullName": "Nwachukwu Tochukwu",
        "phoneNumber": "+2348145678112",
        "isBlacklisted": true,
        "createdAt": "2021-06-08T15:13:02.687Z"
    },
    "message": "Customer updated"
}

Bank accounts

This end point handles the bank accounts related to your account

get account name

This endpoints is to validate the full name of a bank account

POST

https://api.coinforbarter.com/v1/bank-accounts/account/name

Body params

accountNumber (text)

Account Number of the bank to get the account name

accountBank (text)

Bank code of the bank to get the account name

create

This endpoint creates a bank account

POST

https://api.coinforbarter.com/v1/bank-accounts

Body params

accountNumber (text)

Account Number to be added

accountBank (text)

Bank Name

country (text)

Country of the bank account

currency (text)

Currency code of the account(see get all currency endpoint)

accountName (text)

Account Name

get all

This endpoint gets all bank accounts

GET

https://api.coinforbarter.com/v1/bank-accounts

Query params

from

start date query

to

end date query

isPrimary

a boolean value to determinine if you want to filter by primary bank accounts or not.

page

The page you want to query

country

currency

skip

the number of rows per page

accountBank

Body params

accountNumber (text)

accountBank (text)

country (text)

currency (text)

accountName (text)

get one

A request to get one bank account of id {{bank_account_id}}. {{bank_account_id}} is the id of bank count gotten from get all bank accounts endpoint

GET

https://api.coinforbarter.com/v1/bank-accounts/{{bank_account_id}}

Body params

accountNumber (text)

accountBank (text)

country (text)

currency (text)

accountName (text)

make primary

A request to make a bank account of id {{bank_account_id}} primary i.e. Main bank account. {{bank_account_id}} is the id of bank count gotten from get all bank accounts endpoint

GET

https://api.coinforbarter.com/v1/bank-accounts/primary/{{bank_account_id}}

Body params

accountNumber (text)

accountBank (text)

country (text)

currency (text)

accountName (text)

delete

A request to delete a bank account of id {{bank_account_id}}. {{bank_account_id}} is the id of bank count gotten from get all bank accounts endpoint

DELETE

https://api.coinforbarter.com/v1/bank-accounts/account/archive/{{bank_account_id}}

all banks

This endpoint returns all bank account in a particular country with code {{country_code}}. {{country_code}} is the country code gotten from get all country endpoints.

GET

https://api.coinforbarter.com/v1/bank-accounts/banks/{{country_code}}

Misc

Get Countries

This endpoint return all Countries

GET

https://api.coinforbarter.com/v1/countries

Sample Response

{
	"status": "success",
	"data": [
		{
			"name": "Afghanistan",
			"code": "AF",
			"flag": "https://restcountries.eu/data/afg.svg"
		},
		{
			"name": "Åland Islands",
			"code": "AX",
			"flag": "https://restcountries.eu/data/ala.svg"
		},
		{
			"name": "Albania",
			"code": "AL",
			"flag": "https://restcountries.eu/data/alb.svg"
		},
		"...,"
	],
	"message": "Countries fetched"
}

Get Wallet Balances

This endpoint returns all your balances of relating to currencies

GET

https://api.coinforbarter.com/v1/balances

Sample Response

{
	"status": "success",
	"data": [
		{
			"currency": "NGN",
			"availableBalance": 0,
			"totalBalance": 0,
			"isSuspended": false
		},
		{
			"currency": "USD",
			"availableBalance": 0,
			"totalBalance": 0,
			"isSuspended": false
		},
		{
			"currency": "BTC",
			"availableBalance": 0.027595539999999998,
			"totalBalance": 0.03153776,
			"isSuspended": false
		},
		"...,"
	],
	"message": "Wallet balances fetched"
}

Get Currencies

This endpoint return all currencies supported

GET

https://api.coinforbarter.com/v1/currencies

Payment Plans

This end point handles the payment plans related to your account

Misc

This endpoint returns the types of frequency or intervals of the payment plan supported by CoinForBarter

GET

https://api.coinforbarter.com/v1/payment-plans/misc

Sample Response

{
    "status": "success",
    "data": {
        "frequencies": [
            "hourly",
            "weekly",
            "daily",
            "monthly",
            "quarterly",
            "every six months",
            "yearly"
        ]
    },
    "message": "Payment Plans Resources fetched"
}

Create

This endpoint creates a payment plan

POST

https://api.coinforbarter.com/v1/payment-plans

Body params

frequency (text)

The type of frequency (Choose any one from the Frequency response in the get payment-plans/misc endpoint)

planName (text)

name of the plan to create

numberOfTimesToCharge (text)

Number of time to charge customer on this plan in the inputted frequency

amount (text)

Amount to charge per time

currency (text)

Base currency for the payment i.e. the currency of the amount

currencies[] (text)

An array of currencies to accept for payment

currencies[] (text)

An array of currencies to accept for payment

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c49c179f5a561ac87abab7",
        "isActive": true,
        "currencies": [
            "BTC",
            "DOGE"
        ],
        "currency": "BTC",
        "amount": 0.001,
        "numberOfTimesToCharge": 4,
        "frequency": "weekly",
        "planName": "Weekly contributuion"
    },
    "message": "Payment plan created"
}

Find all

Returns all payment plans

GET

https://api.coinforbarter.com/v1/payment-plans

Query params

from

Date to start sort

to

Date to end sort

currency

Filter the get all by currency

page

Numbers of page

Sample Response

{
	"status": "success",
	"data": [
		{
			"id": "60c3f88312208524d4aa6529",
			"isActive": true,
			"currencies": [
				"BTC",
				"DOGE"
			],
			"currency": "BTC",
			"amount": 0.001,
			"numberOfTimesToCharge": 4,
			"frequency": "weekly",
			"planName": "Weekly contributuion"
		},
		{
			"id": "60c49c179f5a561ac87abab7",
			"isActive": true,
			"currencies": [
				"BTC",
				"DOGE"
			],
			"currency": "BTC",
			"amount": 0.001,
			"numberOfTimesToCharge": 4,
			"frequency": "weekly",
			"planName": "Weekly contributuion"
		},
		"...,"
	],
	"message": "Payment plans fetched"
}

Find One

This endpoint returns a payment plan with id {{payment_plan_id}}. {{payment_plan_id}} is the id gotten from get all payment-plans endpoint

GET

https://api.coinforbarter.com/v1/payment-plans/{{payment_plan_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c3f6081a571e32bcaba779",
        "isActive": false,
        "currencies": [
            "BTC",
            "DOGE"
        ],
        "currency": "BTC",
        "amount": 2,
        "numberOfTimesToCharge": 4,
        "frequency": "weekly",
        "planName": "Weekly contributuion"
    },
    "message": "Payment plan fetched"
}

Update

PATCH

https://api.coinforbarter.com/v1/payment-plans/{{payment_plan_id}}

Body params

amount (text)

isActive (text)

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c3f6081a571e32bcaba779",
        "isActive": "false",
        "currencies": [
            "BTC",
            "DOGE"
        ],
        "currency": "BTC",
        "amount": "2",
        "numberOfTimesToCharge": 4,
        "frequency": "weekly",
        "planName": "Weekly contributuion"
    },
    "message": "Payment plan updated"
}

Payment Plan Subscribers

This end point handles the payment plan subscribers related to your account

Create

This is a post request to subscribe to one of your payment plan with id {{payment_plan_id}}. {{payment_plan_id}} is the id gotten from get all payment-plans endpoint

POST

https://api.coinforbarter.com/v1/payment-plan-subscribers/{{payment_plan_id}}

Body params

email (text)

email of the sucriber to the payment pan

Sample Response

{
    "status": "success",
    "message": "Subscription activated"
}

Find all

This endpoint return list of all subscribers

GET

https://api.coinforbarter.com/v1/payment-plan-subscribers

Query params

from

start date query

to

end date query

page

the page you want to query

customer

the email address of a customer to query

isActive

a boolean value to determinine if you want to filter by active subscribers or not

Sample Response

{
	"status": "success",
	"data": [
		{
			"id": "60c40e074911af3dfcd947cc",
			"isActive": false,
			"noOfTimesPayed": 0,
			"paymentPlanId": "60c3f88312208524d4aa6529",
			"accountId": "60bf7ebb4237a24750c41b99",
			"customerId": "60bf88fecac9a606fc2f92df",
			"createdAt": "2021-06-12T01:29:43.805Z"
		},
		{
			"id": "60c410886f24e624e46ab216",
			"isActive": true,
			"noOfTimesPayed": 0,
			"paymentPlanId": "60c3f88312208524d4aa6529",
			"accountId": "60bf7ebb4237a24750c41b99",
			"customerId": "60bf88fecac9a606fc2f92df",
			"createdAt": "2021-06-12T01:40:24.876Z"
		},
		"...,"
	],
	"message": "Subscribers fetched"
}

Find One

This endpoint returns list of all subscribers with id {{payment_plan_subscriber_id}}. {{payment_plan_subscriber_id}} is the id gotten from get all payment-plans-subscribers endpoint

GET

https://api.coinforbarter.com/v1/payment-plan-subscribers/{{payment_plan_subscriber_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c40e074911af3dfcd947cc",
        "isActive": false,
        "noOfTimesPayed": 0,
        "paymentPlanId": "60c3f88312208524d4aa6529",
        "customerId": "60bf88fecac9a606fc2f92df",
        "createdAt": "2021-06-12T01:29:43.805Z"
    },
    "message": "Subscriber fetched"
}

Remove

This endpoint deletes subscriber with id {{payment_plan_subscriber_id}} from your subscribers list. {{payment_plan_subscriber_id}} is the id gotten from get all payment-plans-subscribers endpoint

DELETE

https://api.coinforbarter.com/v1/payment-plan-subscribers/{{payment_plan_subscriber_id}}

Sample Response

Wallet Addresses

This end point is for wallet addresses.

Wallet addresses are used for making withdrawals.

When you request a withdrawal, you can select from any of these addresses for that withdrawal.

create

This end point creates a new wallet address on your account

POST

https://api.coinforbarter.com/v1/wallet-addresses

Body params

address (text)

* Address of the wallet

currency (text)

* This is the currency for this wallet address

isPrimary (text)

If the wallet should be the primary wallet

network (text)

This is the network of the address

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c758c0d28c3f0600d9bdab",
        "isPrimary": false,
        "network": "bitcoin",
        "currency": "BTC",
        "address": "1BvBMSEYstWetqTFn5Au4m------------",
        "createdAt": "2021-06-14T13:25:20.933Z"
    },
    "message": "Wallet address created successfully"
}

get all

This endpoint get all wallet addresses attached to your account

GET

https://api.coinforbarter.com/v1/wallet-addresses

Query params

from

start date query

to

end date query

isPrimary

a boolean value to determinine if you want to filter by primary wallet adresses or not.

page

the page you want to query

network

a blockchain network to query

currency

a currency to query

skip

the number of rows per page

address

a wallet address to query

label

a wallet address label to query

Body params

accountNumber (text)

accountBank (text)

country (text)

currency (text)

accountName (text)

Sample Response

{
	"status": "success",
	"data": [
		{
			"id": "60c73d53a4603a21a8e06652",
			"isPrimary": false,
			"network": "",
			"currency": "bitcoin",
			"address": "1BvBMSEYstWetqTFn5Au4m------------",
			"createdAt": "2021-06-14T11:28:19.985Z"
		},
		{
			"id": "60c758c0d28c3f0600d9bdab",
			"isPrimary": false,
			"network": "bitcoin",
			"currency": "BTC",
			"address": "1BvBMSEYstWetqTFn5Au4m------------",
			"createdAt": "2021-06-14T13:25:20.933Z"
		},
		"...,"
	],
	"message": "Wallet addresses fetched"
}

Get One

This endpoint get wallet of id {{wallet_address_id}}. {{wallet_address_id}} is the id of the wallet gotten from get all wallet endpoint

GET

https://api.coinforbarter.com/v1/wallet-addresses/{{wallet_id}}

Body params

(text)

(text)

(text)

(text)

(text)

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c73d53a4603a21a8e06652",
        "isPrimary": false,
        "network": "",
        "currency": "bitcoin",
        "address": "1BvBMSEYstWetqTFn5Au4m------------",
        "createdAt": "2021-06-14T11:28:19.985Z"
    },
    "message": "Wallet address fetched"
}

make primary

This endpoint makes the wallet address of id {{wallet_address_id}} Primary {{wallet_address_id}} is the id of the wallet gotten from get all wallet endpoint

GET

https://api.coinforbarter.com/v1/wallet-addresses/primary/{{wallet_address_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c73d53a4603a21a8e06652",
        "isPrimary": true,
        "network": "",
        "currency": "bitcoin",
        "address": "1BvBMSEYstWetqTFn5Au4m------------",
        "createdAt": "2021-06-14T11:28:19.985Z"
    },
    "message": "Wallet address is now primary"
}

Transfers

Create

This end point creates a new transfers on your account

POST

https://api.coinforbarter.com/v1/transfers

Body params

amount (text)

Amount to transfer

currency (text)

Currency to Transfer in

walletAddress (text)

walletNetwork (text)

Sample Response

{
    "status": "success",
    "data": {
        "id": "60d3eab01bb01255483aff4a",
        "status": "pending",
        "amount": 50,
        "fee": 10,
        "currency": "NGN",
        "updatedAt": "2021-06-24T02:15:12.349Z",
        "createdAt": "2021-06-24T02:15:12.349Z"
    },
    "message": "transfer request sent successfully"
}

Get Fee

POST

https://api.coinforbarter.com/v1/transfers/fee

Body params

amount (text)

currency (text)

walletAddress (text)

walletNetwork (text)

Sample Response

{
    "status": "success",
    "data": {
        "currency": "NGN",
        "amount": 10
    },
    "message": "Fee fetched Successfully"
}

Get one

GET

https://api.coinforbarter.com/v1/transfers/{{transfer_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "60d3eab01bb01255483aff4a",
        "status": "pending",
        "amount": 50,
        "fee": 10,
        "currency": "NGN",
        "updatedAt": "2021-06-24T02:15:12.349Z",
        "createdAt": "2021-06-24T02:15:12.349Z"
    },
    "message": "transfer request sent successfully"
}

Get ALL

GET

https://api.coinforbarter.com/v1/transfers

Query params

from

to

page

skip

Sample Response

{
	"status": "success",
	"data": [
		{
			"id": "60d3eab01bb01255483aff4a",
			"status": "pending",
			"amount": 50,
			"fee": 10,
			"currency": "NGN",
			"updatedAt": "2021-06-24T02:15:12.349Z",
			"createdAt": "2021-06-24T02:15:12.349Z"
		},
		"...,"
	],
	"message": "transfers fetched"
}

Payouts

Get all

GET

https://api.coinforbarter.com/v1/payouts

Query params

from

Date to sort from

to

Date to sort to

page

currency

status

sort

field to sort with

minAmount

minimum amount to sort from

maxAmount

maxAmount to sort to

bankAccount

Bank account id of which payout was made to

address

Wallet address id of which payout was made to

isAscending

if its ascending or not

skip

Number per role

Get one

GET

https://api.coinforbarter.com/v1/payouts/{{payout_id}}

Payments

This handles payments.

The payment endpoints can be authorized by both public key and private key.

Use /payments/checkout when using public keys.

You can handle a complete payment flow by following the steps below;

  • Create a payment
  • Set a currency for that payment
  • Lock the currency.
  • Send payment to the address provided
  • Verify the payment via webhook or using the verify payment or transaction endpoint.

Payment Object


  • id - the id of the payment.
  • status - the present status of the payment - in progress, error, cancelled, success.
  • description - The description of the payment.
  • txRef - the txRef provided while creating the payment for your reference.
  • redirectUrl - a url to redirect to after the payment ends.
  • fee - the total CoinForBarter Fee for this payment.
  • currency - the selected currency to make payment in.
  • currencyNetwork the selected currency network to make payment in.
  • amount - the amount to be paid in the selected currency.
  • nairaValue - total amountReceived in naira at time it was received.
  • dollarValue - total amountReceived in dollar at time it was received.
  • baseAmount - the amount to which this payment was created.
  • baseCurrency - the currency to which the amount of this payment was created.
  • currencies - the list of currencies acceptable for this payment.
  • expiresBy - the expiry time of this payment.
  • customer - the email address of the customer.
  • customerDetails - an object containing the other details of the customer - phoneNumber, fullName.
  • addressInformation - an object containing the crypto address to which payment will be made - address, network.
  • transactionTimeLog - an array of objects containing the log of events on this payment-time (time of event), type (if the event was a success or error), event (description of event).
  • isCurrencyLocked - a boolean value telling if the currency to make this payment in has been locked.
  • createdAt - the time this payment was created.
  • branding an object containing branding information set from your dashboard - businessName, name, logo.

Create

This endpoint creates a new payment.

Use /payments/checkout to create a payment using your public key for authorization

POST

https://api.coinforbarter.com/v1/payments/checkout

Body params

customer (text)

This is an object has some of the customer information like customerName, customerEmail etc.

txRef (text)

This is a transaction reference you supply to identify different transactions on your account. It is important to ensure that you pass unique references for every transaction

baseCurrency (text)

The base currency you are trying to pay with.

amount (text)

This is the amount in the base currency you are trying to pay with

customerFullName (text)

customerphoneNumber (text)

redirectUrl (text)

(text)

Sample Response

{
    "status": "success",
    "data": {
        "payment": {
            "id": "613a1067500d0f0020adf882",
            "_id": "613a1067500d0f0020adf882",
            "status": "in progress",
            "description": "Payment from Dayne_OKon@gmail.com",
            "txRef": "hrgyuur743784",
            "redirectUrl": "",
            "amount": 0,
            "nairaValue": 0,
            "dollarValue": 0,
            "baseAmount": 0.01,
            "baseCurrency": "BTC",
            "currencies": [
                "BTC",
                "DOGE",
                "ETH",
                "USDT",
                "USDC",
                "BUSD",
                "DAI",
                "PAX",
                "BCH",
                "WBTC"
            ],
            "expiresBy": 0,
            "transactionFees": 0,
            "totalDue": 0,
            "customer": "Dayne_OKon@gmail.com",
            "customerDetails": {
                "email": "Dayne_OKon@gmail.com",
                "fullName": ""
            },
            "addressSentFrom": [],
            "transactionTimeLog": [
                {
                    "time": "2021-09-09T13:47:19.098Z",
                    "type": "event",
                    "event": "Started transaction"
                }
            ],
            "isCurrencyLocked": false,
            "createdAt": "2021-09-09T13:47:19.100Z"
        },
        "url": "https://coinforbarter-checkout.herokuapp.com/v1/api-pay/6109aa97-ad5bab00-1b913f89-613a1067-500d0f00-20adf882"
    },
    "message": "payment created"
}

Get One

This endpoint gets the details of a payment

GET

https://api.coinforbarter.com/v1/payments/{{payment_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "613a1067500d0f0020adf882",
        "status": "in progress",
        "description": "Payment from Dayne_OKon@gmail.com",
        "txRef": "hrgyuur743784",
        "redirectUrl": "",
        "amount": 0,
        "nairaValue": 0,
        "dollarValue": 0,
        "baseAmount": 0.01,
        "baseCurrency": "BTC",
        "currencies": [
            "BTC",
            "DOGE",
            "ETH",
            "USDT",
            "USDC",
            "BUSD",
            "DAI",
            "PAX",
            "BCH",
            "WBTC"
        ],
        "expiresBy": 0,
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "Dayne_OKon@gmail.com",
        "customerDetails": {
            "email": "Dayne_OKon@gmail.com",
            "fullName": ""
        },
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021-09-09T13:47:19.098Z",
                "type": "event",
                "event": "Started transaction"
            }
        ],
        "isCurrencyLocked": false,
        "createdAt": "2021-09-09T13:47:19.100Z",
        "branding": {
            "businessName": "Wear Yourself (WYs)",
            "updatedAt": "2021-08-03T20:44:07.543Z",
            "createdAt": "2021-08-03T20:44:07.543Z",
            "name": "Wear Yourself (WYs)",
            "_id": "6109aa97ad5bab001b913f89"
        }
    },
    "message": "transfers fetched"
}

Cancel

This endpoint cancels a payment

PATCH

https://api.coinforbarter.com/v1/payments/{{payment_id}}/cancel

Sample Response

{
    "status": "success",
    "message": "payment cancelled"
}

Lock Currency

PATCH

https://api.coinforbarter.com/v1/payments/{{payment_id}}/currency/lock

Sample Response

{
    "status": "success",
    "data": {
        "id": "60d461fe6410f43ce05be378",
        "status": "in progress",
        "description": "Payment from Jody_Wolff21@hotmail.com",
        "txRef": "hrgyuur743784",
        "fee": 0.00030047,
        "currency": "BTC",
        "currencyNetwork": "bitcoin",
        "amount": 0.01030047,
        "baseAmount": 0.01,
        "baseCurrency": "BTC",
        "currencies": [],
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "Jody_Wolff21@hotmail.com",
        "customerDetails": {
            "email": "Jody_Wolff21@hotmail.com"
        },
        "addressInformation": {
            "address": "19xqUGJ5Keo1LjDfatShxfHcKQT6HV24x3",
            "network": "bitcoin",
            "id": "60c7ca61ef2a380a447ed864"
        },
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021-06-24T10:44:14.787Z",
                "type": "event",
                "event": "Started transaction"
            },
            {
                "time": "2021-06-24T10:44:54.905Z",
                "type": "event",
                "event": "set currency to BTC, bitcoin"
            },
            {
                "time": "2021-06-24T10:45:40.482Z",
                "type": "event",
                "event": "locked currency"
            },
            {
                "time": "2021-06-24T10:54:07.229Z",
                "type": "event",
                "event": "locked currency"
            }
        ],
        "isCurrencyLocked": true,
        "createdAt": "2021-06-24T10:44:14.788Z"
    },
    "message": "currency locked"
}

Set Currency

This endpoint sets a currency for this payment.

  • {{currency}} is the chosen currency to use for this transaction
  • {{network}} is the network option of the currency you want to pay in.

Get the list of currencies and networks from the /currencies endpoint

PATCH

https://api.coinforbarter.com/v1/payments/{{payment_id}}/currency/set/{{currency}}/{{network}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "60d45df8d64c3a0b74d1ea3a",
        "status": "in progress",
        "description": "Payment from Kale41@hotmail.com",
        "txRef": "hrgyuur743784",
        "currency": "BTC",
        "currencyNetwork": "bitcoin",
        "baseAmount": 0.01,
        "baseCurrency": "BTC",
        "currencies": [],
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "Kale41@hotmail.com",
        "customerDetails": {
            "email": "Kale41@hotmail.com"
        },
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021-06-24T10:27:04.477Z",
                "type": "event",
                "event": "Started transaction"
            },
            {
                "time": "2021-06-24T10:37:08.227Z",
                "type": "event",
                "event": "set currency to BTC, bitcoin"
            }
        ],
        "isCurrencyLocked": false,
        "createdAt": "2021-06-24T10:27:04.483Z"
    },
    "message": "currency set"
}

Transactions

Get all

This endpoint return all transactions associated with your account

GET

https://api.coinforbarter.com/v1/transactions

Sample Response

{
	"status": "success",
	"data": [
		{
			"id": "60c78889f3185f4a64b95356",
			"status": "in progress",
			"description": "Payment from anonymous",
			"baseAmount": 0.1,
			"baseCurrency": "BTC",
			"currencies": [
				"BTC",
				"DOGE"
			],
			"transactionFees": 0,
			"totalDue": 0,
			"customer": "anonymous",
			"addressSentFrom": [],
			"transactionTimeLog": [
				{
					"time": "2021-06-14T16:49:13.079Z",
					"type": "event",
					"event": "Started transaction"
				}
			],
			"isCurrencyLocked": false,
			"createdAt": "2021-06-14T16:49:13.189Z"
		},
		{
			"id": "60c7894ffa4bf515485bd61e",
			"status": "in progress",
			"description": "Payment from anonymous",
			"baseAmount": 0.1,
			"baseCurrency": "BTC",
			"currencies": [
				"BTC",
				"DOGE"
			],
			"transactionFees": 0,
			"totalDue": 0,
			"customer": "anonymous",
			"addressSentFrom": [],
			"transactionTimeLog": [
				{
					"time": "2021-06-14T16:52:31.412Z",
					"type": "event",
					"event": "Started transaction"
				}
			],
			"isCurrencyLocked": false,
			"createdAt": "2021-06-14T16:52:31.517Z"
		},
		{
			"id": "60c78aa31e3c2f22d034d249",
			"status": "in progress",
			"description": "Payment from anonymous",
			"baseAmount": 0.1,
			"baseCurrency": "BTC",
			"currencies": [
				"BTC",
				"DOGE"
			],
			"transactionFees": 0,
			"totalDue": 0,
			"customer": "anonymous",
			"addressSentFrom": [],
			"transactionTimeLog": [
				{
					"time": "2021-06-14T16:58:11.101Z",
					"type": "event",
					"event": "Started transaction"
				}
			],
			"isCurrencyLocked": false,
			"createdAt": "2021-06-14T16:58:11.141Z"
		},
		"...,"
	],
	"message": "transactions fetched"
}

Get one

POST

https://api.coinforbarter.com/v1/transactions/{{transaction_id}}/webhook

Sample Response

{
    "status": "success",
    "message": "hook sent successfully"
}

Verify

To verify a transaction before giving out value,

  • confirm that the baseAmount, baseCurrency are equal to amount and currency you had sent.
  • confirm that the amountReceived is equal to the amount on the transaction object

GET

https://api.coinforbarter.com/v1/transactions/{{transaction_id}}/verify

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c78889f3185f4a64b95356",
        "status": "in progress",
        "description": "Payment from anonymous",
        "baseAmount": 0.1,
        "baseCurrency": "BTC",
        "currencies": [
            "BTC",
            "DOGE"
        ],
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "anonymous",
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021-06-14T16:49:13.079Z",
                "type": "event",
                "event": "Started transaction"
            }
        ],
        "isCurrencyLocked": false,
        "createdAt": "2021-06-14T16:49:13.189Z"
    },
    "message": "transaction fetched"
}

Get Transaction Time Log

GET

https://api.coinforbarter.com/v1/transactions/{{transaction_id}}/events

Sample Response

{
	"status": "success",
	"data": [
		{
			"time": "2021-06-14T16:49:13.079Z",
			"type": "event",
			"event": "Started transaction"
		},
		"...,"
	],
	"message": "transaction events fetched"
}

Get fee

GET

https://api.coinforbarter.com/v1/transactions/{{transaction_id}}/fee

Sample Response

{
    "status": "success",
    "data": {
        "fee": 0,
        "nairaValue": 0,
        "dollarValue": 0,
        "amountReceived": 0,
        "baseAmount": 0.1,
        "baseCurrency": "BTC"
    },
    "message": "transaction events fetched"
}

Get one

GET

https://api.coinforbarter.com/v1/transactions/{{transaction_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "60c78889f3185f4a64b95356",
        "status": "in progress",
        "description": "Payment from anonymous",
        "baseAmount": 0.1,
        "baseCurrency": "BTC",
        "currencies": [
            "BTC",
            "DOGE"
        ],
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "anonymous",
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021-06-14T16:49:13.079Z",
                "type": "event",
                "event": "Started transaction"
            }
        ],
        "isCurrencyLocked": false,
        "createdAt": "2021-06-14T16:49:13.189Z"
    },
    "message": "transaction fetched"
}

Wallets

Create and manage wallets.

you will get notified via webhooks when a wallet you have created receives a transaction.

Find all

GET

https://api.coinforbarter.com/v1/wallets

Query params

currency

label

Sample Response

{
	"status": "success",
	"data": [
		{
			"id": "62ecf0816d336e5a2cce6330",
			"label": "user2",
			"currency": "USDT",
			"addresses": [
				{
					"network": "ERC20",
					"address": "0x1Cc166c754507B409352283bD7BA5d39a2026154"
				},
				{
					"network": "BEP20",
					"address": "0xA2e31D7b1A15b6eD76165014123A174244fb14E4"
				}
			],
			"createdAt": "2022-08-05T10:27:13.744Z"
		},
		"...,"
	],
	"message": "Wallets fetched"
}

Find One

GET

https://api.coinforbarter.com/v1/wallets/{{wallet_id}}

Sample Response

{
    "status": "success",
    "data": {
        "id": "62ecef27f6986e41345ae204",
        "label": "user1",
        "currency": "USDT",
        "addresses": [
            {
                "network": "ERC20",
                "address": "0x9Cf64769d63c569366f05c12c669F0c7d9b5DecA"
            },
            {
                "network": "BEP20",
                "address": "0xA5B2d6e38E0E74EFDcF938195c3678A58be4c76f"
            }
        ],
        "createdAt": "2022-08-05T10:21:27.978Z"
    },
    "message": "Wallet fetched"
}

Create

POST

https://api.coinforbarter.com/v1/wallets

Body params

currency (text)

label (text)

Sample Response

{
    "status": "success",
    "data": {
        "id": "62ecf0816d336e5a2cce6330",
        "label": "user2",
        "currency": "USDT",
        "addresses": [
            {
                "network": "ERC20",
                "address": "0x1Cc166c754507B409352283bD7BA5d39a2026154"
            },
            {
                "network": "BEP20",
                "address": "0xA2e31D7b1A15b6eD76165014123A174244fb14E4"
            }
        ],
        "createdAt": "2022-08-05T10:27:13.744Z"
    },
    "message": "Wallet created successfully"
}
{
    "message": "validation error",
    "data": {
        "errors": {
            "label": [
                "The label field is required."
            ]
        }
    },
    "status": "error"
}

Delete

This will delete the wallet and you will stop getting updates when this wallet receives a transaction

DELETE

https://api.coinforbarter.com/v1/wallets/{{wallet_id}}

Sample Response