Stripe支付集成报错:仅印度注册企业可接收国际支付
问题背景
在React Native + Express.js集成Stripe支付时,支付流程失败,收到报错提示:"根据印度法规,仅注册印度企业(即独资企业、有限责任合伙企业和公司,不包括个人)可接收国际支付"。同时Stripe后台时间线显示:3D Secure尝试已确认,但因银行不支持、未设置3D Secure或系统故障,客户未完成验证,卡组织已提供尝试证明。当前使用Stripe开发者测试账号。
技术环境
- 后端:
stripe^14.18.0(Express.js) - 前端:
@stripe/stripe-react-native~0.35.1(React Native/Expo)
后端核心代码
const stripe = require("stripe")(process.env.STRIPEKEY, { apiVersion: "2023-10-16", }); const createIntent = asyncHandler(async (req, res) => { try { const paymentIntent = await stripe.paymentIntents.create({ amount: req.body.amount * 100, currency: "inr", description: "Software development services", payment_method_types: ["card"], }); res.status(200).json({ clientSecret: paymentIntent.client_secret }); } catch (e) { console.error("Error creating PaymentIntent:", error); res.status(500).json({ error: "Failed to create PaymentIntent" }); } });
前端PaymentScreen核心代码
import { Text, FlatList, View, StyleSheet, Pressable, ActivityIndicator, Alert, } from "react-native"; import { useDispatch, useSelector } from "react-redux"; import React, { useState, useEffect } from "react"; import { useStripe } from "@stripe/stripe-react-native"; import Constants from "expo-constants"; import axios from "axios"; const PaymentScreen = () => { const FreshSabzi_API_URL = Constants?.expoConfig?.extra?.FreshSabzi_API_URL; const { initPaymentSheet, presentPaymentSheet } = useStripe(); const [clientSecret, setClientSecret] = useState(""); useEffect(() => { fetchPaymentIntentClientSecret(); }, []); const fetchPaymentIntentClientSecret = async () => { try { const response = await axios.post(`${FreshSabzi_API_URL}payment/intent`, { amount: 55, }); setClientSecret(response.data.clientSecret); } catch (error) { console.error("Error fetching PaymentIntent client secret:", error); } }; const onCheckout = async () => { console.log("clientSecret: " + clientSecret); const initResponse = await initPaymentSheet({ merchantDisplayName: "notJust.dev", paymentIntentClientSecret: clientSecret, defaultBillingDetails: { name: "Jane Doe", }, }); if (initResponse.error) { console.log(initResponse.error); Alert.alert("Something went wrong"); return; } console.log("presentPaymentSheet started: "); const paymentResponse = await presentPaymentSheet(); console.log("paymentResponse :" + JSON.stringify(paymentResponse)); if (paymentResponse.error) { Alert.alert( `Error code: ${paymentResponse.error.code}`, paymentResponse.error.message ); return; } onCreateOrder(); }; const onCreateOrder = async () => { Alert.alert("Order has been submitted"); }; return ( <> <Pressable onPress={onCheckout} style={styles.button}> <Text style={styles.buttonText}>Checkout</Text> </Pressable> </> ); }; const styles = StyleSheet.create({ totalsContainer: { margin: 20, paddingTop: 10, borderColor: "gainsboro", borderTopWidth: 1, }, row: { flexDirection: "row", justifyContent: "space-between", marginVertical: 2, }, text: { fontSize: 16, color: "gray", }, textBold: { fontSize: 16, fontWeight: "500", }, button: { position: "absolute", backgroundColor: "black", bottom: 30, width: "90%", alignSelf: "center", padding: 20, borderRadius: 100, alignItems: "center", }, buttonText: { color: "white", fontWeight: "500", fontSize: 16, }, }); export default PaymentScreen;
报错详情
"message": "As per Indian regulations, only registered Indian businesses (i.e. sole proprietorships, limited liability partnerships and companies, but not individuals) can accept international payments."
时间线补充:3D Secure attempt acknowledged 3D Secure was completed, but the customer hasn't been verified because the bank does not support 3D Secure, has not set up 3D Secure for the card, or is experiencing an outage. The card network has provided proof of the attempt.
具体解决步骤
切换为印度本地测试卡
测试国际发行的Visa/Mastercard会触发印度法规限制,改用Stripe官方提供的印度本地测试卡:- 印度Visa测试卡:
4000 0035 6000 0008 - 印度Mastercard测试卡:
5200 8282 8282 8210
这类卡符合印度本地支付场景,不会触发国际支付限制。
- 印度Visa测试卡:
完善PaymentIntent合规参数
在创建PaymentIntent时添加3D Secure自动触发配置,满足印度支付合规要求:const paymentIntent = await stripe.paymentIntents.create({ amount: req.body.amount * 100, currency: "inr", description: "Software development services", payment_method_types: ["card"], // 新增3D Secure配置 payment_method_options: { card: { request_three_d_secure: 'automatic' } } });配置测试账号的企业身份
若需模拟印度注册企业接收国际支付,在Stripe测试后台完善信息:- 进入Dashboard的「Business settings」
- 将企业类型设置为印度独资企业、LLP或公司,填写对应测试企业信息
配置完成后,测试账号会被识别为合规印度企业,支持国际支付测试。
优化前端账单信息
初始化PaymentSheet时,传递符合印度用户格式的账单信息:initPaymentSheet({ merchantDisplayName: "Your Indian Business Name", paymentIntentClientSecret: clientSecret, defaultBillingDetails: { name: "Rahul Sharma", address: { country: "IN", // 补充印度本地地址信息(可选) } }, });
内容的提问来源于stack exchange,提问作者Govinda Rajbhar

