Get Items for Creation Order
The following code shows how to use the HandCash Minter to get items that have been created from a particular order when the order is completed.
import dotenv from 'dotenv';
import { HandCashMinter } from '@handcash/handcash-connect';
dotenv.config();
const handCashMinter = HandCashMinter.fromAppCredentials({
appId: process.env.HANDCASH_APP_ID,
authToken: process.env.HANDCASH_AUTH_TOKEN,
appSecret: process.env.HANDCASH_APP_SECRET
});
(async () => {
const itemCreationOrderId = "657762fc2acbecc109d8c1fb";
const creationOrder = await handCashMinter.createItems(collectionId, items);
if(creationOrder.status === 'completed') {
const items = await handCashMinter.getOrderItems(creationOrder.id);
console.log('Items created', items);
}
})();
Updated 6 months ago