Skip to content

Commit eeff18b

Browse files
committed
Enhance doc
1 parent 01eb74b commit eeff18b

3 files changed

Lines changed: 69 additions & 9 deletions

File tree

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
## Payum Stripe gateways
77

88
This library is designed to add a new gateways to Payum to support Stripe (with SCA support)
9+
Actually there is one Gateway fully supported `Stripe checkout session` but soon `Stripe JS` will be supported too.
10+
11+
> If you are using Symfony use the bundle : [prometee/payum-stripe-checkout-bundle](https://github.com/Prometee/PayumStripeCheckoutSessionBundle)
12+
13+
> If you are using Sylius use the plugin : [prometee/sylius-payum-stripe-checkout-session-plugin](https://github.com/Prometee/SyliusPayumStripeCheckoutSessionPlugin)
914
1015
## Installation
1116

@@ -22,12 +27,27 @@ the most used is [php-http/guzzle6-adapter](https://packagist.org/packages/php-h
2227
composer require php-http/guzzle6-adapter
2328
```
2429

25-
## Configuration
30+
## Gateways configuration
31+
32+
- [Stripe Checkout Session](docs/stripe-checkout-session/README.md)
33+
34+
Support :
35+
- ["One-time payments"](https://stripe.com/docs/payments/checkout/one-time)
36+
- ["Subscription"](https://stripe.com/docs/payments/checkout/subscriptions/starting)
37+
- ["Update payment details"](https://stripe.com/docs/payments/checkout/subscriptions/updating)
38+
39+
- [WIP] [Stripe JS](docs/stripe-js/README.md)
40+
41+
## More
2642

27-
- [Stripe Checkout Session gateway](docs/stripe-checkout-session/README.md)
28-
- [Stripe JS gateway](docs/stripe-js/README.md)
43+
### What to use with Stripe Checkout Session gateway ?
2944

45+
- A Symfony bundle : [prometee/payum-stripe-checkout-bundle](https://github.com/Prometee/PayumStripeCheckoutSessionBundle)
46+
- A Sylius plugin : [prometee/sylius-payum-stripe-checkout-session-plugin](https://github.com/Prometee/SyliusPayumStripeCheckoutSessionPlugin)
47+
48+
### What to use with Stripe JS gateway ?
3049

50+
- [WORK IN PROGRESS]
3151

3252

3353
[ico-version]: https://img.shields.io/packagist/v/Prometee/payum-stripe.svg?style=flat-square

docs/stripe-checkout-session/README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ If the token is null then we will try to handle a webhook, and if a token is det
8080
then it's a normal `Notify` so we must handle a `Sync` to refresh a payment details.
8181

8282
#### Resolving a webhook : `NotifyUnsafe`
83+
8384
The [`NotifyAction.php`](../../src/Action/NotifyAction.php) will ask for 2 other actions to :
8485

8586
1. Resolve the webhook event, meaning :
@@ -91,12 +92,25 @@ So if you want to consume another webhook event type, you just need to create an
9192
extending [`Prometee\PayumStripe\Action\Api\WebhookEvent\AbstractWebhookEventAction`](../../src/Action/Api/WebhookEvent/AbstractWebhookEventAction.php).
9293
Examples available into the [`src/Action/Api/WebhookEvent/`](../../src/Action/Api/WebhookEvent) folder.
9394

94-
## More
95+
## Subscription handling
96+
97+
Payum don't have php `Interfaces` to handle subscription, that's why subscriptions should be
98+
managed by yourself. There is maybe a composer packages which meet your need,
99+
but you will have to build the interface between your subscription `Model` class and `Payum`.
100+
101+
Usually you will have to build a `ConvertPaymentAction` like this one : [ConvertPaymentAction.php](https://github.com/Prometee/SyliusPayumStripeCheckoutSessionPlugin/blob/master/src/Action/ConvertPaymentAction.php)
102+
customizing the `supports` method to meet your need and finally providing the right `$details` array.
95103

96-
Check the dedicated bundle :
104+
Example : https://stripe.com/docs/payments/checkout/subscriptions/starting#create-checkout-session (`$details` is the array given to create a `Session`)
97105

98-
https://github.com/Prometee/PayumStripeCheckoutSessionBundle
106+
## Subscription update payment details
99107

100-
And the Sylius plugin :
108+
Same as the [previous chapter](#subscription-handling)
109+
110+
Example : https://stripe.com/docs/payments/checkout/subscriptions/updating#create-checkout-session (`$details` is the array given to create a `Session`)
111+
112+
## More
101113

102-
https://github.com/Prometee/SyliusPayumStripeCheckoutSessionPlugin
114+
- A Symfony bundle : [prometee/payum-stripe-checkout-bundle](https://github.com/Prometee/PayumStripeCheckoutSessionBundle)
115+
- A Sylius plugin : [prometee/sylius-payum-stripe-checkout-session-plugin](https://github.com/Prometee/SyliusPayumStripeCheckoutSessionPlugin)
116+

docs/stripe-credentials.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,33 @@ Then get a `webhook_secret_key` configured with at least two events :
1616
The URL to fill is the url to your `notify.php`, here is an example :
1717

1818
```
19-
http://localhost/notify.php?gateway=stripe_checkout_session
19+
https://localhost/notify.php?gateway=stripe_checkout_session
2020
```
2121

2222
https://dashboard.stripe.com/test/webhooks
23+
24+
## Test or dev environment
25+
26+
Webhooks are triggered by Stripe on their server to your server.
27+
If the server is into a private network, Stripe won't be allowed to reach your server.
28+
29+
Stripe provide an alternate way to catch those webhook events, you can use
30+
`Stripe cli` : https://stripe.com/docs/stripe-cli
31+
Follow the link and install `Stripe cli`, then use those command line to get
32+
your webhook key :
33+
34+
First login to your Stripe account (needed every 90 days) :
35+
36+
```bash
37+
stripe login
38+
```
39+
40+
Then start to listen for the 2 required events, forwarding request to you local server :
41+
42+
```bash
43+
stripe listen \
44+
--events checkout.session.completed,payment_intent.canceled \
45+
--forward-to https://localhost/notify.php?gateway=stripe_checkout_session
46+
```
47+
48+
> Replace the --forward-to argument value with the right one you need.

0 commit comments

Comments
 (0)