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:

Price tiers (USD)

price_centsPrice
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

  1. Ask for the payment with GOOF.game.requestPayment().
  2. Grant the item.
  3. 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:

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

Earnings

The current revenue terms are shown on the Earnings page, with your estimated earnings per game. Selling requires a verified business.

Error codes

CodeMeaning
60001Unknown product.
60002Payment cancelled by the player.
60003Payment failed.
40001Payments are not supported on this host.
50000System error.