stripe payments - How to set pass api key within NSURLRequest in iOS? -
as of have so:
nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring: requrlstr]]; nsurlresponse *resp = nil; nserror *error = nil; nsdata *response = [nsurlconnection sendsynchronousrequest: request returningresponse: &resp error: &error]; nsstring *responsestring = [[nsstring alloc] initwithdata:response encoding:nsutf8stringencoding]; return responsestring;
and call so:
nsstring *stripecustomerrequesturl = [nsstring stringwithformat:@"https://api.stripe.com/v1/customers/%@",stripecustomerid]; // nsstring return of tax in decimal form nsstring *customerinformation = [self retrievestripecustomer:stripecustomerrequesturl];
i getting error know need pass api key how can i?
{ "error": { "type": "invalid_request_error", "message": "you did not provide api key. need provide api key in authorization header, using bearer auth (e.g. 'authorization: bearer your_secret_key'). see https://stripe.com/docs/api#authentication details, or can @ https://support.stripe.com/." } }
it not considered secure using stripe secret api key code runs on client device (ios / android apps, desktop apps, etc). include api key in shipped binary, can assume inspect binary , able extract strings it, including api key compromising it.
your api key should used on server control. ios app can call endpoints on server , in turn server call out stripe.
Comments
Post a Comment