Android use service create orderId

Automn_Wind
New Community Member

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.yzl.seaatoshi, PID: 16047
com.paypal.checkout.order.OrderContextNotAvailableException: Tried to retrieve OrderContext before it was created.
at com.paypal.checkout.order.OrderContext$Companion.get(OrderContext.kt:27)
at com.paypal.checkout.order.UpdateOrderStatusAction$execute$orderContext$1.invokeSuspend(UpdateOrderStatusAction.kt:28)
at com.paypal.checkout.order.UpdateOrderStatusAction$execute$orderContext$1.invoke(Unknown Source:10)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
at com.paypal.checkout.order.UpdateOrderStatusAction.execute(UpdateOrderStatusAction.kt:27)
at com.paypal.checkout.order.AuthorizeOrderAction$execute$2.invokeSuspend(AuthorizeOrderAction.kt:21)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Login to Me Too
1 REPLY 1

Rumit
Contributor
Contributor

I had the same issue.

Please note: You can follow either Client-side integration or Server-side integration at a time.

 

If you create an order at client-side, you must capture the payment at client-side. and If you create an order at server-side, you must capture the payment at server-side.

 

My mistake was I was creating an order from server-side and trying to capture it from client-side.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.