カードブランドを絞り込む
受け付けるカードブランドを選択する
Use the Stripe Mobile Payment Element to control which card brands you accept. Card brand filtering lets you specify allowed or disallowed card brands for:
- The credit card form in the Mobile Payment Element.
- The cards buyers can use with Apple Pay.
When you configure the Mobile Payment Element, you can specify one of two options:
Allowed
: Accept only the card brands you specify.Disallowed
: Accept all card brands except those you specify.
これらのオプションのいずれかに、PaymentSheet.
で定義されている以下のカードブランド値を含む配列を渡します。
.
Visa .
Mastercard .
Amex .
Discover
注
Discover
の値には、ディスカバー、ダイナースクラブ、JCB、銀聯、Elo など、ディスカバー・グローバル・ネットワークに属するすべてのカードが指定されます。
このガイドでは、カードブランドのフィルタリングを使用して、Visa および Mastercard ブランドのカードからのカード支払いのみを受け付ける方法について説明します。
はじめに
- Stripe アカウントを作成するかサインインします。
- Follow the steps in Accept in-app payments to integrate with the Mobile Payment Element.
カードブランドを絞り込む
PaymentSheet の作成時に、cardBrandAcceptance
プロパティを使用して、許可または禁止するカードブランドを指定します。以下は、Visa と Mastercard のみを許可している例です。
import { useStripe } from '@stripe/stripe-react-native'; export default function CheckoutScreen() { const { initPaymentSheet } = useStripe(); const initializePaymentSheet = async () => { const { error } = await initPaymentSheet({ // ... other configuration options cardBrandAcceptance: { filter: PaymentSheet.CardBrandAcceptanceFilter.Allowed, brands: [PaymentSheet.CardBrandCategory.Visa, PaymentSheet.CardBrandCategory.Mastercard], }, }); if (error) { // handle error } }; }
構築したシステムをテストする
Stripe には、決済フローをテストし、Mobile Payment Element が目的のカードブランドを受け入れるかブロックするかを確認するために使用できる、テストカード番号のセットが用意されています。
