coopcycle / coopcycle-app

CoopCycle native app
MIT License
151 stars 33 forks source link

Replace the in-app payment screen with a webview #1573

Open r0xsh opened 11 months ago

r0xsh commented 11 months ago

To streamline the application by reducing dependencies and paving the way for seamless integration with payment providers, we aim to implement a payment solution using the WebView component.

The goal is to update the endpoint, /api/orders/:id/pay, which will facilitate payments through a WebView for specific payment providers. This endpoint should respond with JSON structured as follows:

{
  "type": "webview",
  "webview_url": "https://xxx.coopcycle.org/orders/:id/pay/webview?=:payment_provider"
}

The payment process itself will be managed within the WebView using a web form. Upon completion of the payment process within the WebView, a custom JavaScript event will be triggered. This event, as described in the React Native WebView documentation, will notify the React Native application about the payment's status, whether it succeeded, failed, or was abandoned.

vladimir-8 commented 1 week ago

https://github.com/orgs/coopcycle/discussions/33