{"id":"cmv26r7ye0005mg2omk6d15zn","slug":"setup-play-store","judul":"Setup Play Store","deskripsi":"Panduan setup Google Play service account","parentId":null,"urut":2,"kategori":"web","tag":"[]","status":"draft","versi":null,"konsep":"# Setup Google Play Service Account — Backend Billing API\n\n## Tujuan\nBackend `zx_parenting` perlu akses Google Play Developer API untuk:\n- Verify subscription/IAP purchase (`/api/billing/verify`)\n- Acknowledge purchase (`/api/billing/acknowledge`)\n- RTDN webhook subscription expiry/cancel/pause (`/api/billing/rtdn`)\n\n## Step-by-step\n\n### 1. Google Cloud Console\n1. Buka [console.cloud.google.com](https://console.cloud.google.com)\n2. Buat project baru (atau pakai existing): `zx-parenting`\n3. Enable **Google Play Developer API**:\n   - APIs & Services → Library → search \"Google Play Developer API\" → Enable\n\n### 2. Buat Service Account\n1. IAM & Admin → Service Accounts → Create\n2. Name: `zx-parenting-billing`\n3. Role: tidak perlu tambahan (akan di-link via Play Console)\n4. Create → selesai\n\n### 3. Create JSON Key\n1. Klik service account `zx-parenting-billing`\n2. Keys tab → Add Key → Create New Key → JSON → Download\n3. Simpan file JSON (berisi `client_email`, `private_key`, `token_uri`, dll)\n\n### 4. Link ke Play Console\n1. Buka [play.google.com/console](https://play.google.com/console)\n2. Pilih app → Setup → API access → Service accounts\n3. Invite service account (`zx-parenting-billing@zxparenting.iam.gserviceaccount.com`)\n4. Grant **Finance** atau **Admin** role\n\n### 5. Set Env di Coolify\nSet 2 environment variables di Coolify app `zx_parenting`:\n\n| Key | Value |\n|-----|-------|\n| `GOOGLE_PLAY_PACKAGE_NAME` | `com.zxparenting.ortu` |\n| `GOOGLE_PLAY_SERVICE_ACCOUNT_JSON` | (isi lengkap JSON file) |\n\n### 6. Test\n```bash\ncurl -X POST https://zxparenting.zomet.my.id/api/billing/verify -H \"Content-Type: application/json\" -d '{\"productId\":\"test\",\"purchaseToken\":\"test\",\"type\":\"subscription\"}'\n```\nExpected: 401 (auth ortu required) atau error verify (token invalid).\nBukan: 500 \"GOOGLE_PLAY_SERVICE_ACCOUNT_JSON not set\".\n\n## Package Names\n- App ortu: `com.zxparenting.ortu` (billing flow dari ortu)\n- App anak: `com.zomet.zxparentingkids`\n\n## Status\n- ✅ Backend code complete: `/api/billing/verify`, `/api/billing/acknowledge`, `/api/billing/rtdn`\n- ✅ `GOOGLE_PLAY_PACKAGE_NAME` set: `com.zxparenting.ortu`\n- ✅ `GOOGLE_PLAY_SERVICE_ACCOUNT_JSON` set (project: zxparenting, email: zx-parenting-billing@zxparenting.iam.gserviceaccount.com)\n- ✅ Service account linked to Play Console (Zomet Teknologi Indonesia)\n- ✅ Env verified in container: PKG + SA JSON valid\n- ✅ Endpoint `/api/billing/verify` returns 401 (auth gate works, not 500)\n","createdAt":"2026-10-10T09:22:22.598Z","updatedAt":"2026-10-10T10:40:04.822Z","bagian":[],"children":[],"parent":null}