Skip to content

Commit

Permalink
Merge pull request #2574 from spryker/feature/acp-2521/master-stripe-…
Browse files Browse the repository at this point in the history
…app-save-stripe-psp-details-in-scos

ACP-2521 Added SalesPaymentDetail docs and update Stripe docs.
  • Loading branch information
andriitserkovnyi authored Mar 27, 2024
2 parents c1915ce + dd1305c commit 84ca1af
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 97 deletions.
16 changes: 11 additions & 5 deletions _data/sidebars/pbc_all_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2183,6 +2183,8 @@ entries:
url: /docs/pbc/all/payment-service-provider/base-shop/hydrate-payment-methods-for-an-order.html
- title: Interact with third party payment providers using Glue API
url: /docs/pbc/all/payment-service-provider/base-shop/interact-with-third-party-payment-providers-using-glue-api.html
- title: Retrieve and use payment details from third-party PSPs
url: /docs/pbc/all/payment-service-provider/base-shop/retrieve-and-use-payment-details-from-third-party-psps.html
- title: "Payments feature: Domain model and relationships"
url: /docs/pbc/all/payment-service-provider/base-shop/payments-feature-domain-model-and-relationships.html
- title: Domain model and relationships
Expand Down Expand Up @@ -2415,15 +2417,19 @@ 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: SCCOS prerequisites for Stripe
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/sccos-prerequisites-for-the-stripe-app.html
- title: Manage Stripe configurations in the ACP catalog
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/manage-stripe-configurations-in-the-acp-catalog.html
- title: Project guidelines for Stripe
- title: Install the prerequisites
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/install-and-configure-stripe-prerequisites.html
- title: Connect and configure
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/connect-and-configure-stripe.html
- title: Project guidelines
url: /docs/pbc/all/payment-service-provider/base-shop/third-party-integrations/stripe/project-guidelines-for-stripe.html
- title: Disconnect
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
2 changes: 1 addition & 1 deletion docs/about/all/about-the-docs/docs-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In February 2024, we have added and updated the following pages:
- [Secure coding practices for external packages](/docs/dg/dev/guidelines/coding-guidelines/secure-coding-practices-for-external-packages.html).
- [Merchant Portal Agent Assist feature overview](/docs/pbc/all/user-management/202404.0/marketplace/merchant-portal-agent-assist-feature-overview.html).
- [Finilizing upgrades](/docs/ca/devscu/finilizing-upgrades.html): Learn how you can make sure everything works correctly after upgrading a module.
- [Manage Stripe configurations in the ACP catalog](/docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/manage-stripe-configurations-in-the-acp-catalog.html).
- [Manage Stripe configurations in the ACP catalog](/docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/connect-and-configure-stripe.html).
- [Project guidelines for the Stripe app](/docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/project-guidelines-for-stripe.html).

### Updated pages
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
title: Retrieve and use payment details from third-party PSPs
description: Learn how to retrieve and use payment details from a third-party payment service providers
last_updated: Mar 20, 2024
template: howto-guide-template
---

This document describes how to retrieve and use payment details from third-party payment service providers (PSPs).

## Configure payment details to be retrieved

1. Install the required modules using Composer:

```bash
composer require spryker/sales-payment-detail
```

2. In `config/Shared/config_default.php`, add or update the shared configs:

```php
//...

use Generated\Shared\Transfer\PaymentCreatedTransfer;

$config[MessageBrokerConstants::MESSAGE_TO_CHANNEL_MAP] = [
//...
PaymentCreatedTransfer::class => 'payment-events',
];

$config[MessageBrokerConstants::CHANNEL_TO_RECEIVER_TRANSPORT_MAP] = [
//...
'payment-events' => MessageBrokerAwsConfig::HTTP_CHANNEL_TRANSPORT,
];

```

3. In `src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php`, add or update the config of the message broker dependency provider:

```php

namespace Pyz\Zed\MessageBroker;

use Spryker\Zed\MessageBroker\MessageBrokerDependencyProvider as SprykerMessageBrokerDependencyProvider;
use Spryker\Zed\SalesPaymentDetail\Communication\Plugin\MessageBroker\PaymentCreatedMessageHandlerPlugin;

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

# This plugin is handling the `PaymentCreated` messages sent from any Payment App that supports this feature.
new PaymentCreatedMessageHandlerPlugin(),
];
}
}

```

4. In `src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php`, add or update the config of the message broker channels:

```php
namespace Pyz\Zed\MessageBroker;

use Spryker\Zed\MessageBroker\MessageBrokerConfig as SprykerMessageBrokerConfig;

class MessageBrokerConfig extends SprykerMessageBrokerConfig
{
/**
* @return array<string>
*/
public function getDefaultWorkerChannels(): array
{
return [
//...
'payment-events',
];
}

//...
}
```

## Using payment details from third-party PSPs

When a third-party PSP supports this feature, your shop receives asynchronous messages about each payment when it's created.

To use the data of the `spy_sales_payment_detail` table, you need to combine the data from the table with the entity you are fetching from the database to which this payment detail is related.

When the payment is used in the normal order process, the payment detail can be combined by using `spy_sales_order.order_reference` and `spy_sales_payment_detail.entity_reference`.
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
---
title: Manage Stripe configurations in the ACP catalog
title: Connect and 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
- /docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/configure-stripe.html
- /docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/disconnect-stripe.html
- /docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/manage-stripe-configurations-in-the-acp-catalog.html
---

This document describes how to connect configure the Stripe app in the ACP catalog of your Back Office.
Once you have , you can configure it.
This document describes how to connect and configure the Stripe app in the Back Office.

## Prerequisites

Before configuring Stripe in the ACP catalog, make sure you have met these prerequisites:
- [Prerequisites for using the Stripe app](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/stripe.html#prerequisites-for-using-the-stripe-app)
- [SCCOS prerequisites for Stripe](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/install-stripe.html)
[Install and configure Stripe prerequisites](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/install-and-configure-stripe-prerequisites.html)

## Connect and configure the Stripe app

Expand All @@ -37,29 +31,5 @@ Before configuring Stripe in the ACP catalog, make sure you have met these prere
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**.
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).

## Disconnect the Stripe App

Disconnecting the Stripe app from your store makes it unavailable to your customers as a payment option.

{% info_block infoBox "Info" %}

You should only disconnect if there are no open orders that still use the Stripe payment method.

{% endinfo_block %}

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.

{% info_block infoBox "Info" %}

If you want to use the Stripe app after the disconnection, you will need to reconnect the App.

{% endinfo_block %}


Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Disconnect Stripe
description: Learn how to disconnect Stripe in the Back Office
last_updated: Mar 24, 2024
template: howto-guide-template
---

This document describes how to disconnect Stripe from your store.


## Prerequisites

Complete all the orders that were placed with Stripe used as a payment method.

## Disconnect Stripe from Spryker

1. In the 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
@@ -1,34 +1,38 @@
---
title: SCCOS prerequisites for the Stripe app
description: Find out about the SCCOS modules needed for the Stripe App to function and their configuration
draft: true
last_updated: Jan 31, 2024
title: Install and configure Stripe prerequisites
description: Learn how to prepare your project for Stripe
last_updated: Mar 20, 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
- /docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/install-stripe.html
- /docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/integrate-stripe.html

- /docs/pbc/all/payment-service-provider/202311.0/base-shop/third-party-integrations/stripe/sccos-prerequisites-for-the-stripe-app.html
---
This document gives an overview of the SCCOS prerequisites required for the [Stripe App](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/stripe.html) to function in your Spryker Shop.

{% info_block infoBox "Info" %}
To install and configure the prerequisites for the [Stripe App](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/stripe.html), take the following steps.


## Fulfill Stripe's prerequisites

The steps listed is this document are only necessary if your Spryker shop doesn't contain the packages (or their versions are outdated) and configurations below.
* Create a Stripe account.
* Make sure [your countries are supported by Stripe](https://stripe.com/global).
* Make sure [your business is not restricted by Stripe](https://stripe.com/legal/restricted-businesses).

{% endinfo_block %}
## Fulfill ACP prerequisites

* Connect your Stripe account to the Spryker Platform account. Request this link by [creating a support case](https://support.spryker.com/s/).
* Enable ACP in your project. For instructions, see [App Composition Platform installation](/docs/acp/user/app-composition-platform-installation.html). Make sure you are using the latest version of the Message Bus. We'll verify this during onboarding, and a migration may be necessary to enable the Stripe app.

## 1. Required packages
## Install packages and add configuration

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. Install the required packages.
To check the list of required packages, in the Back Office, go to **Apps**>**Stripe**.

## 2. Configure shared configs
2. Add or update the shared configs:

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

```php
//...
Expand Down Expand Up @@ -80,6 +84,9 @@ $config[MessageBrokerConstants::MESSAGE_TO_CHANNEL_MAP] = [
PaymentRefundFailedTransfer::class => 'payment-events',
PaymentCanceledTransfer::class => 'payment-events',
PaymentCancellationFailedTransfer::class => 'payment-events',

# [Optional] This message can be received from your project when you want to use details of the Stripe App used payment.
PaymentCreatedTransfer::class => 'payment-events',
];

$config[MessageBrokerConstants::CHANNEL_TO_RECEIVER_TRANSPORT_MAP] = [
Expand All @@ -95,9 +102,9 @@ $config[MessageBrokerConstants::CHANNEL_TO_SENDER_TRANSPORT_MAP] = [

```

## 3. Configure the Message Broker dependency provider
</details>

Your project probably already contains the following code in `src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php` already. If not, add it:
3. In `src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php`, add or update the config of the Message Broker dependency provider:

```php

Expand All @@ -106,6 +113,7 @@ namespace Pyz\Zed\MessageBroker;
use Spryker\Zed\MessageBroker\MessageBrokerDependencyProvider as SprykerMessageBrokerDependencyProvider;
use Spryker\Zed\Payment\Communication\Plugin\MessageBroker\PaymentOperationsMessageHandlerPlugin;
use Spryker\Zed\Payment\Communication\Plugin\MessageBroker\PaymentMethodMessageHandlerPlugin;
use Spryker\Zed\SalesPaymentDetail\Communication\Plugin\MessageBroker\PaymentCreatedMessageHandlerPlugin;

class MessageBrokerDependencyProvider extends SprykerMessageBrokerDependencyProvider
{
Expand All @@ -119,15 +127,16 @@ class MessageBrokerDependencyProvider extends SprykerMessageBrokerDependencyProv
# These plugins are handling messages sent from Stripe app to your project.
new PaymentOperationsMessageHandlerPlugin(),
new PaymentMethodMessageHandlerPlugin(),

# [Optional] This plugin is handling the `PaymentCreated` messages sent from Stripe App.
new PaymentCreatedMessageHandlerPlugin(),
];
}
}

```

## 4. Configure channels in Message Broker configuration

Add the following code to `src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php`:
4. In `src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php`, add or updated the channels config in the message broker config:

```php
namespace Pyz\Zed\MessageBroker;
Expand All @@ -152,8 +161,8 @@ class MessageBrokerConfig extends SprykerMessageBrokerConfig
}
```

## 5. 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:
5. In in `src/Pyz/Zed/Oms/OmsDependencyProvider.php`, add or updated the OMS config:


```php
use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendCapturePaymentMessageCommandPlugin;
Expand All @@ -175,7 +184,7 @@ use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendCancelPaymentMessageCo
// These two commands will be also supported soon by ACP Stripe app.
$commandCollection->add(new SendRefundPaymentMessageCommandPlugin(), 'Payment/Refund');
$commandCollection->add(new SendCancelPaymentMessageCommandPlugin(), 'Payment/Cancel');

return $commandCollection;
});

Expand All @@ -185,4 +194,5 @@ use Spryker\Zed\SalesPayment\Communication\Plugin\Oms\SendCancelPaymentMessageCo
```

## 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)

[Connect and configure Stripe](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/third-party-integrations/stripe/connect-and-configure-stripe.html)
Loading

0 comments on commit 84ca1af

Please sign in to comment.