API Support

Ask a Question
Back to All

Making a Single Purchase available in Game

I am looking to add a way to purchase an in game currency called Diamonds in my game. I Just want 1 option to spend 10 Kreds to gain 1500 Diamonds. I am using Construct 3 which allows JavaScript.
Currently:
I load Kongregate API
I have Auth stored in 'token'
I have Username stored in 'username'

On click this runs (Nothing happens when I test it on my Dev account)

kongregate.mtx.purchaseItems(["1500 Diamonds"], onPurchaseResult);

function onPurchaseResult(result) {
console.log("Purchase success:" + result.success);
diamonds = diamonds + 1500;
}

Looking for any guidance as to where I should go from here. I have been through docs.kongregate a lot and can't really piece it together. A snippet of JS code would help me the most as I could reverse engineer it to fit into my Game. Anything is helpful though.