Welcome to Prezzee SDKs
This SDK supports Prezzee's V2 Business APIs enabling quicker development. It allows the developers to:
- List Products
- Retrieve Product Details
- List Styles
- List Orders
- Create Order
- Retrieve Order
- List Order Items
- Retrieve Float Balance
- Retrieve Invoice
- Retrieve Sender Profiles
- Retrieve Consolidated Invoices
- Retrieve Discounts available
Install
npm install @prezzee/ts-v2-sdks
Install dependencies as well:
npm install axios
Usage
To use the functions, you need a Business API token as part of your config. Add an environment variable TOKEN={business API token you must have received}. Example token: sJ0uOIDRYexgfL2M7BgLiPjb6xkPAi
Initialise Client
const prezzeeClient = createPrezzeeClient({ token: process.env.TOKEN, env: "sandbox" });
Once initialised, you can use it as per following examples:
List Products
const products = await prezzeeClient.listProducts();
Returns a list of products currently available for purchase.
List Styles
const styles = await prezzeeClient.listStyles();
Returns a list of gift styles for use with the product creation endpoint.
Create Order
const product = products.results[0];
const style = styles.results[0];
const order = await prezzeeClient.createOrder({
reference: generateUUID(),
payment_method: "POSTPAID_CREDIT",
wait_for_stock: false,
items: [
{
reference: generateUUID(),
product_code: product.code,
product_theme_code: product.themes[0].code,
amount: product.denominations[0].amount,
currency: product.denominations[0].currency,
delivery_method: "LINK",
delivery_details: {
style_code: style.code,
message: "Hello Prezzee SDK",
recipient_name: "Prezzee SDK Recipient",
recipient_email: "dhanushka.krishnaith@prezzee.com",
sender_name: "Prezzee SDK Sender",
},
},
],
});
This will return order_uuid in response which can be used in the following example to retrieve the order details.
Retrieve Order
await prezzeeClient.retrieveOrder({ orderUuid: order.uuid, });