Stripe Payments API: Pay to download from an iOS app instead of using a server

This is about the Payments API " https://stripe.com/docs/mobile/ios "

I was wondering if someone could charge a credit card using the stripe API from an iOS app instead of sending a stripeToken to the server.

One developer was able to do this in the Android version of our application by adding the Java Client Library strip to his application. It looks like android / java

 Stripe.apiKey = "sk_test_apikey";

 Map<String, Object> chargeParams = new HashMap<String, Object>();
 chargeParams.put("amount", 400);
 chargeParams.put("currency", "usd");
 chargeParams.put("source", "tok_321jlkj54545B");
 chargeParams.put("description", "Charge for test@example.com");

 Charge.create(chargeParams);

      

I need the iOS equivalent of the above Android / Java code for the Stripe Payments APIs. It might be an http request post, or there might already be a method for the native iOS library in Stripe.

I want to know if anyone was able to do this or if I really need to create a server for credit card payments from an iOS app.

Thank!

+3


source to share


1 answer


You must not do this. To create a board, you must use an API secret key. If your private API key reaches your application, then someone can get it at their end and then use it to make any API call on your behalf. This means they can create fees, refunds, transfers, etc.



You have to make this part of the server, and your iOS app (or Android) should never be a secret API key.

+4


source







All Articles