Reputation: 1228
I am attempting to integrate Stripe payments into my Android application, and so far things are going well - however - I noticed in the Stripe docs that they have a concept of Idempotent requests (essentially making sure the user won't be charged twice).
The Java code example uses a RequestOptions
object, however, this object does not appear to be given to me in the Android SDK, and the Charge.create constructors available to me do not allow for such an object to be passed along.
So my question - is there a way I can perform Idempotent requests in Android? This seems pretty important given the possibility of retrying requests due to network connectivity issues.
For note, I am using gradle to include the Stripe SDK:
compile 'com.stripe:stripe-android:+'
Upvotes: 1
Views: 790
Reputation: 4648
You should only be generating tokens from Stripe-Android. These tokens represent the card but do not actually generate any charges. This is because creating a charge in Stripe requires your secret key and you don't want to publish that.
You would then take the token and send that to your server. Your server could then include the idempotency key in its request to Stripe.
You may wish to have some idempotency system with your app and your server but that would be out of the scope of Stripe.
Upvotes: 1