In-app purchases
Sell coins, lives or a permanent unlock. You create products in your dashboard and ask for a payment from the game.
Real purchases run in the GOOF apps. The web player does not take payments for now. On localhost the SDK shows a test payment sheet.
Products
Create products in the Monetization tab. Up to 50 per game. Each product has:
- sku: 2 to 40 characters from
a-z,0-9,_and., for examplecoins_500. - name: what the player sees.
- price: one of the price tiers below.
- type:
consumable(can be bought again, like coins) ornon_consumable(bought once, like "remove ads").
Price tiers (USD)
| price_cents | Price |
|---|---|
| 99 | $0.99 |
| 199 | $1.99 |
| 299 | $2.99 |
| 499 | $4.99 |
| 999 | $9.99 |
| 1999 | $19.99 |
| 4999 | $49.99 |
Show the products
const products = await GOOF.game.getProducts();
for (const p of products) {
addShopRow(p.name, p.priceLabel, p.sku); // also p.price_cents and p.type
}
Use priceLabel for the price text.
Consumable flow
- Ask for the payment with
GOOF.game.requestPayment(). - Grant the item.
- Call
GOOF.game.consumePurchase()so the order is marked used.
async function buy(sku) {
try {
const order = await GOOF.game.requestPayment({ sku }); // { orderId, sku, state }
grantItem(order.sku);
saveGame();
await GOOF.game.consumePurchase({ orderId: order.orderId });
} catch (err) {
if (err.errorCode === 60002) return; // player cancelled
showMessage('The payment did not go through.');
}
}
GOOF.game.requestPayment() also takes success, fail and complete callbacks if you prefer them to the promise.
For a non_consumable product, grant the unlock and keep it in your save. Do not consume it.
Orders
An order id looks like o_ plus 16 hex characters. Its state is one of:
sandbox: a test payment.paid: paid, not yet used.consumed: paid and used.refunded: the money went back to the player.
Check an order on your server
If your game has its own server, check an order before you grant something valuable. Send your app's server secret in the x-goof-secret header. Never put the secret in your game code.
curl https://minigames.appversestudio.com/v1/dev/orders/o_0123456789abcdef \
-H "x-goof-secret: $GOOF_SERVER_SECRET"
The reply holds the order with its state. Grant the item only for paid (or sandbox while you test).
How prices work
- Each product uses one price tier: 0.99, 1.99, 2.99, 4.99, 9.99, 19.99 or 49.99. The store shows it in the player's local currency.
- The player pays through Google Play or the App Store, with the payment method saved there.
- The GOOF server checks the order with the store before your game is told the payment succeeded.
Earnings
The current revenue terms are shown on the Earnings page, with your estimated earnings per game. Selling requires a verified business.
Error codes
| Code | Meaning |
|---|---|
60001 | Unknown product. |
60002 | Payment cancelled by the player. |
60003 | Payment failed. |
40001 | Payments are not supported on this host. |
50000 | System error. |