Terraswitch
  • Terraswitch - Get Started
  • Test & Live Environments
  • Onboarding as a Business
  • GUIDES
    • 🎾Authentication
    • 🧀Webhooks
    • 🫓Status & Responses
    • 🏉API Rate Limits
    • 🚀Transactions & Destinations
    • 🍊Testing Credentials
    • 🚐Crafting Metadata
  • API ENDPOINTS
    • Account
      • Get Account Details
      • Get Banks
      • Get Beneficiaries
      • Add Bank
      • Change Settlement Bank
    • Wallet
      • Get Wallet Details
      • Get Wallet Transactions
    • Collections
      • Checkout
        • Initialize Transaction
      • Transfer
        • Generate Account
      • Charge
        • Create Charge
        • Authorize Charge
        • Charge Authorization
      • Bank
        • Pay with Opay
    • Payout
      • Bank Transfer
      • Withdraw Money
    • Products
      • List Products
      • Search Products
      • Filter Products
      • Fetch Product
      • Create Product
      • Update Product
    • Subaccounts
      • List Subaccounts
      • Search Subaccounts
      • Filter Subaccounts
      • Fetch Subaccount
      • Create Subaccount
      • Update Subaccount
    • Payment Links
      • List Payment Links
      • List Payment Link Transactions
      • Search Payment Links
      • Filter Payment Links
      • Fetch Payment Link
      • Create Payment Link
      • Update Payment Link
      • Attach Payment Resource
      • Remove Subaccount
      • Enable Payment Link
      • Disable Payment Link
    • Invoices
      • List Invoices
      • Search Invoices
      • Filter Invoices
      • Fetch Invoice
      • Create Invoice
      • Update Invoice
      • Remove Invoice Item
    • Transactions
      • List Transactions
      • Search Transactions
      • Filter Transactions
      • Verify Transaction
    • Refunds
      • List Refunds
      • Fetch Refund
      • Create Refund
    • Bills Payment
      • List Mobile Networks
      • List Bill Categories
      • List Bill Sub-Categories
      • List Mobile Data Plans
      • Validate Biller
      • Validate Bill Status
      • Validate Top-Up Status
      • Buy Airtime
      • Buy Data
      • Pay Bill
    • Resources
      • List Banks
      • List Countries
      • Resolve Bank Account
Powered by GitBook
On this page
  1. API ENDPOINTS
  2. Products

Create Product

Create a new product on your Terraswitch account.

POST {{ BASE_URL }}/v1/corporate/product

Body Parameters

Property
Data Type
Description
Example
Required

name

string

The name of the product

"Laptop Bag"

Yes

avatar

base64 string

The base64 string value of the product image. Recommended size is 5MB.

"base64..."

No

code

string

Your preferred product code

"MYPRODUCTXD"

No

description

string

The product description

"This is a new product"

No

price

number

The price of the product. This must be in 2 decimal places only.

4500.99

Yes

isLink

boolean

This helps you specify if you want a payment link be generated automatically for the product. This is defaulted to false

true

No

Please note that the prefix "TPD" will be added to every product code you provide.

import Axios from 'axios';

// set the api url
const API_URL = `${BASE_URL}/v1/corporate/product`;

// define request body
const base64_image = "base64...";
const data = {
    "name": "Plastic Modern Chair",  
    "avatar": `${base64_image}`, 
    "code": "MYPROPLASTXD", 
    "description": "This is the new plastic product", 
    "price": 3500.99,
    "isLink": true
}

// make request using axios
Axios({
    method: "GET",
    url: `${API_URL}`,
    headers: {
        lg: 'en',
        ch: 'web'
        Authorization: `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
    },
    data: data
}).then((resp) => {
    console.log(resp)
}).catch((err) => {
    console.log(err)
})
{
    "error": false,
    "errors": [],
    "data": {
        "avatar": "",
        "code": "TPDMYPROPLASTXD",
        "description": "This is a new platsic product",
        "isEnabled": true,
        "name": "Plastic Modern Chair",
        "price": 3500.99,
        "slug": "plastic-modern-chair",
        "inflow": {
            "value": 0,
            "count": 0
        },
        "createdAt": "2024-01-10T13:43:06.899Z",
        "updatedAt": "2024-01-10T13:43:07.398Z",
        "paymentLink": "https://staging-web.vacepay.com/link/vpdmyproplastxd"
    },
    "message": "successful",
    "status": 200
}
PreviousFetch ProductNextUpdate Product

Last updated 5 months ago