diff --git a/lib/resources/Customers.js b/lib/resources/Customers.js index 208f4a1342..2976bd3a20 100644 --- a/lib/resources/Customers.js +++ b/lib/resources/Customers.js @@ -39,6 +39,12 @@ module.exports = StripeResource.extend({ path: '/{customer}/discount', }), + listPaymentMethods: stripeMethod({ + method: 'GET', + path: '/{customer}/payment_methods', + methodType: 'list', + }), + createBalanceTransaction: stripeMethod({ method: 'POST', path: '/{customer}/balance_transactions', diff --git a/test/resources/generated_examples_test.spec.js b/test/resources/generated_examples_test.spec.js index 7f6d698c8c..cfcd5cbfa7 100644 --- a/test/resources/generated_examples_test.spec.js +++ b/test/resources/generated_examples_test.spec.js @@ -39,6 +39,11 @@ describe('Customer', function() { const customers = await stripe.customers.list({limit: 3}); expect(customers).not.to.be.null; }); + + it('listPaymentMethods method', async function() { + const paymentMethods = await stripe.customers.listPaymentMethods('cus_xyz'); + expect(paymentMethods).not.to.be.null; + }); }); describe('BalanceTransaction', function() { diff --git a/types/2020-08-27/Customers.d.ts b/types/2020-08-27/Customers.d.ts index ae53e1244b..1d39be886f 100644 --- a/types/2020-08-27/Customers.d.ts +++ b/types/2020-08-27/Customers.d.ts @@ -664,6 +664,41 @@ declare module 'stripe' { interface CustomerDeleteDiscountParams {} + interface CustomerListPaymentMethodsParams extends PaginationParams { + /** + * A required filter on the list, based on the object `type` field. + */ + type: CustomerListPaymentMethodsParams.Type; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace CustomerListPaymentMethodsParams { + type Type = + | 'acss_debit' + | 'afterpay_clearpay' + | 'alipay' + | 'au_becs_debit' + | 'bacs_debit' + | 'bancontact' + | 'boleto' + | 'card' + | 'card_present' + | 'eps' + | 'fpx' + | 'giropay' + | 'grabpay' + | 'ideal' + | 'oxxo' + | 'p24' + | 'sepa_debit' + | 'sofort' + | 'wechat_pay'; + } + class CustomersResource { /** * Creates a new customer object. @@ -735,6 +770,15 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * Returns a list of PaymentMethods for a given Customer + */ + listPaymentMethods( + id: string, + params: CustomerListPaymentMethodsParams, + options?: RequestOptions + ): ApiListPromise; + /** * Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance). */