mycelium_gear_api
v1.1.1
Published
javascript mycelium api with order status
Downloads
10
Readme
Mycelium Gear JavaScript Client API
Helps to create and check order status of your mycelium gear account
Usage
Very easy to use!
const Mycelium = require('mycelium_gear_api')
let amount = 1000 // amount to be paid
const gateway = new Mycelium.Gateway('gateway-id', 'gateway-secret')
//Create order
const order = new Mycelium.Order(gateway, amount, 'callback-data')
order
.send()
.then((response) => {
response.json().then((json) => {
/* More computation with object returned from Mycelium Gear. */
})
})
.catch((error) => {
console.error(error)
})
// check orderstatus
const orderStatus = new Mycelium.OrderStatus(gateway,'payment_id')
orderStatus
.get()
.then((response) => {
response.json().then((json) => {
Object.entries(Mycelium.PaymentStatus).forEach(
([key, value])=>{
if(json.status == value){
console.log(key) // get the status of the order
}
})
})
})
.catch((error) => {
console.error(error)
})
Please look at Mycelium Gear documentation. There are 3 ways to check: a websocket, http request to a web server, and manual GET requests.
I used manual manual GET requests for order status.