This is a GrowStocks Pay API wrapper.
API Application Form: Apply Here
Working Example: Growrr Website
Documentation: Read Here
- Node JS
- GrowStocks Auth (including
balance
as a scope) - GrowStocks Developer Account
const GSPay = require("growstocks-pay");
const pay = new GSPay("CLIENT_SECRET");
const userID = 737; // You can get this via GS Auth
const amount = 5; // Amount you want to deduct from user's account
await pay.createTransaction(userID, amount); // This will return a transaction ID
const transactionID = "XXXXXXXXXXXX"
await pay.getTransaction(transactionID);
/*
returns
{
id: "XXXXXXXXXXXX",
party: 737,
user: 1561,
status: 0,
amount: 5,
datetime: 1596633967
}
id - Transaction ID
party - Developer ID
user - User ID,
status - Payment status (integer) Paid = 1, Unpaid = 0
datetime - Transaction created (in timestamp)
*/
const user = 737;
const amount = 5;
await pay.sendWorldLocks(user, amount);
/*
returns
{
text: "5 World Locks has been sent to PapayaShake",
balanceLeft: 0
}
*/
await pay.myBalance(); // returns 0
- Sets the client secret for your GS Pay Object
- Create endpoint rate limit: 1 request/user/4 seconds
- Getendpoint rate limit: 1 request/user/2 seconds
- Send endpoint rate limit: 1 request/user/second
All unpaid transactions will be automatically deleted 2 days after their creation.