Customise
Last Updated - Platform 22.0 - SDK 17.0From v22 onwards most features require no code as they are automatically set up by the Coordinators that construct them. This page highlights the key customisation points for this feature.
Overview
The Web Checkout feature is is made up of two frameworks:
- The
PoqWebCheckout
framework for the Web Checkout UI and bridge logic. - The
PoqWebCheckoutClient
framework for the Web Checkout domain and data layers.
Container Dependencies
Containers can be used to replace most feature dependencies with one line of code.
For the Web Checkout this should be done in the AppModule
on didAddToPlatform
in an organised function such as setUpCheckout
or setUpDependencies
.
Customise the Coordinator
The Coordinator builds the WebCheckoutViewController
using the WebCheckoutBuilder
and can be easily replaced via Containers.
// You can omit the generic type to use the default 'CheckoutWebViewController<PoqCheckoutState>'.Container.shared.coordinators.webCheckout.replace { PoqWebCheckoutCoordinator() { // Customise the builder here. WebCheckoutBuilder(type: .forForms()) }}
// For a more complex scenario you do need to specify the generic state parameter.Container.shared.coordinators.webCheckout.replace { PoqWebCheckoutCoordinator<CustomCheckoutState, CustomCheckoutWebViewController>() { // Customise the builder here. WebCheckoutBuilder(type: .forJavaScript(applePay: ...)) }}