[ad_1]
I’ve built-in stripe in my challenge
code: right here in payButton serviceCall success response I get fee intent information so right here I’m presenting stripe card.. after including stripe card quantity exp date and cvv i get paymentMethodId with this and fee intentId(transaction id from paybutton success response) i’ve referred to as save_payment API in didCreatePaymentMethod after calling all two APIs in stripe dashboard fee incomplete and standing like beneath.. why? the place am i incorrect.. please information me
standing displaying “requires_payment_method”
not getting expenses information as effectively
{
“id”: “pi_3LWMATIAbhwaLb1OenxVAI”,
“object”: “payment_intent”,
“livemode”: false,
"standing": "requires_payment_method",
"quantity": 1170,
"amount_received": 0,
"expenses": {
"object": "listing",
"information": [
],
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: .put up, url: CommonUrl.request_payment){ [weak self] (resp) in
self?.makePayment = PaymentNewBuyModel(dictionary: resp.dict as NSDictionary? ?? NSDictionary())
self?.paymentIntentClientSecret = self?.makePayment?.end result?.intent?.client_secret
paymentIntentId = makePayment?.end result?.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: .put up, url: CommonUrl.save_payment) { [weak self] (resp) in
}
}
}
[ad_2]
