62 lines
3.5 KiB
Markdown
62 lines
3.5 KiB
Markdown
# Stripe Hosted Checkout Promo Diagnostics
|
|
|
|
Use this when a hosted Stripe Checkout promo field is visible, the user claims the code should work, and the UI only says `This code is invalid` / `Код недействителен`.
|
|
|
|
## Safe scope
|
|
- Run diagnostics on **one legitimate account/session**.
|
|
- Do not confirm payment, rotate IPs, bypass risk checks, or automate bulk coupon redemption.
|
|
- Capture the exact Stripe response and classify it; then pivot to legitimate support/account troubleshooting.
|
|
|
|
## Network signal to capture
|
|
Hosted Checkout applies a promotion code with a request shaped like:
|
|
|
|
```http
|
|
POST https://api.stripe.com/v1/payment_pages/cs_live_...
|
|
promotion_code=<CODE>
|
|
```
|
|
|
|
A true Stripe-side invalid promo response looks like:
|
|
|
|
```json
|
|
{
|
|
"error": {
|
|
"code": "payment_pages_promotion_code_invalid",
|
|
"message": "This promotion code is invalid.",
|
|
"param": "promotion_code",
|
|
"type": "invalid_request_error"
|
|
}
|
|
}
|
|
```
|
|
|
|
If this exact response is present, the failure is not a missed UI click or wrong field. It means the promotion code is not valid for that Checkout session/customer/amount/currency/product/region/account state.
|
|
|
|
## Diagnostic workflow
|
|
1. Open the normal billing path and trigger the official hosted Stripe Checkout.
|
|
2. Attach response logging/HAR capture before applying the code.
|
|
3. Enter the promo code and click `Apply` / `Применить`.
|
|
4. Save:
|
|
- HAR or JSONL network log
|
|
- visible checkout text after apply
|
|
- screenshot, if available
|
|
- checkout URL/session id redacted to prefix only (`cs_live_...`)
|
|
5. Search the log for:
|
|
- `api.stripe.com/v1/payment_pages/`
|
|
- `promotion_code=`
|
|
- `payment_pages_promotion_code_invalid`
|
|
- `apply_promotion_code.error`
|
|
6. Report the exact error code, not just the localized UI text.
|
|
|
|
## Interpretation guide
|
|
- `payment_pages_promotion_code_invalid`: Stripe rejected the promo for this Checkout session. Likely expired, exhausted, inactive, product/price-restricted, customer/email-restricted, country/region-restricted, currency-restricted, or not enabled on that merchant account/flow.
|
|
- Visible total unchanged (`$50.00`) after apply means the promo was not applied. Do not claim success until a discount line appears or the total/balance changes.
|
|
- Stripe telemetry may show useful context such as `customer_country_code`, `livemode`, `browserFamily`, and `is_webview`; use it for support/debugging, not for evasion advice.
|
|
|
|
## ai& / aiand notes from session
|
|
- Official path used successfully for diagnostics: `console.aiand.com/settings/billing` → `Purchase Credits` → `$50` → exact modal button `Purchase` → hosted Stripe → promo field.
|
|
- ai& may show both a page-level `Purchase Credits` button and a modal `Purchase` button; selector logic should target exact text `^Purchase$` or the last visible `Purchase` button in the modal.
|
|
- Magic-link helpers can accidentally reuse an old email. For diagnostics, record current IMAP message ids before requesting a new magic link, then accept only newly arrived messages.
|
|
- If opening the magic link in a fresh browser does not establish the console session, verify the fresh token through the site API and inject returned auth cookies into the browser context for the console domain before opening billing.
|
|
|
|
## User-communication pattern
|
|
For impatient users, keep mid-run messages short: `логинюсь`, `открываю billing`, `жму $50`, `ловлю Stripe response`. After capture, give the exact Stripe error code and one concise conclusion.
|