-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-7108: Describe integration with Payum and payment gateways in Dev…
… docs (#2258) * Payum, Stripe and PayPal base * Implement changes after implementation --------- Co-authored-by: Tomasz Dąbrowski <[email protected]> Co-authored-by: Adrien Dupuis <[email protected]>
- Loading branch information
1 parent
9b2385e
commit 88a6473
Showing
7 changed files
with
185 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
description: Use Payum to integrate the PayPal payment processing service. | ||
edition: commerce | ||
--- | ||
|
||
### Enable PayPal payments with Payum | ||
|
||
By using Payum to integrate PayPal into your application, you can offer your customers a versatile payment processing service that supports various payment methods, including credit cards, debit cards, Pay Later options, and alternative payment methods. | ||
|
||
Before you can proceed with integrating PayPal, you must [create a PayPal business account](https://www.paypal.com/bizsignup/#/singlePageSignup) and obtain API credentials. | ||
|
||
Install the PayPal package: | ||
|
||
`composer require payum/paypal-express-checkout-nvp php-http/guzzle7-adapter` | ||
|
||
Then, add the following configuration to your YAML configuration file (`payum.yaml` or similar): | ||
|
||
```yaml | ||
payum: | ||
gateways: | ||
pp_express_checkout: | ||
factory: paypal_express_checkout | ||
username: <paypal_username> | ||
password: <paypal_password> | ||
signature: <paypal_signature> | ||
``` | ||
!!! tip | ||
You can replace `pp_express_checkout` with a different unique identifier. | ||
|
||
Ensure that the `username`, `password,` and `signature` fields contain the PayPal API credentials obtained from your PayPal business account. | ||
|
||
You can now provide language translations for the PayPal payment service name. | ||
To do it, within the `ibexa_payment_type` namespace in your translation files, use the provided translation key structure for each of your supported languages: | ||
|
||
```yaml | ||
ibexa: | ||
payment_method: | ||
type: | ||
pp_express_checkout: | ||
name: "Translated PayPal Express Checkout name" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
description: Use Payum to integrate the Stripe payment processing service. | ||
edition: commerce | ||
--- | ||
|
||
# Enable Stripe payments with Payum | ||
|
||
Stripe is a comprehensive payment platform that offers a suite of tools to handle online and in-person payments, subscriptions, fraud prevention, and more. | ||
By using Payum to integrate Stripe into your application, you can securely process payments with credit cards, bank transfers, and alternative payment methods. | ||
|
||
Before you can proceed with integrating Stripe, [sign up for a Stripe account](https://dashboard.stripe.com/register) and obtain the API keys required for integration. | ||
|
||
Install the Stripe package: | ||
|
||
`composer require payum/stripe php-http/guzzle7-adapter` | ||
|
||
Then, add the following configuration to your YAML configuration file (`payum.yaml` or similar): | ||
|
||
```yaml | ||
payum: | ||
gateways: | ||
strp_checkout: | ||
factory: stripe_checkout | ||
publishable_key: <publishable_key> | ||
secret_key: <secret_key> | ||
|
||
``` | ||
|
||
!!! tip | ||
|
||
You can replace `strp_checkout` with a different unique identifier. | ||
|
||
Ensure that the `publishable_key` and `secret_key` fields contain the Stripe API keys. | ||
|
||
You can now provide language translations for the Stripe payment platform name. | ||
To do it, within the `ibexa_payment_type` namespace in your translation files, use the provided translation key structure within your translation files: | ||
|
||
```yaml | ||
ibexa: | ||
payment_method: | ||
type: | ||
strp_checkout: | ||
name: "Translated Stripe Checkout name" | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
description: Add new payment methods through Payum such as Stripe or PayPal. | ||
edition: commerce | ||
--- | ||
|
||
# Payum integration | ||
|
||
[Payum](https://payum.gitbook.io/payum/) is a payment processing solution that simplifies the integration of various payment services like Stripe and PayPal into your application. | ||
These services provide security of online transactions, and allow you to accept multiple payment methods while ensuring a seamless experience for the customers. | ||
By configuring service gateways, mapping workflow actions and translating payment service names, you streamline the online payment process, and can offer a diverse payment experience. | ||
|
||
## General Payum configuration | ||
|
||
In your Payum configuration file, for example, `payum.yaml`, set up a payment service gateway by specifying the factory, credentials and other necessary settings. | ||
Replace `<payment_method_identifier>` with a unique identifier of the method provided by the payment service. | ||
|
||
```yaml | ||
payum: | ||
gateways: | ||
<payment_method_identifier>: | ||
factory: <gateway_factory> | ||
# Add specific configuration fields for the gateway | ||
credential_1: <credential_1_value> | ||
credential_2: <credential_2_value> | ||
``` | ||
## Workflow mapping | ||
In [[= product_name =]], the default payment workflow has certain places, such as `pending`, `failed`, `paid`, or `cancelled`, and their corresponding transitions. | ||
However, for your application to use other transitions and places, for example, `authorized`, `notified`, `refunded` etc., and to present them in the user interface, you need to: | ||
- override the default payment workflow | ||
- create a custom workflow and enable it by using semantic configuration | ||
|
||
For more information, see [Custom payment workflows](configure_payment.md#custom-payment-workflows). | ||
|
||
For these places to be supported by the Payum integration, you have to map Payum statuses on the existing or additional places in the workflow, for example: | ||
|
||
```yaml | ||
ibexa_connector_payum: | ||
status_mapping: | ||
refunded: cancelled | ||
captured: pending | ||
authorized: authorized | ||
[...] | ||
``` | ||
|
||
## Payment service name translations | ||
|
||
Within the `ibexa_payment_type` namespace in your translation files, add translations for each payment service that you configure. | ||
For language translations of payment service names, structure the translation files as follows: | ||
|
||
```yaml | ||
ibexa: | ||
payment_method: | ||
type: | ||
<service_identifier>: | ||
name: "Translated payment service name" | ||
``` | ||
|
||
!!! note | ||
|
||
Replace `<service_identifier>` with the identifier used in the Payum configuration. | ||
|
||
## Implementation | ||
|
||
When you implement the online payment solution, take the following consideration into account: | ||
|
||
- To learn what credentials must be provided and what specific settings must be made, refer to the each payment service gateway's specific documentation. | ||
- To customize the online payment UI, see [Creating custom views](https://github.com/Payum/Payum/blob/master/docs/symfony/custom-payment-page.md) in Payum documentation. | ||
- When you modify the payment process, you may need to subscribe to events dispatched by Payum. | ||
For a list of events, see [Event dispatcher](https://github.com/Payum/Payum/blob/master/docs/event-dispatcher.md) in Payum documentation. | ||
|
||
|
||
!!! caution | ||
|
||
In certain cases, depending on the payment processing service, when a customer closes the payment page in a browser and the bank has not processed the payment yet, the payment status can remain unchanged. | ||
Depending on how your checkout process is configured, it may result in unwanted effects, for example, cause that the cart does not purge after the purchase. | ||
Make sure that you account for this fact in your implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters