Open
Description
Summary
When you try to await your client secret within your applePayContext
delegate function, you receive an error regarding Sendable:
Passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure; this is an error in the Swift 6 language model
Closure captures 'completion' which is accessible to code in the current task
Code to reproduce
func applePayContext(
_ context: STPApplePayContext,
didCreatePaymentMethod paymentMethod: StripeAPI.PaymentMethod,
paymentInformation: PKPayment,
completion: @escaping STPIntentClientSecretCompletionBlock
) {
let contribution = self.contribution
Task {
do {
let clientSecret = try await contribution.clientSecret
completion(clientSecret, nil) // <- Here
} catch {
completion(nil, error)
}
}
}
iOS version
18.1.1
Installation method
SPM
SDK version
Stripe 24.1.0
Activity