Actually I have implemented auto-renewable subscription feature using In-App Purchase on my project.
It throws payment cancelled when I try adding card whilst subscribing. If card is already added, it is working fine.
But App store shows subscription and payment done.
I have used SwiftyStoreKit library which is no longer maintained from May 1.
I have tested all in production mode by downloading app from app store.
Is there any way to test it while development? In sandbox mode, there is no option to test by adding card or paypal.
No,
there is no option to test it while in development. It might be possible to simulate the exact same scenario, but with "parental permissions" - create IAP product that requires parental permissions, and make sure your account is "child" or "limited" - it should have similar flow like expired credit card. Although I have not tested it, but worth a shot.
what happens is that if you add new transaction to the transaction queue, and credit card has expired, you will get "transaction failed" in your queue. If user then fills out the correct credit card, you will get "transaction succeeded" message.
https://forums.developer.apple.com/thread/6431
here you can read more about credit card expiration.