Account

In the "Account" section, endpoints for managing user accounts are described.

Retrieve detailed user information.

GET {{BASE_URL}}/api/users/current

Fetches comprehensive information about the currently authenticated user

Headers

NameTypeDescription

Authorization*

String

Bearer Token

{
    "_id": "6548a41138406c14db33b606",
    "email": "john.doe@mail.com",
    "name": "John Doe",
    "createdAt": "2023-11-06T08:30:09.166Z",
    "balance": 0,
    "status": 0,
    "emailVerified": true
}

Update user information

PUT {{BASE_URL}}/api/users/current

Allows users to update their profile information, such as name, email, or other relevant details.

Headers

NameTypeDescription

Authorization*

String

Bearer Token

Request Body

NameTypeDescription

name

String

oldPassword

String

newPassword

String

{
    "email": "john.doe@mail.com",
    "name": "John Doe",
    "createdAt": "2023-11-06T08:30:09.166Z",
    "_id": "6548a41138406c14db33b606"
}

Once the user has been deactivated, access to the application will be blocked, but the user will be able to restore the account.

Deactivate a user

PUT {{BASE_URL}}/api/users/current/deactivate

Deactivates the user's account, rendering it inaccessible while retaining user data.

Headers

NameTypeDescription

Authorization*

String

Bearer Token

{"message": "Account is deactivated"}

Retrieve all notifications for the user.

GET {{BASE_URL}}/api/users/current/notifications

Retrieves all notifications and messages intended for the user.

Headers

NameTypeDescription

Authorization*

String

Bearer Token

[
 {
  "messageType":"invite",
  "message": "You invited to join Dev team."
 }
]

After registering, the customer must add the first payment method (default) for paying invoices. We use Stripe to manage payments. We freeze $1 from the customer to check that the card is active and there are funds, then we return that dollar and add that payment method to the user.

Verify a user

POST {{BASE_URL}}/api/users/current/verify-payment

Confirms and validates a user's selected payment method for future transactions.

Headers

NameTypeDescription

Authorization*

String

Bearer Token

Request Body

NameTypeDescription

paymentMethod

String

Stripe Payment method ID

{
    "status": "ok"
}

Retrieve all payment methods added by the user.

GET {{BASE_URL}}/api/users/current/list-payment-methods

Retrieves a list of all payment methods that the user has added to their account, providing an overview of available payment options for transactions and billing.

Headers

NameTypeDescription

Authorization*

String

Bearer Token

{
    "object": "list",
    "data": [
        {
            "id": "pm_1O9OCiA0ZUrt0vQJ7GqrPclY",
            "object": "payment_method",
            "billing_details": {
                "address": {
                    "city": "Test",
                    "country": "DE",
                    "line1": "test",
                    "line2": "test",
                    "postal_code": "34334",
                    "state": "Test"
                },
                "email": "john.doe@mail.com",
                "name": "John Doe",
                "phone": null
            },
            "card": {
                "brand": "visa",
                "checks": {
                    "address_line1_check": "pass",
                    "address_postal_code_check": "pass",
                    "cvc_check": "pass"
                },
                "country": "US",
                "exp_month": 2,
                "exp_year": 2032,
                "fingerprint": "YxdxFzhKIAGEnLMN",
                "funding": "credit",
                "generated_from": null,
                "last4": "4242",
                "networks": {
                    "available": [
                        "visa"
                    ],
                    "preferred": null
                },
                "three_d_secure_usage": {
                    "supported": true
                },
                "wallet": null
            },
            "created": 1699259440,
            "customer": "cus_OxIokju2aarNVm",
            "livemode": false,
            "metadata": {},
            "type": "card"
        }
    ],
    "has_more": false,
    "url": "/v1/customers/cus_OxIokju2aarNVm/payment_methods"
}

Delete a payment method.

DELETE {{BASE_URL}}/api/users/current/payment-method/{id}

Deletes a specific payment method associated with the user's account.

Path Parameters

NameTypeDescription

id

String

Payment method ID

Headers

NameTypeDescription

Authorization*

String

Bearer Token

{}

This enpoint is required to see detailed information about the user in Stripe.

Retrieve payment account information from Stripe.

GET {{BASE_URL}}/api/users/current/retrieve

Retrieves relevant payment account details for the current user from the Stripe payment gateway.

Headers

NameTypeDescription

Authorization*

String

Bearer Token

{
    "id": "cus_OxIokju2aarNVm",
    "object": "customer",
    "address": {
        "city": "Test",
        "country": "Afghanistan",
        "line1": "Test",
        "line2": "test1",
        "postal_code": "34334",
        "state": "Test"
    },
    "balance": 0,
    "created": 1699259424,
    "currency": "usd",
    "default_source": null,
    "delinquent": false,
    "description": null,
    "discount": null,
    "email": "john.doe@mail.com",
    "invoice_prefix": "B96FCFF5",
    "invoice_settings": {
        "custom_fields": null,
        "default_payment_method": "pm_1O9OCiA0ZUrt0vQJ7GqrPclY",
        "footer": null,
        "rendering_options": null
    },
    "livemode": false,
    "metadata": {},
    "name": "John Doe",
    "phone": null,
    "preferred_locales": [],
    "shipping": null,
    "tax_exempt": "none",
    "test_clock": null
}

Last updated