[ad_1]
To finish stripe fee i’ve two APIs from backend 1)request-payment 2) save-payment
when i click on payButton i’m calling request-payment API and in its success response getting intent information right here i’m amassing paymentIntentId and i’m presenting stripe view controller… after including card particulars in accomplished technique calling save-payment API with paymentMethod.stripeId and paymentIntentId however my fee shouldn’t be success why?
code: with this code fee intent is created efficiently however standing shouldn’t be success its displaying requires_payment_method
import UIKit
import Stripe
class NewBuyRequestPaymentVC: UIViewController, STPAddCardViewControllerDelegate{
@IBAction func payButton(_ sender: UIButton) {
let param: [String: Any] = [
"description": descriptionTextField.text ?? "No description",
"amount": amountTextField.text ?? "0.0",
"enquiry_id": enqrId ?? "",
]
APIReqeustManager.sharedInstance.serviceCall(param: param, technique: .submit, url: CommonUrl.request_payment){ [weak self] (resp) in
self?.makePayment = PaymentNewBuyModel(dictionary: resp.dict as NSDictionary? ?? NSDictionary())
self?.paymentIntentClientSecret = self?.makePayment?.outcome?.intent?.client_secret
paymentIntentId = makePayment?.outcome?.intent?.id
//right here i'm presenting stripe viewcontoller with card
let config = STPPaymentConfiguration.shared
config.requiredBillingAddressFields = .none
let viewController = STPAddCardViewController(configuration: config, theme: STPTheme.defaultTheme)
viewController.delegate = self
let navigationController = UINavigationController(rootViewController: viewController)
self?.current(navigationController, animated: true, completion: nil)
}
}
func addCardViewControllerDidCancel(_ addCardViewController: STPAddCardViewController) {
dismiss(animated: true, completion: nil)}
@objc
func addCardViewController(_ addCardViewController: STPAddCardViewController, didCreatePaymentMethod paymentMethod: STPPaymentMethod, completion: @escaping STPErrorBlock) {
paymentMethodId = paymentMethod.stripeId
print("fee technique id (paymentMethodId ?? "")")
savePaymentServiceCall()
dismiss(animated: true, completion: nil)
}
func savePaymentServiceCall(){
print("fee transaction and technique id (String(describing: paymentIntentId)), (String(describing: paymentMethodId))")
let param = ["term_id" : makePayment?.result?.term_id?.description ?? "",
"payment_method" : paymentMethodId ?? "",
"intent_id" : paymentIntentId ?? ""
] as [String : Any]
APIReqeustManager.sharedInstance.serviceCall(param: param as [String : Any], technique: .submit, url: CommonUrl.save_payment) { [weak self] (resp) in
}
}
}
response in stripe doc
after two API calling i’ve checked in stripe document-> funds its displaying incomplete and if i checked its intent then its displaying "standing": "requires_payment_method" why?
the place am i unsuitable.. the way to make fee success.. please do assist
{
"id": "pi_3LWMATIAbhwaLb1OenxVAI",
"object": "payment_intent",
"livemode": false,
"standing": "requires_payment_method",
"quantity": 1170,
"amount_received": 0,
"fees": {
"object": "record",
"information": [
],
right here in iOS fee is incomplete however with identical APIs its success for android
[ad_2]
