android-checkout-sdk icon indicating copy to clipboard operation
android-checkout-sdk copied to clipboard

Tried to retrieve OrderContext before it was created.

Open moisesaq opened this issue 2 years ago • 1 comments

I'm integrating the SDK PayPal in my project but I'm having an issue 😞. I start the checkout with orderId, but when I register the callbacks and call the approval.orderActions.authorize(in onApprove) I always get an error with this message Error(message=Authorize order failed., reason=Authorize order response was not successful. Tried to retrieve OrderContext before it was created)

StartCheckout

PayPalCheckout.startCheckout(createOrder = CreateOrder { actions ->
    actions.set("orderId")
})

Callbacks

PayPalCheckout.registerCallbacks(
    onApprove = OnApprove { approval ->
        approval.orderActions.authorize { result ->
            Timber.e(":-> Authorize order result: $result")
        }
    },
    onCancel = OnCancel {},
    onError = OnError {}
)

I've been debugging, I found that SDK is not creating the OrderContext and that is why it's always throwing the exception OrderContextNotAvailableException.

Note: When I start the checkout with an order, it works fine.

Could someone help me with this issue please? 🙏🏽

moisesaq avatar Mar 21 '23 02:03 moisesaq

i have the same problem,did you solve it?

Suboforme avatar Apr 06 '23 02:04 Suboforme