killbill-stripe fails adding payment methods with existing stripe customer using the /1.0/kb/accounts/{account_id}/paymentMethods endpoint

24 views
Skip to first unread message

tenchiro

unread,
Apr 6, 2026, 7:16:37 AMApr 6
to Kill Bill users mailing-list
It seems that the following endpoint:
/1.0/kb/accounts/{account_id}/paymentMethods
does not function as you would expect it to when adding new payment methods to existing customers with a linked customer account.

The linked customer account is in STRIPE_CUSTOMER_ID. When this is NOT set, the endpoint successfully creates a new account and payment method using a browser generated "token". Other plugin properties used are payment_method_id, and customer_id, and createStripeCustomer, though the efficacy is questionable.

Params include: pluginProperty and isDefault.
Payload includes: accountId and pluginName.

Attempting to add a second payment in a similar manner fails. The plugin seems to invoke a faulty stripe endpoint sequence. The payment method is then created in killbill, but never in Stripe. Thus, on the next Janitor refresh, it is quickly removed.

I have been able to work around this as follows:
1) Invoke the stripe api directly from the application server code as follows:
try:
# Attach the token to the customer as a source
card = stripe.Customer.create_source(
customer_id,
source=token_id
)
print(f"Successfully attached card {card.id} to customer {customer_id}")

# Set this card as the default payment source
stripe.Customer.modify(
customer_id,
default_source=card.id
)
print(f"Set card {card.id} as default payment method")
return card
except stripe.error.InvalidRequestError as e:
print(f"Invalid request: {e.user_message}")
raise
except stripe.error.StripeError as e:
print(f"Stripe error: {str(e)}")
raise

2) Invoke the Janitor with paymentMethods and refresh=true

The stripe calls cause the method to appear in stripe, then the refresh causes the new payment method to appear in killbill.

This is working, however, this completely breaks the plugin abstraction. Am I missing some plugin properties that might trrigger the possible behavior? If not, I think the plugin should do this detection on it's own.

Other solutons tried: The stripe documentation suggests using the strip payment method id rather than tokens, which are being phased out. However,  I could find no way to get the plugin to accept them. When you remove the token, it generates an error to include sessionId (not appropriate) or an external id, but the property as described in the error message doesn't seem to work.

Also, completely deleting the custom field and existing payment method causes it to register the new payment method, but it will have a completely different customer id on the stripe side. Stripe recommended not doing this.

Any info would be appreciated.

karan bansal

unread,
Apr 12, 2026, 5:15:21 AMApr 12
to Kill Bill users mailing-list
Hi,

It seems that in case of existing customer, there is an issue with adding a payment method, even though it works ok in case of new customers. Let me discuss this internally within the team and get back with more details.

Regards
Karan

tenchiro

unread,
Apr 13, 2026, 3:25:53 AMApr 13
to Kill Bill users mailing-list
Hello. Thank you for the response, Karan. I've been testing the above workaround (outside of the plugin) I made outside of the plugin with the stripe calls create_source() and modify() for almost a week, and it seems to be holding, creating the new method attached to the existing customer  (setting default, of course is optional). But the plugin abstraction would be preserved if it were to be moved inside the plugin. Thank you for looking at it.

karan bansal

unread,
Apr 17, 2026, 1:56:56 AM (11 days ago) Apr 17
to Kill Bill users mailing-list
Hi,

I have added a fix for adding payment method. Could you please try it now https://github.com/killbill/killbill-stripe-plugin and let me know how it goes.

Regards
Karan

Reply all
Reply to author
Forward
0 new messages