For some cause the token is not getting set to my server. I get code 50 as a print error, however I can not seem to slender it down. Do any of you could have any thought? Under you will note all of the prints that I added to attempt to determine the place the issue is coming from. Principally the applePayContext(_:didCreatePaymentMethod:paymentInformation:completion:)
delegate methodology will not be being known as. Why that’s I do not know. All I’ve is error code 50. I checked service provider id in Xcode and on my developer account I’ve all of it arrange. In my class I’ve STPApplePayContextDelegate
and I’ve var paymentContext: STPApplePayContext?
@objc func applePayButtonTapped() {
print("Apple Pay button tapped")
let request = StripeAPI.paymentRequest(withMerchantIdentifier: "service provider.medical.daylike", nation: "US", forex: "EUR")
request.paymentSummaryItems = [PKPaymentSummaryItem(label: "Script", amount: NSDecimalNumber(string: "1.00"))]
print("Cost request particulars: (request)")
paymentContext = STPApplePayContext(paymentRequest: request, delegate: self)
print("Presenting Apple Pay sheet")
paymentContext?.presentApplePay()
print("yesue")
}
func applePayContext(_ context: STPApplePayContext, didCreatePaymentMethod paymentMethod: StripePayments.STPPaymentMethod, paymentInformation: PKPayment, completion: @escaping StripeApplePay.STPIntentClientSecretCompletionBlock) {
print("Apple Pay did create fee methodology")
let paymentMethodId = paymentMethod.stripeId
let quantity = 100 // Instance quantity in cents (€10.00)
createPaymentIntent(paymentMethodId: paymentMethodId, quantity: quantity) { end in
swap end result {
case .success(let clientSecret):
completion(clientSecret, nil)
case .failure(let error):
print("Error in creating fee intent: (error.localizedDescription)")
completion(nil, error)
}
}
}
func applePayContext(_ context: STPApplePayContext, didFailToCreatePaymentMethodWithError error: Error) {
print("Didn't create fee methodology: (error.localizedDescription)")
}
func applePayContext(_ context: STPApplePayContext, didCompleteWith standing: StripePayments.STPPaymentStatus, error: Error?) {
print("Apple Pay course of didCompleteWith standing: (standing)")
if let error = error as NSError? {
print("Error in Apple Pay course of: (error.localizedDescription), Code: (error.code)")
}
print("Apple Pay course of accomplished with standing: (standing)")
swap standing {
case .success:
// Cost succeeded
break
case .error:
// Cost failed
break
case .userCancellation:
// Person canceled the fee
break
@unknown default:
fatalError("Unknown Apple Pay standing")
}
}
My prints
Cost request particulars: <PKPaymentRequest: 0x14bde0f80; APIType: PKPaymentRequestAPITypeInApp, requestType: PKPaymentRequestTypeApplePay, requestor: PKPaymentRequestorDefault, countryCode: DE, merchantCapabilities: 1, currencyCode: EUR, shippingType: SHIPPING, applePayLaterAvailability: enabledshouldUseMerchantSession: 0, suppressTotal: 0, paymentSummaryPinned: 0, supportedNetworks: (
AmEx,
MasterCard,
Maestro,
Visa,
Uncover
), supportsCouponCode: 0, paymentSummaryItems: 1, requiredBillingContactFields: {(
submit
)}, >
Presenting Apple Pay sheet
yesue
Apple Pay course of didCompleteWith standing: error
Error in Apple Pay course of: There was an surprising error -- attempt once more in a couple of seconds, Code: 50
Apple Pay course of accomplished with standing: error