For a store purchase, use a payment method accepted by that store for your account, region and selected purchase. The checkout shows your available options.
Apple: Open device Settings → your name → Payment & Shipping.
Google Play: Open Payments & subscriptions → Payment methods.
Also check the payment method assigned to the subscription if you want to change future renewals.
For website purchases, manage payment details through the website’s billing section. Updating a payment method does not change how a past charge was paid.