Filter brand kartu
Choose which card brands to accept
Use Stripe In-app Payments to control which card brands you accept. Card brand filtering lets you specify allowed or disallowed card brands for:
- The credit card form in In-app Payments
- The cards buyers can use with Apple Pay.
When you configure In-app Payments, you can specify one of two options:
allowed: Accept only the card brands you specify.disallowed: Accept all card brands except those you specify.
For either of these options, pass an array with any of the following card brand values as defined on EmbeddedPaymentElement.:
.visa .mastercard .amex .discover
Catatan
The discover value encompasses all of the cards that are part of the Discover Global Network, including Discover, Diners Club, JCB, UnionPay, and Elo.
This guide demonstrates how to use card brand filtering to only accept card payments from Visa and Mastercard branded cards.
Sebelum Anda memulai
- Create a Stripe account or sign in.
- Follow the Payment Element Accept In-app payments guide to integrate with Mobile Payment Element.
Filter brand kartu
When you create a EmbeddedPaymentElement. object, specify the card brands you want to allow or disallow using the cardBrandAcceptance property. This example shows how to allow only Visa and Mastercard:
import StripePaymentSheet class MyCheckoutVC: UIViewController { func createEmbeddedPaymentElement() async throws -> EmbeddedPaymentElement { // ... var configuration = EmbeddedPaymentElement.Configuration() configuration.cardBrandAcceptance = .allowed(brands: [.visa, .mastercard]) // ... } }
Uji integrasi Anda
Stripe provides a set of test card numbers that you can use to test your checkout flow and verify that the Mobile Payment Element accepts or blocks your desired card brands.
