paypal / paypalcheckout-ios

Need to add Native Checkout to your iOS Application? We can help!
http://www.paypal.com
Other
70 stars 55 forks source link

[🐞] Bug Report: payerID is empty string, paymentID is nil #54

Closed vasylnahuliak closed 2 years ago

vasylnahuliak commented 3 years ago

🐞 Describe the Bug

setOnApproveCallback return approval.data with payerID is empty string, paymentID is nil

πŸ”¬ Minimal Reproduction

Programmatically start the SDK https://developer.paypal.com/docs/business/native-checkout/ios/programmatically-start-sdk/

import PayPalCheckout

@objc(Paypal)
class Paypal: NSObject {
    @objc func checkout(
        _
            clientID: String,
        returnURL: String,
        useSandbox: Bool,
        orderID: String,
        resolver: @escaping RCTPromiseResolveBlock,
        rejecter: @escaping RCTPromiseRejectBlock
    ) -> Void {
        let environment = useSandbox ? Environment.sandbox : Environment.live
        let config = CheckoutConfig(
            clientID: clientID,
            returnUrl: returnURL,
            environment: environment
        )

        Checkout.set(config: config)

        Checkout.setCreateOrderCallback { createOrderActions in
            createOrderActions.set(billingAgreementToken: orderID)
        }

        Checkout.setOnApproveCallback { approval in
            resolver([
                "ecToken": approval.data.ecToken,
                "payerID": approval.data.payerID,
                "paymentID": approval.data.paymentID
            ])
        }

        Checkout.setOnErrorCallback { error in
            rejecter(error.reason, error.description, nil)
        }

        DispatchQueue.main.async {
            Checkout.start()
        }

    }
}

πŸ˜• Actual Behavior

payerID is empty string, paymentID is nil

πŸ€” Expected Behavior

payerID and paymentID must be in setOnApproveCallback response

🌍 Environment

βž• Additional Context

Create for React Native bridge, checkout function called from JS

minhthenguyen commented 3 years ago

Hi @vasylnahuliak Thank you for reporting this issue to us, we're working on a fix for this now. We'll let you know when to expect it in a release.

vasylnahuliak commented 3 years ago

@minhthenguyen excuse me, is there any news?

minhthenguyen commented 3 years ago

@vasylnahuliak Sorry for the late response, I'm following up with our team on this fix and will let you know as soon as I get more info.

minhthenguyen commented 2 years ago

Hi @vasylnahuliak Sorry for the long delay, the fix for this has now been deployed. The paymentID doesn't apply for our billing agreement flow so it won't be available. But the payerID has been added. Please check and let us know if there's any further issue. Thank you.

minhthenguyen commented 2 years ago

Closing this issue as the bug has been fixed. If you encounter further issues/questions down the line please feel free to open another.