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

Apple Pay对接Stripe后支付记录未在Dashboard显示求助

Troubleshooting $0.00 Stripe Charges with Apple Pay

Hey Mike, let's break down why you're seeing empty $0.00 charges in your Stripe Dashboard even though your server logs show "success" after an Apple Pay request. Here are the key areas to investigate, plus actionable fixes tailored to your code:

1. Validate the amount Parameter (Most Common Culprit)

Stripe requires the amount to be specified in the smallest currency unit (e.g., 1000 for $10.00 USD, not 10.00). If your frontend is sending:

  • A raw dollar amount instead of cents
  • A string value instead of a numeric integer
  • Or accidentally passing 0

Stripe will create a $0.00 charge, which explains the empty Dashboard record. First, add a validation check in your /pay endpoint to catch this:

app.post('/pay', function (req, res) {
 console.log('Payment requested')
 var token = req.body.stripeToken
 var amount = req.body.amount
 var description = req.body.description

 // Add amount validation
 if (!amount || typeof amount !== 'number' || amount <= 0) {
  console.log('Invalid amount received:', amount)
  return res.status(400).send('Invalid amount - must be a positive integer in cents')
 }

 // Rest of your charge logic...
})

Double-check that your frontend converts the user's selected amount to cents before sending it to the backend (e.g., $5.99 becomes 599).

2. Inspect Stripe's Raw Request Logs

Head to your Stripe Dashboard > Developers > Logs and search for the charge request associated with your test. Look at the raw request body:

  • If the amount field shows 0, the issue is definitely with the value sent from your frontend.
  • If the amount is correct but the charge still shows $0.00, check if the stripeToken is valid—Stripe logs will flag invalid tokens with an error, even if your code logs "success".

3. Migrate to Stripe's Payment Intents API (Critical Fix)

Your current code uses Stripe's legacy charges.create API, which isn't designed for modern payment methods like Apple Pay. Apple Pay often requires strong customer authentication (SCA), which the old Charges API can't handle properly. This can lead to "successful" server logs but no actual charge being processed.

Here's how to update your endpoint to use Stripe's recommended Payment Intents API:

app.post('/pay', async function (req, res) {
 console.log('Payment requested')
 const { stripeToken, amount, description } = req.body

 // Validate amount first
 if (!amount || typeof amount !== 'number' || amount <= 0) {
  console.log('Invalid amount received:', amount)
  return res.status(400).send('Invalid amount')
 }

 try {
  const paymentIntent = await stripe.paymentIntents.create({
   amount: amount,
   currency: 'usd',
   description: description,
   payment_method: stripeToken, // For Apple Pay, use a payment method ID instead of a token
   confirm: true, // Auto-confirm the payment
  })
  console.log('Payment successful:', paymentIntent.id)
  res.status(200).send({ success: true, paymentIntentId: paymentIntent.id })
 } catch (err) {
  console.log('Error processing payment:', err.message)
  res.status(400).send({ error: err.message })
 }
})

Note: For Apple Pay, Stripe recommends generating a payment_method ID instead of a token. Ensure your frontend is using Stripe's Apple Pay SDK correctly to create a valid payment method.

4. Test with Valid Stripe Test Data

Enable test Apple Pay in your Stripe Dashboard (under Payments > Payment Methods > Apple Pay) and test with a valid scenario:

  • Use the test card number 4242 4242 4242 4242 (any future expiration date, any CVC)
  • Send 1000 as the amount to simulate a $10.00 charge

This will help confirm if your flow works with valid test data.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.13 08:39:41