question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UpdatePaymentMethod: unable to delete properties

See original GitHub issue

I’m unable to delete properties at all when trying to update a PaymentMethod. I’ve all 4 of the following approaches. I will use the address.city as an example:

  • PaymentMethodUpdateParams.BillingDetails.Address.builder().setCity(null)
  • PaymentMethodUpdateParams.BillingDetails.Address.builder().setCity(“”)
  • PaymentMethodUpdateParams.BillingDetails.Address.builder().putExtraParam(“postal_code”, null)
  • PaymentMethodUpdateParams.BillingDetails.Address.builder().putExtraParam(“postal_code”, “”

I’ve also tried mixing-and-matching these 4 cases, but nothing works.

I get this error when it’s empty string: com.stripe.exception.InvalidRequestException: You cannot set 'billing_details[address][line2]' to an empty string. We interpret empty strings as null in requests. You may set 'billing_details[address][line2]' to null to delete the property.

It seems to be roughly the same issue as: https://github.com/stripe/stripe-java/issues/788.

I would reckon that the PaymentMethod.update is almost completely useless without the ability to delete values.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ob-stripecommented, Oct 2, 2019

@decoursin You are correct, this is a bug in the library. There should be a setFooter(EmptyParam value) override, but it doesn’t exist currently. We’ll look into it and release a fix.

1reaction
ob-stripecommented, Jul 16, 2019

Hi @decoursin. Fields that can be unset have an overload method that accepts an EmptyParam value, e.g.: https://github.com/stripe/stripe-java/blob/4a7a241288cc626a6ef0142a1c3ec79ba5174857/src/main/java/com/stripe/param/CustomerUpdateParams.java#L255

The only valid EmptyParam value is EmptyParam.EMPTY. So for instance this is how you’d unset the address field on a customer:

Customer customer = Customer.retrieve("cus_123");
CustomerUpdateParams params = CustomerUpdateParams.builder()
  .setAddress(EmptyParam.EMPTY)
  .build();
Customer updatedCustomer = customer.update(params);

In the case of PaymentMethodUpdateParams, none of fields in billing_details[address] nor the parent field billing_details[address] itself are unsettable in the API, so the Java library does not provide overload methods to pass EmptyParam.EMPTY for any of these fields.

I will raise this issue internally, but I also recommend you reach out to support at https://support.stripe.com/email to request this feature and give some details about your use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to delete property | Booking.com for Partners
I setup 'new' property - in order to change some settings that were wrong. Now I am unable to delete the other property....
Read more >
Remove a payment method from your Apple ID - Apple Support
Remove a payment method online · Go to appleid.apple.com. · Tap or click Sign In, then sign in with your Apple ID. ·...
Read more >
Add, update, or delete a payment method - Microsoft Learn
This article describes how to add, update, or delete a payment method used to pay for an Azure subscription.
Read more >
Vault Products - Autodesk Knowledge Network
Issue: Users reported that when trying to delete a property with zero usage count in Vault it fails and the following message is...
Read more >
Unable to delete configuration properties from LWC?
1 Answer 1 ... Yes, this is a Very trick thing. For this, you Have to remove the "LWC" component from your record...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found