coopcycle-app icon indicating copy to clipboard operation
coopcycle-app copied to clipboard

Replace the in-app payment screen with a webview

Open r0xsh opened this issue 1 year ago • 0 comments

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.

r0xsh avatar Oct 10 '23 12:10 r0xsh