Skip to main content

Mobile IAP (iOS / Android SDK)

Applies toGames selling through the Alogame mobile SDK (Apple / Google billing)
EndpointscreateOrder_url, exchange_url
SignatureMD5, Signature header, timestamp in seconds
ErrorsHTTP status codes

For games using the Alogame mobile SDK (showPayment / purchaseAndVerify), the flow is:

The mobile SDK handles character selection client-side (passing role_id and server_id in the purchase request). Alogame verifies the receipt directly with Apple/Google, then calls your game server to create the order and deliver the item. No payment provider IPN is involved.

API 1 — Create Order

Called after Alogame verifies the Apple/Google receipt. Your server creates a local order record and returns a partner order code.

Method: POST
Path: full static URL as registered with Alogame Operations (same createOrder_url as web flow)

Request body — differs from web payment (extra fields for mobile context):

FieldTypeDescription
order_idstringStore transaction ID (Apple: transaction_id, Google: orderId)
uidstringCharacter UID from game (passed by SDK as role_id)
productIdstringYour own product ID, exactly as you submitted it to Alogame
serverIdstringGame server ID (passed by SDK as server_id)
pricestringPrice of the package Alogame configured for this product
ext_infostringContext forwarded from the SDK
timestampintegerUnix timestamp (seconds)
{
"order_id": "2000001167262669",
"uid": "100002078",
"productId": "com.yourgame.pack1",
"serverId": "9999",
"price": "49000",
"ext_info": "{}",
"timestamp": 1778318138
}

Response — 201 Created

{
"status": "success",
"order_code": "260509161539010042"
}

Error responses

StatusCodeMeaning
401SIGNATURE_INVALIDSignature check failed
409ORDER_ALREADY_EXISTSDuplicate order_id — return your existing order_code
404PRODUCT_NOT_FOUNDProduct does not exist
404UID_NOT_FOUNDUID does not exist
Handle 409 as success

If Alogame retries and receives 409 ORDER_ALREADY_EXISTS, it will proceed using the original order_code. Return the original order_code in the 409 body if possible.

API 2 — Deliver Item (Payment Received)

Called immediately after createOrder succeeds. Grant the purchased item to the player.

Method: POST
Path: full static URL as registered with Alogame Operations (same exchange_url as web flow)

Request body — differs from web payment (includes order_id and price):

FieldTypeDescription
order_codestringPartner order code returned from createOrder
order_idstringStore transaction ID (same as createOrder)
pricestringProduct price (same as createOrder)
ext_infostringContext forwarded from the SDK
timestampintegerUnix timestamp (seconds)
{
"order_code": "260509161539010042",
"order_id": "2000001167262669",
"price": "49000",
"ext_info": "{}",
"timestamp": 1778318139
}

Response — 200 OK

{
"processingStatus": "completed"
}

Error responses

StatusCodeMeaning
401SIGNATURE_INVALIDSignature check failed
404ORDER_CODE_NOT_FOUNDorder_code does not exist
409PAYMENT_ALREADY_PROCESSEDAlready delivered — safe for Alogame to ignore
Idempotency required

Alogame may retry this call on timeout or network failure. Your server must deduplicate on order_code and return 409 PAYMENT_ALREADY_PROCESSED for duplicates without re-granting the item.


Endpoint Registration

Submit both URLs to your Alogame Operations Manager, for production and dev/staging separately. Each URL is a complete static string — Alogame stores it as-is and calls it directly.

# Production
createOrder_url: https://api.yourgame.com/<your-path>
exchange_url: https://api.yourgame.com/<your-path>

# Dev / Staging
createOrder_url: http://<dev-host>/<your-path>
exchange_url: http://<dev-host>/<your-path>

Production must use HTTPS with a valid TLS certificate; dev/staging may use HTTP. Alogame routes to the correct environment with no SDK or client config change.

For an expub (Exclusive/Direct-publishing) game, these are the same two URLs used by Web Payment — Expub's web top-up flow — register them once, shared by both.


Implementation checklist

  • Submitted createOrder_url and exchange_url (production + dev/staging) to Alogame Operations
  • Production endpoints use HTTPS with a valid TLS certificate
  • createOrder_url: creates order record from { order_id, uid, productId, serverId, price, ext_info, timestamp }; returns status: success + order_code; returns 409 for duplicate order_id
  • exchange_url (paymentReceived): grants item from { order_code, order_id, price, ext_info, timestamp }; returns processingStatus: completed; returns 409 for duplicate order_code
  • Both APIs: verify Signature header; reject if |now − timestamp| > 600s
  • Delivery logged with order_code, uid, productId for CS lookup