#tarunmv30
1 messages · Page 1 of 1 (latest)
Sure how can we help?
Im switching my app from test mode to production mode and im getting this error:
Error: This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys.
even though im using the correct keys
So there are 2 type of keys: Publishable pk_xxx and Secret sk_xxx
It seems you are using a backend API which needs a Secret key
i changed these keys so they arent real
but thats how its set up in my backend server so I know i didnt switch them up
Please remove your message above
Key are sensitive and you shouldn't share here as a public forum
@urban galleon
they are fake keys
but ok
I cant seem to pinpoint where this error is coming from
Error: No such customer: 'cus_NqJzetyAIQaaXl'
this is the new error im getting even though they are a connected account
@fleet cairn
That's because you may use a Platform key and look at a Customer belongs to a Connected Account, or vice versa
Customer belongs to a specific account
ahh let me see one second
What do i do if I made this app with a dummy test account and now Im trying to sink the same app that had total functionality with the real account credentials?
Because the new connect account has no customers yet
Sorry not sure I follow. You can create as many Connected Account and connect to your Platform as you want
Im basically taking my fully functional test app and making it production ready
the payments arent going through tho
pi_3NJ4AYLjIMtb03TO2Up24Zv1
this is the payment ID
can you see on your end whats holding it back? My functions arent logging any errors
@fleet cairn
Sure looking
I only see the Create PaymentIntent request, but not confirmation
Meaning your client never received it, or received but never processed it
let me see
let paymentRequest = PaymentRequest(cart: cart, isForDelivery: isForDelivery)
do {
let jsonData = try JSONEncoder().encode(paymentRequest)
if let userId = Auth.auth().currentUser?.uid {
let url = URL(string: "https://us-central1-neilsurbanoven.cloudfunctions.net/stripe/create-payment-intent/\(userId)")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = jsonData
```
with: request,
completionHandler: { (data, _, _) in
guard let data = data,
let json = try? JSONSerialization.jsonObject(with: data, options: [])
as? [String: Any],
let customerId = json["customer"] as? String,
let customerEphemeralKeySecret = json["ephemeralKey"] as? String,
let paymentIntentClientSecret = json["paymentIntent"] as? String,
let publishableKey = json["publishableKey"] as? String
else {
//error
return
}
STPAPIClient.shared.publishableKey = publishableKey
var configuration = PaymentSheet.Configuration()
configuration.style = .alwaysDark
configuration.merchantDisplayName = "Neils Urban Oven"
configuration.customer = .init(
id: customerId,
ephemeralKeySecret: customerEphemeralKeySecret
)
configuration.returnURL = "your-app-url://stripe-redirect"
configuration.allowsDelayedPaymentMethods = true
DispatchQueue.main.async {
self.paymentSheet = PaymentSheet(
paymentIntentClientSecret: paymentIntentClientSecret,
configuration: configuration
)
self.paymentSheet = PaymentSheet(paymentIntentClientSecret: paymentIntentClientSecret, configuration: configuration)
}
}
)
task.resume()
}```
I dont understand because all of the code worked earlier
all i did was change the connect account i was using in the app
@fleet cairn
Can you clarify what exactly you changed? Where in the code and from which value to which value?
The Swift code above is just to receive the clientSecret and you should be able to log paymentIntentClientSecret
so imagine im testing this app, i made a stripe connect account in test mode to connect to my platfrom account so that i could take a small transaction fee
the app works and is completely built out
so now i created the restaurant owner his own connect account accept not in test mode i made him a live account
and im just trying to replace the dummy connect account ID to the new owners account
and i changed my publishable and secret to my live keys as well since we are ready to take real payments now
@fleet cairn