Skip to content

Commit c459da6

Browse files
authored
Merge branch 'main' into add-sdk-logs-screen
2 parents 86b7289 + 961e0ad commit c459da6

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

src/pages/starter-kit/checkout/getting-started.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ You must install or have access to the following prerequisites to develop with t
2929

3030
## Install Commerce modules
3131

32+
Before installing Commerce modules, ensure that you have the required credentials in `auth.json` with [access to the Adobe Commerce repository](https://experienceleague.adobe.com/en/docs/commerce-operations/installation-guide/prerequisites/authentication-keys).
33+
3234
- Install the Out-of-Process Payment Extensions (OOPE) module on Adobe Commerce
3335

3436
To enable out-of-process payment methods in Commerce, install the `magento/module-out-of-process-payment-methods`. This module enables out-of-process payment functionalities.

src/pages/starter-kit/checkout/use-cases.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,83 @@ You can also enable webhook signature generation by following the [webhooks sign
138138
139139
Refer to [`actions/validate-payment.js`](https://github.com/adobe/commerce-checkout-starter-kit/blob/main/actions/validate-payment/index.js) for an example of how to receive the request and validate the payment according to the payment gateway needs.
140140

141+
## Payment methods: Filter out payment method
142+
143+
In some cases, you may want to filter out a payment method based on the cart details or the customer's information. For example, you may want to disable a payment method based on customer group or product attributes in the cart.
144+
145+
You can use the `plugin.magento.out_of_process_payment_methods.api.payment_method_filter.get_list` webhook to filter out a payment method. This webhook is triggered every time the list of available payment methods is requested, allowing you to filter out the payment methods based on the cart details or customer information.
146+
147+
The following example demonstrates how to add a webhook to the `plugin.magento.out_of_process_payment_methods.api.payment_method_filter.get_list` method:
148+
149+
```xml
150+
<method name="plugin.magento.out_of_process_payment_methods.api.payment_method_filter.get_list" type="after">
151+
<hooks>
152+
<batch name="check_product_stock">
153+
<hook name="check_product_stock" url="https://<yourappbuilder>.runtime.adobe.io/api/v1/web/commerce-checkout-starter-kit/filter-payment" method="POST" timeout="20000" softTimeout="0">
154+
<fields>
155+
<field name="payload" />
156+
</fields>
157+
</hook>
158+
</batch>
159+
</hooks>
160+
</method>
161+
```
162+
163+
Payload example:
164+
165+
```json
166+
{
167+
"payload": {
168+
"cart": {
169+
"entity_id": "1",
170+
"store_id": 1,
171+
"converted_at": null,
172+
"is_active": "1",
173+
...
174+
"items": [
175+
{
176+
"item_id": "4",
177+
"quote_id": "1",
178+
"product_id": "10",
179+
"store_id": 1,
180+
"weight": "124.000000",
181+
"qty": 2,
182+
"price": "600.0000",
183+
"base_price": "600.0000",
184+
...
185+
"product": {
186+
"entity_id": "10",
187+
...
188+
"attributes": {
189+
"manufacturer": "Two",
190+
"color": "Yellow",
191+
"country_origin": "France",
192+
...
193+
}
194+
},
195+
},
196+
...
197+
],
198+
},
199+
"customer": {
200+
"entity_id": "1",
201+
"website_id": "1",
202+
"email": "test@example.com",
203+
"group_id": "1",
204+
...
205+
}
206+
}
207+
}
208+
```
209+
210+
You can find examples of how to filter out payment methods using customer data or product attributes in your App Builder application in [`actions/filter-payment.js`](https://github.com/adobe/commerce-checkout-starter-kit/blob/main/actions/filter-payment/index.js).
211+
141212
## Shipping methods
142213

143214
You can add shipping methods to the checkout process by using [webhooks](../../webhooks/index.md).
144215

216+
To add shipping methods, you must [run a script to automatically create shipping carriers](./configure.md#create-shipping-carriers) or [create shipping carriers manually](./shipping-reference.md#shipping-api-reference) using the REST API. Only shipping methods with registered carriers are available in the checkout process.
217+
145218
After the webhook is registered, every time a shopping cart is requested, a synchronous call is dispatched to the App Builder application implementing the shipping method to calculate the shipping cost and provide the available shipping methods.
146219

147220
Refer to [`actions/shipping-methods.js`](https://github.com/adobe/commerce-checkout-starter-kit/blob/main/actions/shipping-methods/index.js) for an example of how to process the request and return the list of available shipping methods.

0 commit comments

Comments
 (0)