You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Stripe Radar规则对Apple Pay预授权无效,如何提前验证预付卡?

How to Block Apple Pay Prepaid Cards Before Fulfilling Your Service (Step 3)

Let’s break down how to fix this gap in your flow—you need to trigger Stripe Radar’s prepaid card check right after getting the Apple Pay token (Step 2) instead of waiting until the final charge (Step 4). Here’s a actionable, step-by-step solution:

1. Validate the Payment Method with a SetupIntent

The core fix is to verify the Apple Pay payment method immediately after receiving the Stripe token, which will run your Radar rules before you provide any service. Use a SetupIntent for this—it’s purpose-built to confirm a payment method is valid without charging the user, and it will trigger all your configured Radar checks.

Backend Code Example (Node.js)

Once your frontend sends you the Apple Pay-generated payment method ID (pm_xxx), run this validation:

const stripe = require('stripe')('your_secret_api_key');

async function validatePaymentMethod(paymentMethodId) {
  try {
    const setupIntent = await stripe.setupIntents.create({
      payment_method: paymentMethodId,
      confirm: true, // Triggers immediate validation and Radar checks
      usage: 'off_session', // Optional, useful if you plan to charge later without user input
    });

    // If we reach here, the payment method passed all checks
    return { isValid: true, setupIntent };
  } catch (error) {
    // Catch Radar blocks specifically
    if (error.code === 'payment_method_blocked') {
      return { isValid: false, reason: 'Prepaid cards are not allowed' };
    }
    // Handle other common errors (e.g., expired card, insufficient funds)
    return { isValid: false, reason: error.message };
  }
}

2. Adjust Your Radar Rules

Make sure your prepaid card blocking rule is set to trigger during the validation phase, not just when capturing a charge:

  • Head to your Stripe Dashboard > Radar > Rules
  • Edit your existing "Block prepaid cards" rule (or create a new one)
  • Set the Trigger to When a SetupIntent is confirmed (or When a PaymentIntent is confirmed if you use that instead)
  • Keep the condition as Card funding type is prepaid

3. Alternative: Check Card Funding Type Directly

For an extra layer of control, you can fetch the payment method details from Stripe and inspect the funding field yourself:

const paymentMethod = await stripe.paymentMethods.retrieve(paymentMethodId);
if (paymentMethod.card.funding === 'prepaid') {
  // Block the user immediately
  throw new Error('Prepaid cards are not permitted for this service');
}

Note: Some prepaid cards might return unknown for the funding type, so combining this with Radar checks is more reliable.

4. Update Your User Flow

Insert the validation step right after Step 2 to block invalid users early:

  • Step 1: User requests service with Apple Pay (PKPaymentSummaryItemTypePending)
  • Step 2: Stripe returns Apple Pay token (converted to a Payment Method)
  • New Step 2.5: Run validation via SetupIntent/Radar/funding check
    • If validation fails: Reject the request, notify the user
    • If validation passes: Proceed to Step 3
  • Step 3: Provide service
  • Step 4: Charge the user as originally planned

This closes the loop where prepaid card users could access your service for free, since you’re blocking them before delivering any value.

内容的提问来源于stack exchange,提问作者Ted

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:31:31