API Documentation Outline:


Introduction:

Welcome to our platform for ordering and monitoring digital products! Our platform is designed to provide customers with an efficient and secure solution for managing their digital product needs. The following manual will guide you through the process of accessing and utilizing our API endpoints.

To begin, you will need to have completed the onboarding process and be an authorized customer. Once you have been granted access, you can securely connect to the API using Basic Authentication.

We hope you find our platform and API to be a valuable tool for your digital product needs. If you have any questions or concerns, please refer to the rest of this manual for more information or contact our support team.


Overview of the API:

There are several endpoints for use:

  • product (https://api.supplycharge.net/product) Getting product and pricing information
  • balance (https://api.supplycharge.net/balance) Getting your account balance
  • order (https://api.supplycharge.net/order) Creating and getting orders


Purpose and functionality of the API:

With our  API you can order our products.  

The /product endpoint allows you to retrieve information about products and their prices. This can include the product name, description, price, and other relevant information. By making a request to this endpoint, you can retrieve a list of all available products and their prices. This information can be used to display the products and prices to your users, or to make decisions about which products to offer.

The /balance endpoint allows you to retrieve information about your account balance, which can be useful for tracking your spending and ensuring that you have enough funds to make purchases.

The /order endpoint allows you to create and retrieve orders. You can make a POST request to this endpoint to create a new order, which can include information such as the product to be purchased, the quantity, and the payment information. You can also make a GET request to this endpoint to retrieve information about existing orders, such as the order status, the products purchased, and the delivery information. This functionality allows you to manage the order process, from creating a new order to delivering the products to your customers.

the API provides a comprehensive set of functionalities for retrieving product and pricing information, checking your account balance, and creating and managing orders. This can help streamline your workflow and provide a more seamless experience for your users.

Find your product

With the following curl command, you can retrieve a list of products from our API: 

Example Request:

curl --request GET \
  --url https://api.supplycharge.net/product \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: YOUR API TOKEN',
}’

Example response:

{
    "data": [
        {
            "slug": "netlfix-eur-50",
            "name": "netlfix 50 EUR",
            "facevalue": 50.0,
            "currency": "eur",
            "region": "eu",
            "category": "netflix",
            "mainCategory": "giftcard",
            "priceAmount": 46.84,
            "priceCurrency": "EUR",
            "available": true
        },
        {
            "slug": "playstation-usd-25",
            "name": "playstation 25 EUR",
            "facevalue": 25.0,
            "currency": "eur",
            "region": "es",
            "category": "playstation",
            "mainCategory": "giftcard",
            "priceAmount": 22.03,
            "priceCurrency": "EUR",
            "available": true
        },
        

Filter Products

With the following curl command, you can filter products from the API:

Example request:

curl --request GET \

--url http://api.supplycharge.net/product\

--url http://api.supplycharge.net/product?category=playstation \

- header 'x-api-key: YOUR API TOKEN',

},

Example response

{
    "data": [
        {
            "slug": "playstation-usd-25",
            "name": "playstation 25 EUR",
            "facevalue": 25.0,
            "currency": "eur",
            "region": "es",
            "category": "playstation",
            "mainCategory": "giftcard",
            "priceAmount": 22.03,
            "priceCurrency": "EUR",
            "available": true
        },

Request your current balance

Our API provides you with the ability to check your account balance at any time. To view your current balance, simply make a GET request to our API. This information can be useful for ensuring that you have sufficient funds before making an order, or for tracking your spending over time.

By regularly checking your balance, you can stay informed about your account status and avoid potential issues related to insufficient funds. With just a few clicks, you can access this information and keep your digital product purchases running smoothly.

Example Request:

curl --request GET \\

  --url  \\

  --header 'x-api-token: YOUR API TOKEN',

}

Example response:

Example response

{

    "data": 945.27,

    "status": "OK",

    "message": null
}

Create API order

To place an order for a digital product, you will need to provide the product slug and your API key in the header of your order call. Upon successful submission, you will receive your digital product immediately.

Example Request (Scan code):

curl --request POST \\

{

    "productSlug": "playstation-usd-10",

    "mode":"sandbox",

  --header 'x-api-key: YOUR API TOKEN',

} [

Response remarks. You can change mode to “production.

curl --request POST \\
{

"productSlug": "playstation-usd-10",

"mode":"production",

--header 'x-api-key: YOUR API TOKEN'

} [

Example response:

{

"data": 
{

"orderId": "99c2347a-d730-44b3-b841-82559beb6a8f",

"priceAmount": 12.74,

"priceCurrency": "eur",

"status": "finished",

"codeText": "finished",

"codeSerial": null,

"productSlug": "playstation-usd-10"

},

"status": "OK",

"message": null

}

Get order

Ensure the security of your order information with our API by including valid credentials in the Authorization header of each GET request. The Order/{orderId} endpoint gives you access to all the details of a specific order, allowing you to stay informed and in control.

With a successful GET request, you will receive a comprehensive response containing all the information about the requested order. This includes not just the product details, but also the payment and delivery information, providing you with a complete picture of the order.

Our API is designed to provide quick and convenient access to your order information. Whether you're checking on the progress of a current order or reviewing the details of a completed order, our API offers the information you need, when you need it.

curl --request GET \

--url http://api.supplycharge.net/order/{orderid} \

- header 'x-api-key: YOUR API TOKEN',

Example response

{

    "data": {

        "orderId": "da9f8cab-56d7-4671-a1c0-4de7beb9e641",

        "priceAmount": 9.73,

        "priceCurrency": "eur",

        "status": "finished",

        "codeText": "ACHFD-14K2F3-2DF8MF",

        "codeSerial": null,
},
        "productSlug": "playstation-usd-10"

    },

    "status": "OK",

    "message": null

}

Test Products

Our platform offers a sandbox mode, which provides a testing environment for the order creation process. This mode allows you to verify the correctness of your order creation process without creating actual orders. 

curl --request POST \\

{

    "productSlug": "playstation-usd-10",

    "mode":"sandbox",

  --header 'x-api-key: YOUR API TOKEN',

} [

Error codes

Our API responses use standard HTTP status codes: 2xx status codes indicate success, 4xx status codes indicate invalid input or invalid action on current state, and 5xx status codes indicate a rare error on Personas servers. The response body contains a list of errors with title and details.

HTTP Status Code

Description

400 - Bad Request

The request was unacceptable, often due to invalid parameters.

401 - Unauthorized

An invalid API key was provided.

403 - Forbidden

The given API key doesn't have permissions to perform the request or a quota has been exceeded.

404 - Not Found

The requested resource doesn't exist.

409 - Conflict

The request conflicts with another request, often due to attempting to create a duplicate resource.

422 - Unprocessable Entity

The request modifies the resource in an unacceptable way, often due to an invalid action or parameter.

429 - Too Many Requests

Your organization's rate limit has been exceeded. We recommend an exponential backoff on requests.

500, 502, 503, 504 - Server Errors

Something went wrong on Persona's end. These are rare.