Recover failed subscription payments
To recover failed renewals with BillDog, turn on the billing grace period in App Store Connect and Google Play so users keep access while the store retries the card. During grace, getCustomerInfo() returns isInGracePeriod: true, so your app can show a banner that opens showManageSubscriptions(). As soon as the renewal payment fails, BillDog sends the subscription.billing_issue webhook and the Billing Issue journey trigger, so you can reach the user while they still have access.
Steps last checked against the SDK source on 16 Nov 2026.
What you'll build
- Store grace periods turned on, so a failed card doesn't cut access straight away
- An in-app banner that sends users in grace to the store's payment screen
- A journey that messages users whose access was paused by a billing issue
- A server that knows which subscriptions are in grace or billing retry
What you'll need
- An app that already shows a paywall and unlocks
premium(iOS, Android) - App Store Server Notifications or Google Play RTDN connected to BillDog (App Store setup, Google Play setup)
- For step 6: a project where you can create Test Store purchases
1. Understand grace, billing retry and lapse
4 minWhen a renewal payment fails, the store doesn't end the subscription at once. It retries the card for weeks, and many of those retries succeed. BillDog follows the store's state for each purchase and changes access, customer info and webhooks to match:
- Grace period (store state
in_grace): the payment failed, but the user keeps access until the grace period ends. The entitlement stays active withstategrace_period, and customer info hasisInGracePeriod: true. Webhook:subscription.billing_issuewith"state": "in_grace". Journey trigger: Billing Issue. - Billing retry (
in_billing_retryon the App Store,on_holdon Google Play, called account hold): the store is still retrying, but access has stopped. The entitlement is no longer returned. Webhook:subscription.billing_issueif the subscription had no grace period, otherwisesubscription.updatedwith the newstate. - Recovered: a retry succeeds. The store books a new period, access comes back, and BillDog sends
subscription.renewed. - Lapsed: the retry window ends without payment. BillDog sends
subscription.expired.
For App Store and Google Play purchases, subscription.billing_issue fires once per failed renewal, when the payment first fails: on entering grace, or on entering billing retry or account hold when there is no grace period. Moving on from grace to billing retry, or from billing retry to account hold, is sent as subscription.updated with the new state. If the renewal later succeeds and a later one fails, that is a new billing issue.
Stripe web subscriptions work differently: the first failed invoice sends subscription.billing_issue right away and starts a 7-day grace period. Its payload has a different shape (status: "past_due", grace_period_expires_at). It is sent once per failed renewal too: Stripe's retries of the same invoice don't send it again or extend the grace period, and a new one comes only after a renewal succeeds.
2. Turn on grace periods in the stores
5 minGrace periods are a store setting, not a BillDog one. BillDog reads the grace end date from each store notification, so there's nothing to configure in the dashboard.
- App Store Connect: open your app, go to Subscriptions and turn on Billing Grace Period. Choose a length (3, 16 or 28 days; weekly plans allow less) and whether it applies to all renewals or only paid-to-paid ones. Without it, a failed payment goes straight to billing retry and access stops at once.
- Google Play Console: open Monetize → Products → Subscriptions, open the subscription, then edit each base plan. Set the Grace period and Account hold lengths. Play applies a grace period by default; check the values match what you want.
Apple and Google change these options from time to time. Check the current lengths in the App Store Connect help and the Play subscription docs.
3. Prompt users in grace to fix their payment
10 minA user in grace still has access, so nothing in your app changes unless you tell them. Read isInGracePeriod from customer info and show a banner whose button opens the store's subscription screen, where they can update the card.
On iOS, showManageSubscriptions() is an async method that opens Apple's subscription management sheet:
import SwiftUI
import BillDogFull
struct BillingIssueBanner: View {
@State private var inGrace = false
var body: some View {
Group {
if inGrace {
VStack(alignment: .leading, spacing: 8) {
Text("We couldn't renew your subscription").font(.headline)
Text("Update your payment method to keep Premium.")
Button("Update payment") {
Task { await BillDog.shared.showManageSubscriptions() }
}
}
.padding()
}
}
.task {
if let info = try? await BillDog.shared.getCustomerInfo() {
inGrace = info.isInGracePeriod
}
}
}
}On iOS 16 and later, BillDog also shows Apple's own App Store messages automatically, including Apple's billing issue sheet when Apple has one for the user. To decide yourself, pass a handler to BillDog.shared.setAppStoreMessageHandler and return true for messages you handled.
On Android, BillDog.showInAppMessages(activity) asks Google Play to show its own transactional message (such as a declined payment) if it has one. BillDog.showManageSubscriptions(activity, subscriptionId) opens the Play subscription screen; pass your Play product ID to open that subscription directly.
import androidx.activity.ComponentActivity
import androidx.lifecycle.lifecycleScope
import io.billdog.core.BillDog
import kotlinx.coroutines.launch
class MainActivity : ComponentActivity() {
override fun onResume() {
super.onResume()
// Google Play's own "fix your payment" message, if Play has one for this user.
BillDog.showInAppMessages(this)
lifecycleScope.launch {
BillDog.getCustomerInfo()
.onSuccess { info -> showBillingBanner(info.isInGracePeriod) }
}
}
// Call this from your banner's "Update payment" button.
private fun onUpdatePaymentTapped() {
BillDog.showManageSubscriptions(this, subscriptionId = "premium_monthly") // your Play product ID
}
private fun showBillingBanner(visible: Boolean) {
// Show or hide your own banner here.
}
}Customer info is cached for a few minutes. When the user comes back from the store screen, call getCustomerInfo(forceRefresh: true) (iOS) or getCustomerInfo(forceRefresh = true) (Android) so the banner disappears once the store has charged the card.
4. Message users whose payment failed
6 minThe in-app banner only reaches users who open the app. A journey can send them a push or email as soon as the payment fails, while they still have access.
- Open Engagement → Journeys and click Create Journey.
- Under Create a New Journey, enter a Journey Name and choose Billing Issue (under Purchases) as the Entry Trigger. You can pick the
premiumentitlement to limit it to subscriptions that unlock it. Click Create Journey to open the canvas. - On the canvas, drag Send Notification from the Step Palette and connect it after the Billing Issue trigger step (drag that from Triggers first if the canvas is empty). Write a short message that says the payment failed and how to update the payment method.
- Click Publish.
Push needs your APNs and FCM keys and a device token for the user. If those aren't set up yet, follow Send push and in-app messages first.
5. Track billing issues on your server
6 minIf your backend grants access or sends its own email, subscribe a webhook endpoint to subscription.updated, subscription.billing_issue, subscription.renewed and subscription.expired. Setup and signature checks are covered in Receive BillDog webhooks on your server. A billing issue on an App Store purchase looks like this:
{
"event_type": "subscription.billing_issue",
"event_id": "4f0b2c9e-...",
"store_purchase_id": "9a1d...",
"state_version": 4,
"state": "in_grace",
"will_auto_renew": true,
"expires_at": "2026-12-15T10:00:00+00:00",
"customer_id": "c2f7...",
"app_user_id": "user_123",
"platform": "ios",
"store": "app_store",
"product_kind": "auto_renewable",
"store_product_id": "com.example.premium.monthly",
"product_id": "premium_monthly",
"is_sandbox": false
}stateis the store state after the change:in_grace,in_billing_retry(App Store) oron_hold(Google Play). A billing issue is sent once per failed renewal, so readstateto know whether the user still has access.state_versiongoes up with every change to the purchase. Events can arrive out of order, so ignore one whosestate_versionis lower than the last you stored for thatstore_purchase_id.app_user_idis your own user ID.customer_idis BillDog's internal ID.
To see the trend, open Analytics → Billing Issues. It shows how many subscriptions entered a billing issue, how many recovered, the recovery rate, and how many are in grace or billing retry now.
6. Test the whole flow
8 minThe Test Store can play out a failed renewal at real store timings, so you can check your journey, webhooks and backend without waiting for a real card to fail.
- Go to
/dashboard/test-store. In Create Mock Purchase, enter a Test User ID, pick a monthly product that grantspremium, set Test Scenario to Renewal payment fails (grace, retry, lapse), and click Create Test Purchase. - Open the Time Travel tab, enter the same Test User ID, set Days Forward to
32and click Advance Time. The result lists Payment failed: grace period. Your webhook endpoint receivessubscription.billing_issuewithstatein_grace, and a published Billing Issue journey enrolls the user. - Advance another
17days. The result lists Billing retry: access paused, and your endpoint receivessubscription.updatedwithstatein_billing_retry. - Advance
90days. The result lists Lapsed after billing retry andsubscription.expiredis sent.
Test Store users follow the App Store timings: a 16-day grace period inside a 60-day retry window. Check the grace state from your server with a sandbox secret key:
curl -X POST https://api.billdog.io/v1/get-customer-info \
-H "X-BillDog-API-Key: bd_secret_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"app_user_id": "test_user_123"}'During grace, data.isInGracePeriod is true and the premium entitlement has "state": "grace_period". In billing retry, premium is missing from data.entitlements.
Your app can't read a Test Store user with a public key, so test the in-app banner with a store sandbox account instead. Apple's sandbox and Google's licence testers can both simulate a failed renewal; see iOS sandbox testing and Android sandbox testing.