微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PaymentSDK iOS-Apple Pay问题:错误代码= -3“交易失败”

如何解决PaymentSDK iOS-Apple Pay问题:错误代码= -3“交易失败”

嗨,我尝试将PaymentSDK与ApplePay一起使用。这是我在paymentAuthorizationViewController内的代码

let wPayment = WDECApplePayPayment()
    wPayment.payment = payment
    wPayment.summaryItems = [
        PKPaymentSummaryItem(label: teleMed2_paymentId,amount: NSDecimalNumber(value: teleMed2_paymentAmt))
    ]
    wPayment.currency = "SGD"
    wPayment.transactionType = .purchase
    wPayment.signature = teleMed2_paymentId
    wPayment.merchantAccountID = Constants.API.TeleMed2_merchantAccountId
    wPayment.requestID = teleMed2_paymentId
    let tmpAmount = NSDecimalNumber.init(value: teleMed2_paymentAmt)
    wPayment.amount = tmpAmount.round(2)
    self.client?.make(wPayment,withCompletion:{(response: WDECPaymentResponse?,error: Error?) in
        guard let error = error else { return }
        if let response = response {
            //self.handleResponse(response)
            print("FINAL-SUCCESS:\(response.description)")
        }
        else{
            print("FINAL-ERROR:\(error)")
        } })

这是我遇到的错误

Error Domain=com.wirecard.error Code=-3 "Transaction has Failed" UserInfo={NSLocalizedDescription=Transaction has Failed,NSUnderlyingError=0x281c9c300 {Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request Failed: bad request (400)" UserInfo={NSLocalizedDescription=Request Failed: bad request (400),NSUnderlyingError=0x281d0a190 {Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request Failed: unacceptable content-type: (null)" UserInfo={NSLocalizedDescription=Request Failed: unacceptable content-type: (null),NSErrorFailingURLKey=https://test.wirecard.com.sg/engine/mobile/v2/payments,com.alamofire.serialization.response.error.data=<5369676e 61747572 6520626f 64792069 73206e6f 74207661 6c69642e>,com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x28137bb20> { URL: https://test.wirecard.com.sg/engine/mobile/v2/payments } { Status Code: 400,Headers {
Connection =     (
    close
);
"Content-Length" =     (
    28
);
Date =     (
    "Thu,05 Nov 2020 05:06:03 GMT"
);
Server =     (
    Apache
);
"Strict-Transport-Security" =     (
    "max-age=63072000; includeSubdomains;"
);
"X-Content-Type-Options" =     (
    nosniff
);
"X-XSS-Protection" =     (
    "1; mode=block");}}}},05 Nov 2020 05:06:03 GMT"
);
Server =     (
    Apache
);
"Strict-Transport-Security" =     (
    "max-age=63072000; includeSubdomains;"
);
"X-Content-Type-Options" =     (
    nosniff
);
"X-XSS-Protection" =     (
    "1; mode=block"
);}}}}}

这似乎是罪魁祸首-“请求失败:不可接受的内容类型:(空)” ,但是我不知道如何设置它的内容类型,因为一切都很简单-转发。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。