Private preview
Filter card funding for Payment Element Private preview
Choose which card funding types to accept.
Want access to card funding filtering?
Card funding filtering is in private preview. Share your email address to request access.
Use this API to control which card funding types you accept. Card funding filtering lets you specify allowed funding types for:
- The credit card form in In-app Payments
- Saved payment methods
- The cards that customers can use with Apple Pay and Link
Specify which card funding types to allow using the allowedCardFundingTypes property. If you don’t set this property, all funding types are accepted by default.
This guide describes how to use card funding filtering to only accept debit cards.
Before you begin
- Create a Stripe account or sign in .
- You must first build a Mobile Payment Element integration .
Filter card funding
When you create an EmbeddedPaymentElement.Configuration object, specify the card funding types you want to allow using the allowedCardFundingTypes property. Pass any combination of the following values as defined on PaymentSheet.CardFundingType:
- . debit
- . credit
- . prepaid
- . unknown
Caution
Card funding filtering displays a warning message to customers but doesn’t prevent form submission. Always verify the card’s funding type on your server by checking the funding field on the ConfirmationToken or PaymentMethod object before you confirm the payment.
This example shows how to allow only debit cards:
@_spi(CardFundingFilteringPrivatePreview) import StripePaymentSheet
class MyCheckoutVC: UIViewController {
func createEmbeddedPaymentElement() async throws -> EmbeddedPaymentElement {
// ...
var configuration = EmbeddedPaymentElement.Configuration()
configuration.allowedCardFundingTypes = .debit
// ...
}
}
To allow multiple funding types, use an array:
configuration.allowedCardFundingTypes = [.debit, .credit]
Validate funding type before confirming
You must validate the funding type on your server before confirming the payment, because customers can always attempt confirmation regardless of client-side filtering.
When the customer submits the payment form, retrieve the confirmation token on your server and check its funding type before creating the PaymentIntent:
const confirmationToken = await stripe.confirmationTokens.retrieve(confirmationTokenId);
const funding = confirmationToken.payment_method_preview?.card?.funding;
const allowedFundingTypes = ['debit'];
if (funding && !allowedFundingTypes.includes(funding)) {
throw new Error('Only debit cards are accepted');
}
// Proceed with creating the PaymentIntent
const paymentIntent = await stripe.paymentIntents.create({
amount: 1099,
currency: 'usd',
confirmation_token: confirmationTokenId,
confirm: true,
});
Test your integration
Use Stripe’s test card numbers to test your checkout flow and to verify the Mobile Payment Element displays warnings for disallowed card funding types.
| Number | Funding type |
|---|---|
| Credit | |
| Debit | |
| Prepaid |
