Integration Guide

This guide will explain how to create Customers and associate it with Address, Sub Account and Transaction

Customer Management

You can easily create, update and delete a customer by sending request to the api/v1/customersendpoint:

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/customers \
     -H 'content-type: application/json'
		 -H 'authorization: Bearer <encodedToken>'
		 -d '{
        "name": "Jane Doe",
        "email": "[email protected]",
        "phone": "+23481283011",
        "description": "Any description",
        "address": {
          "city":"Wilmington",
          "country":"United States",
          "state":"Delaware"
        },
        "metaData": {
          "type":"business"
        }
      }'
curl --request POST \
     --url https://developers.bitpowr.com/api/v1/customers \
     -H 'content-type: application/json'
		 -H 'authorization: Bearer <encodedToken>'
		 -d '{
        "name": "Jane Doe",
        "email": "[email protected]",
        "phone": "+23481283011",
        "description": "Any description",
        "address": {
          "city":"Wilmington",
          "country":"United States",
          "state":"Delaware"
        },
        "metaData": {
          "type":"business"
        },
        "emailUnique": true
      }'
curl --request GET \
     --url https://developers.bitpowr.com/api/v1/customers \
     -H 'content-type: application/json'
		 -H 'authorization: Bearer <encodedToken>'
curl --request GET \
     --url https://developers.bitpowr.com/api/v1/customers/<customer_uid> \
     -H 'content-type: application/json'
		 -H 'authorization: Bearer <encodedToken>'
curl --request POST \
     --url https://developers.bitpowr.com/api/v1/customers/<customer_uid> \
     -H 'content-type: application/json'
		 -H 'authorization: Bearer <encodedToken>'
     -d '{
        "name": "Jane Doe",
        "email": "[email protected]",
        "phone": "+23481283011",
        "description": "Any description",
        "address": {
          "city":"Wilmington",
          "country":"United States",
          "state":"Delaware"
        },
        "metaData": {
          "type":"business"
        }
      }'

The response should be as below:

{
    "status": "success",
    "data": {
        "id": 31,
        "uid": "351932bc-96c7-42e4-979e-722ab41e36e1",
        "guid": "33336351-bc0e-4db9-92d9-68b631d14b18",
        "name": "Jane Doe",
        "email": "[email protected]",
        "customerRef": null,
        "externalId": "8beb82ee-a57e-4c60-b10d-c5b74dcac756",
        "description": "Any description",
        "metaData": {
            "type": "business"
        },
        "address": {
            "city": "Wilmington",
            "state": "Delaware",
            "country": "United States"
        },
        "phone": "+23481283011",
        "deletedAt": null,
        "createdAt": "2023-05-20T16:35:47.971Z",
        "updatedAt": "2023-05-20T16:35:47.971Z",
        "organizationId": "93d65302-f671-46ae-9c55-f2b0af3bc874",
        "mode": "TEST"
    }
}
{
    "status": "success",
    "page": 1,
    "totalPages": 2,
    "data": [ {
        "id": 31,
        "uid": "351932bc-96c7-42e4-979e-722ab41e36e1",
        "guid": "33336351-bc0e-4db9-92d9-68b631d14b18",
        "name": "Jane Doe",
        "email": "[email protected]",
        "customerRef": null,
        "externalId": "8beb82ee-a57e-4c60-b10d-c5b74dcac756",
        "description": "Any description",
        "metaData": {
            "type": "business"
        },
        "address": {
            "city": "Wilmington",
            "state": "Delaware",
            "country": "United States"
        },
        "phone": "+23481283011",
        "deletedAt": null,
        "createdAt": "2023-05-20T16:35:47.971Z",
        "updatedAt": "2023-05-20T16:35:47.971Z",
        "organizationId": "93d65302-f671-46ae-9c55-f2b0af3bc874",
        "mode": "TEST"
    }]
}

Things to note here:

  1. Handling Uniqueness: To avoid creating multiple customer with the same name, you can either pass an immutable unique field externalIdor pass emailUniqueto pass a unique name
  2. Customer UID: Customer UID here is the uidin the response.

API Reference

You can view the API reference for integrating Customers API.

Associating Customer

After creating a customer, you will need to pass along the customer uid to the payload when creating address or sub accounts fro that customer.

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/addresses \
     -H 'content-type: application/json'
		 -H 'authorization: Bearer <encodedToken>'
		 -d '{
          "label": "jane",
          "asset": "BTC",
          "accountId": "wallet id",
          "customerId": "351932bc-96c7-42e4-979e-722ab41e36e1"
        }'
curl --request POST \
     --url https://developers.bitpowr.com/api/v1/accounts/{uid}/sub-accounts/{subId}/addresses \
     -H 'content-type: application/json'
		 -H 'authorization: Bearer <encodedToken>'
		 -d '{
          "label": "jane",
          "asset": "BTC",
          "customerId": "351932bc-96c7-42e4-979e-722ab41e36e1"
        }'