Skip to content

Commit

Permalink
Merge branch 'master' into feature/cc-32312-mp-agent-assist
Browse files Browse the repository at this point in the history
  • Loading branch information
andriitserkovnyi committed Jan 17, 2024
2 parents 2acf999 + 63a3942 commit 8c358ec
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _data/sidebars/pbc_all_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2402,6 +2402,15 @@ entries:
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/ratepay/integrate-payment-methods-for-ratepay/integrate-the-installment-payment-method-for-ratepay.html
- title: Invoice
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/ratepay/integrate-payment-methods-for-ratepay/integrate-the-invoice-payment-method-for-ratepay.html
- title: Stripe
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/stripe.html
nested:
- title: Install Stripe
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/install-stripe.html
- title: Configure Stripe
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/configure-stripe.html
- title: Disconnect Stripe
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/disconnect-stripe.html
- title: Unzer
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/unzer/unzer.html
nested:
Expand Down Expand Up @@ -3531,6 +3540,7 @@ entries:
include_versions:
- "202212.0"
- "202307.0"
- "202311.0"
- title: Disconnect Algolia
url: /docs/pbc/all/search/base-shop/third-party-integrations/algolia/disconnect-algolia.html
- title: Best practices
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: Configure Stripe
description: Find out how you can configure the Stripe app in your Spryker shop
draft: true
last_updated: Jan 31, 2024
template: howto-guide-template
related:
- title: Stripe
link: docs/pbc/all/payment-service-provider/page.version/base-shop/third-party-integrations/stripe/stripe.html
redirect_from:
- /docs/pbc/all/payment-service-provider/202311.0/third-party-integrations/stripe/install-stripe.html
---
Once you have [installed Stipe](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/install-stripe.html), you can configure it.

## Prerequisites

Before configuring Stripe, ensure you have a Stripe account which is connected to the Spryker platform. If you are unsure how to do it, contact the Spryker support team.

## Configure Stripe

1. In your store's Back Office, go to **Apps**.
2. Click **Stripe**.
This takes you to the Stripe app details page.
3. In the top right corner of the Stripe app details page, click **Connect app**.
This displays a message about the successful connection of the app to your SCCOS. The Stripe app's status changes to *Connection pending*.
4. Go to [Stripe Dashboard](https://dashboard.stripe.com) and copy your account ID. For details on how to obtain the Stipe account it, see the [Stripe documentation](https://stripe.com/docs/payments/account).

{% info_block infoBox "Info" %}

It takes some time to obtain an account ID from Stripe because you have to go through a thorough vetting process, such as the "know your customer" (KYC) process, before Stripe verifies you.

{% endinfo_block %}

5. Go back to your store's Back Office, to the Stripe app details page.
6. In the top right corner of the Stripe app details page, click **Configure**.
7. In the *Configure* pane, fill in the *ACCOUNT ID* field with value from step 4.
8. In *Environment*, select the Stripe environment mode. For details in the Stipe modes, see the [Stripe documentation](https://stripe.com/docs/test-mode).
9. Optionally: In *Payment page title*, enter your shop name. This name will be displayed on the *Payment* page as a merchant label for the payee.
![stripe-configuration](https://spryker.s3.eu-central-1.amazonaws.com/docs/pbc/all/payment-service-providers/stripe/configure-stripe/stripe-configuration.png)
10. Click **Save**.
If the app was connected successfully, a corresponding message appears, and the app status changes to **Connected**.
11. Activate Stripe in your store's Back office, in **Administration** -> **Payment methods**. For details, see [Edit payment methods](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/manage-in-the-back-office/edit-payment-methods.html).


Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Disconnect Stripe
description: Learn how you can disconnect the Stripe app from your Spryker shop
template: howto-guide-template
redirect_from:
- /docs/pbc/all/payment-service-provider/stripe/disconnect-stripe.html
- /docs/pbc/all/payment-service-provider/202311.0/third-party-integrations/stripe/integration-in-the-back-office/disconnect-stripe.html
---

Disconnecting Stripe from your store removes its payment methods from the store configuration. However, you can disconnect Stripe only if there are no open orders that still use the Stripe payment method.

To disconnect the Stripe app from your store, do the following:
1. In your store's Back Office, go to **Apps**.
2. Click **Stripe**.
3. On the Stripe app details page, next to the **Configure** button, hold the pointer over <span class="inline-img">![disconnect-button](https://spryker.s3.eu-central-1.amazonaws.com/docs/aop/user/apps/bazzarvoice/disconnect-button.png)</span> and click **Disconnect**.
4. In the message that appears, click **Disconnect**. This removes the Stripe configurations from the Back Office and from the Storefront.
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
---
title: Install Stripe
description: Find out how you can install Stripe in your Spryker shop
draft: true
last_updated: Jan 31, 2024
template: howto-guide-template
related:
- title: Stripe
link: docs/pbc/all/payment-service-provider/page.version/base-shop/third-party-integrations/stripe/stripe.html
redirect_from:
- /docs/pbc/all/payment-service-provider/202311.0/third-party-integrations/stripe/install-stripe.html

---
This document describes how to integrate [Stripe](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/stripe.html) into a Spryker shop.

## Prerequisites

Before integrating Stripe, ensure the following prerequisites are met:

- Make sure your project is ACP-enabled. See [App Composition Platform installation](/docs/acp/user/app-composition-platform-installation.html) for details.

- The Stripe app catalog page lists specific packages that must be installed or upgraded before you can use the Stripe app. To check the list of the necessary packages, in the Back Office, go to **Apps**-> **Stripe**. Ensure that your installation meets these requirements.

## 1. Configure shared configs

Your project probably already contains the following code in `config/Shared/config_default.php` already. If not, add it:

```php
// ...

use Generated\Shared\Transfer\PaymentConfirmationFailedTransfer;
use Generated\Shared\Transfer\PaymentConfirmationRequestedTransfer;
use Generated\Shared\Transfer\PaymentConfirmedTransfer;
use Generated\Shared\Transfer\PaymentMethodAddedTransfer;
use Generated\Shared\Transfer\PaymentMethodDeletedTransfer;
use Generated\Shared\Transfer\PaymentPreauthorizationFailedTransfer;
use Generated\Shared\Transfer\PaymentPreauthorizedTransfer;
use Spryker\Shared\Sales\SalesConstants;
use Spryker\Shared\Oms\OmsConstants;
use Spryker\Zed\Oms\OmsConfig;
use Spryker\Zed\Payment\PaymentConfig;

// ...

$config[OmsConstants::PROCESS_LOCATION] = [
// ...
OmsConfig::DEFAULT_PROCESS_LOCATION,
APPLICATION_ROOT_DIR . '/vendor/spryker/sales-payment/config/Zed/Oms',
];
$config[OmsConstants::ACTIVE_PROCESSES] = [
// ...
'ForeignPaymentStateMachine01',
];
$config[SalesConstants::PAYMENT_METHOD_STATEMACHINE_MAPPING] = [
// ...
PaymentConfig::PAYMENT_FOREIGN_PROVIDER => 'ForeignPaymentStateMachine01',
];

$config[MessageBrokerConstants::MESSAGE_TO_CHANNEL_MAP] =
$config[MessageBrokerAwsConstants::MESSAGE_TO_CHANNEL_MAP] = [
PaymentMethodAddedTransfer::class => 'payment-method-commands',
PaymentMethodDeletedTransfer::class => 'payment-method-commands',
PaymentConfirmationRequestedTransfer::class => 'payment-commands',
PaymentPreauthorizedTransfer::class => 'payment-events',
PaymentPreauthorizationFailedTransfer::class => 'payment-events',
PaymentConfirmedTransfer::class => 'payment-events',
PaymentConfirmationFailedTransfer::class => 'payment-events',
];

$config[MessageBrokerAwsConstants::CHANNEL_TO_RECEIVER_TRANSPORT_MAP] = [
// ...

'payment-method-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT,
'payment-events' => MessageBrokerAwsConfig::SQS_TRANSPORT,
];

$config[MessageBrokerAwsConstants::CHANNEL_TO_SENDER_TRANSPORT_MAP] = [
// ...

'payment-commands' => 'http',
];

```


## 2. Configure the Message Broker dependency provider

Your project probably already contains the following code in `src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php` already. If not, add it:

```php

namespace Pyz\Zed\MessageBroker;

use Spryker\Zed\MessageBroker\MessageBrokerDependencyProvider as SprykerMessageBrokerDependencyProvider;
use Spryker\Zed\Payment\Communication\Plugin\MessageBroker\PaymentConfirmationFailedMessageHandlerPlugin;
use Spryker\Zed\Payment\Communication\Plugin\MessageBroker\PaymentConfirmedMessageHandlerPlugin;
use Spryker\Zed\Payment\Communication\Plugin\MessageBroker\PaymentMethodMessageHandlerPlugin;
use Spryker\Zed\Payment\Communication\Plugin\MessageBroker\PaymentPreauthorizationFailedMessageHandlerPlugin;
use Spryker\Zed\Payment\Communication\Plugin\MessageBroker\PaymentPreauthorizedMessageHandlerPlugin;

class MessageBrokerDependencyProvider extends SprykerMessageBrokerDependencyProvider
{
/**
* @return array<\Spryker\Zed\MessageBrokerExtension\Dependency\Plugin\MessageHandlerPluginInterface>
*/
public function getMessageHandlerPlugins(): array
{
return [
// ...

# These plugins are handling messages sent from Stripe app to SCCOS.
new PaymentConfirmationFailedMessageHandlerPlugin(),
new PaymentConfirmedMessageHandlerPlugin(),
new PaymentPreauthorizationFailedMessageHandlerPlugin(),
new PaymentPreauthorizedMessageHandlerPlugin(),
new PaymentMethodMessageHandlerPlugin(),
];
}
}

```

## 3. Add Stripe domain to your allowlist

To enable Stripe to redirect your customers to the Stripe payment page and later to your payment success page, you must add the ACP domain inside your *Content Security Policy* allowlist. To do that, change your `deploy-{your_environment}.yml` file or your `config/Shared/config_default.php` file if changing the environment variable isn't possible.

In the `deploy.yml` file, introduce the required changes:

```yml
image:
environment:
SPRYKER_AOP_APPLICATION: '{
"APP_DOMAINS": [
"stripe.acp.spryker.com",
...
],
...
}'
```
Alternatively, you may add the domain to the allowlist from the `config/Shared/config_default.php` file. If you updated the `deploy.yml` file, ignore this step.

```php
$config[KernelConstants::DOMAIN_WHITELIST][] = 'stripe.acp.spryker.com';
```

## 4. Configure the OMS dependency provider
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\SendEventPaymentConfirmationPendingPlugin;
// ...
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Kernel\Container
*/
protected function extendCommandPlugins(Container $container): Container
{
$container->extend(self::COMMAND_PLUGINS, function (CommandCollectionInterface $commandCollection) {
// ...
$commandCollection->add(new SendEventPaymentConfirmationPendingPlugin(), 'Payment/SendEventPaymentConfirmationPending');
// ...
return $commandCollection;
});
return $container;
}
```

### Optional: Configure your payment OMS

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`:

```xml
<?xml version="1.0"?>
<statemachine
xmlns="spryker:oms-01"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="spryker:oms-01 http://static.spryker.com/oms-01.xsd"
>
<process name="SomePaymentProcess" main="true">
<!-- other configurations -->
<states>
<!-- other states -->
<state name="payment capture pending" display="oms.state.in-progress"/>
<!-- other states -->
</states>
<transitions>
<!-- other transitions -->
<transition happy="true">
<source>ready for dispatch</source>
<target>payment capture pending</target>
<event>capture payment</event>
</transition>
<!-- other transitions -->
</transitions>
<events>
<!-- other events -->
<event name="capture payment" onEnter="true" command="Payment/SendEventPaymentConfirmationPending"/>
<!-- other events -->
</events>
</process>
</statemachine>
```


## Next step
[Configure Stripe in the Back Office](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/configure-stripe.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Stripe
description: Stripe technology partner
last_updated: Jan 31, 2024
template: concept-topic-template
related:
- title: Install Stripe
link: docs/pbc/all/payment-service-provider/page.version/base-shop/third-party-integrations/stripe/install-stripe.html
---

The Spryker-Stripe integration is a part of the App Composition Platform. TThis integration is built with support for both the default Storefront as well as Spryker’s GLUE APIs. For more information about Stripe, see the [Stipe website](https://stripe.com/en-de).

## Next steps

[Install Stripe](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/install-stripe.html)

0 comments on commit 8c358ec

Please sign in to comment.