@@ -37,10 +37,26 @@ interface PaymentMethodsStyle {
37
37
paypal ?: PayPalConfiguration [ "style" ]
38
38
}
39
39
40
+ type PaymentMethodType =
41
+ | "scheme"
42
+ | "giftcard"
43
+ | "paypal"
44
+ | "applepay"
45
+ | "googlepay"
46
+ | ( string & { } )
47
+
40
48
/**
41
49
* Configuration options for the Adyen payment component.
42
50
*/
43
51
export interface AdyenPaymentConfig {
52
+ /**
53
+ * Payment methods to be used for subscriptions.
54
+ * This is an array of payment method types that are supported for subscription payments.
55
+ * For example, it can include "scheme" for card payments.
56
+ * @default all available payment methods
57
+ * @example ["scheme"]
58
+ */
59
+ subscriptionPaymentMethods ?: PaymentMethodType [ ]
44
60
/**
45
61
* Optional CSS class name for the card container.
46
62
*/
@@ -115,6 +131,7 @@ export function AdyenPayment({
115
131
giftcardErrorComponent,
116
132
onReady,
117
133
onSelect,
134
+ subscriptionPaymentMethods,
118
135
} = {
119
136
...defaultConfig ,
120
137
...config ,
@@ -486,6 +503,18 @@ export function AdyenPayment({
486
503
* to avoid showing them when the order has subscriptions
487
504
*/
488
505
paymentMethodsResponse . storedPaymentMethods = [ ]
506
+ /**
507
+ * Remove scheme payment methods
508
+ * because they are not supported in subscriptions
509
+ */
510
+ paymentMethodsResponse . paymentMethods =
511
+ subscriptionPaymentMethods != null &&
512
+ subscriptionPaymentMethods . length > 0
513
+ ? paymentMethodsResponse . paymentMethods . filter (
514
+ ( pm : { type : "scheme" } ) =>
515
+ subscriptionPaymentMethods . includes ( pm . type ) ,
516
+ )
517
+ : paymentMethodsResponse . paymentMethods
489
518
}
490
519
const options = {
491
520
locale : order ?. language_code ?? locale ,
0 commit comments