Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

unable to change the amount charged from iOS app #91

Open
aidan305 opened this issue Jul 8, 2020 · 1 comment
Open

unable to change the amount charged from iOS app #91

aidan305 opened this issue Jul 8, 2020 · 1 comment
Labels

Comments

@aidan305
Copy link

aidan305 commented Jul 8, 2020

I think the amount charged is hardcoded to 10.99 usd. I want to change the amount for the payment intent created I tried the below in my iOS app but it didn't work. any suggestions?

` func createPaymentIntent(completion: @escaping STPJSONResponseCompletionBlock) {
var url = URL(string: backendURL)!
url.appendPathComponent("create_payment_intent")

    AF.request(url, method: .post, parameters: ["amount": 4000 , "currency" : "USD"])
               .validate(statusCode: 200..<300)
               .responseJSON { (response) in
                switch (response.result){
                case .failure(let error):
                    completion(nil, error)
                case .success(let jsonResponse):
                    completion(jsonResponse as? [String : Any], nil)
                }
           }
}

`

@yuki-stripe
Copy link
Contributor

Hey @aidan305

We advise against having the client control the amount for security. I'd recommend passing some kind of ID (product ID, cart ID, etc) to the backend and calculate the price there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants