PhonePe / PhonePePayment

PhonePe Intent SDK for iOS provides a simple integration that you can use in your iOS application to process your Transactions through the PhonePe ecosystem.
3 stars 4 forks source link

redirection Issue #4

Closed vanijain3108 closed 5 days ago

vanijain3108 commented 3 months ago

I am implementing phonepepayment gateway but after the payment success the phone pe success screen stuck and not going back to the code also not coming inside the result . it only come in result when I forcefully cut the transaction and in failed case they come I implement URL scheme also nothing work kindly help for resolving this issue

PPPayment(environment: .sandbox, enableLogging: true, appId: phonePeAppId).startPG(transactionRequest: request, on: self, animated: true) { [self] _, result in print("Payment result received: (result)") // this function never come in side result after the payment success automatically

        below is the code which I am using 

        let payload = """
            {
                "merchantId": "\(merchantId)",
                "merchantTransactionId": "\(merchantTransactionId)",
                "merchantUserId": "\(merchantUserId)",
                "amount": \(amount),
                "callbackUrl": "\(callbackUrl)",
                "mobileNumber": "\(mobileNumber)",
                "paymentInstrument": {
                    "type": "\(paymentInstrumentType)"
                }
            }
            """
    let base64EncodedString = Data(payload.utf8).base64EncodedString()
    let checksum = sha256(base64EncodedString + apiEndPoint + salt) + "###" + saltIndex
    let headers: [String: String] = ["X-VERIFY": checksum]
    let request = DPSTransactionRequest(
        body: base64EncodedString,
        apiEndPoint: apiEndPoint,
        checksum: checksum,
        headers: headers,
        appSchema: "iOSIntentIntegration"
    )

    PPPayment(environment: .sandbox, enableLogging: true, appId: phonePeAppId).startPG(transactionRequest: request, on: self, animated: true) { [self] _, result in
        print("Payment result received: \(result)")
            switch result {
            case .success:
                print("Transaction successful: \(result)")

            case .failure(let error):
                print("Transaction failed: \(error)")
rajanarora27 commented 5 days ago

Please contact the integration team (merchant-integration@phonepe.com), they will help you with this.