Skip to content

Commit

Permalink
Merge pull request #2486 from spryker/matweew-patch-1
Browse files Browse the repository at this point in the history
Update integrate-stripe.md
  • Loading branch information
lenadoc committed Jan 31, 2024
2 parents 7f7e3f1 + 748d9d1 commit cdfce46
Showing 1 changed file with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class MessageBrokerDependencyProvider extends SprykerMessageBrokerDependencyProv

```

### 3. Configure channels in Message Broker configuration
## 3. Configure channels in Message Broker configuration

Add the following code to `src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php`:

Expand All @@ -152,13 +152,15 @@ class MessageBrokerConfig extends SprykerMessageBrokerConfig
}
```

## 4. Configure the OMS dependency provider
## 4. Configure the Order State Machine (OMS)
Your project is likely to have the following in `src/Pyz/Zed/Oms/OmsDependencyProvider.php` already. If not, add it:

```php
//...

use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendEventPaymentCancelReservationPendingPlugin;
use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendEventPaymentConfirmationPendingPlugin;
use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendEventPaymentRefundPendingPlugin;

//...

Expand All @@ -170,12 +172,13 @@ use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendEventPaymentConfirmati
protected function extendCommandPlugins(Container $container): Container
{
$container->extend(self::COMMAND_PLUGINS, function (CommandCollectionInterface $commandCollection) {

//...

$commandCollection->add(new SendEventPaymentConfirmationPendingPlugin(), 'Payment/SendEventPaymentConfirmationPending');

//...
// these two commands will be also supported soon.
$commandCollection->add(new SendEventPaymentRefundPendingPlugin(), 'Payment/SendEventPaymentRefundPending');
$commandCollection->add(new SendEventPaymentCancelReservationPendingPlugin(), 'Payment/SendEventPaymentCancelReservationPending');

return $commandCollection;
});
Expand All @@ -185,9 +188,19 @@ use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendEventPaymentConfirmati

```

### Optional: Configure your payment OMS
### Optional: Configure your own payment OMS

The complete default payment OMS configuration is available at `vendor/spryker/sales-payment/config/Zed/Oms/ForeignPaymentStateMachine01.xml`.

The payment flow of the default OMS involves authorizing the initial payment, which means that the amount is temporarily blocked when the payment method permits. Then, the OMS sends requests to capture, that is, transfer of the previously blocked amount from the customer's account to the store account.

The complete default payment OMS configuration is available at `/vendor/spryker/sales-payment/config/Zed/Oms/ForeignPaymentStateMachine01.xml`. Optionally, you can configure your own payment `config/Zed/oms/{your_payment_oms}.xml`as in the following example. This example demonstrates how to configure the order state machine transition from `ready for dispatch` to `payment capture pending`:
The `Payment/SendEventPaymentConfirmationPending` command initiates the capture action. By default, this command is initiated when a Back office user clicks **Ship** on the *Order Overview* page.

Optionally, you can change and configure your own payment OMS based on `ForeignPaymentStateMachine01.xml` from the core package and change this behavior according to your business flow. See [Install the Order Management feature](/docs/pbc/all/order-management-system/{{page.version}}/base-shop/install-and-upgrade/install-features/install-the-order-management-feature.html) for more information about the OMS feature and its configuration.

To configure your payment OMS based on `ForeignPaymentStateMachine01.xml`, copy `ForeignPaymentStateMachine01.xml` with `Subprocess` folder to the project root `config/Zed/oms`. Then, change the name of the file and the value of `<process name=` in the file.

This example demonstrates how to configure the order state machine transition from `ready for dispatch` to `payment capture pending`:

```xml
<?xml version="1.0"?>
Expand Down Expand Up @@ -240,7 +253,9 @@ The complete default payment OMS configuration is available at `/vendor/spryker/
</statemachine>
```

### Optional: Introduce template changes in `CheckoutPage`
By default, the timeout for the payment authorization action is set to one day. This means that if the order is in the 'payment authorization pending' state, the OMS will wait for a day and then change the order state to 'payment authorization failed'. Another day later, the order is automatically transitioned to the 'payment authorization canceled' state. Therefore, if you need to increase timeouts or change the states, modify the config/Zed/oms/Subprocess/PaymentAuthorization01.xml file according to your requirements.

## Optional: Introduce template changes in `CheckoutPage`

If you have rewritten `@CheckoutPage/views/payment/payment.twig` on the project level, do the following:

Expand Down Expand Up @@ -276,8 +291,7 @@ For example, there is a new external payment with the provider name Payone, foun

```csv
...
Payone,Payone Payments,en_US
Credit Card,Credit Card (Payone),en_US
Stripe,Pay Online with Stripe,en_US
```
Then run the data import for the glossary:

Expand Down

0 comments on commit cdfce46

Please sign in to comment.