> For the complete documentation index, see [llms.txt](https://docs.my-aac.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.my-aac.org/misc/stripe.md).

# Stripe

How to configure Stripe payments

The whole process consists of 3 Steps:

1. Add Webhook
2. Generate secret key
3. Configure payment options (in config.php)

## 1. Add Webhook

Visit Stripe Webhooks Page <https://dashboard.stripe.com/webhooks>

Click on "Create an event destination"

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FSvDdAU7rRbM4VwVoSzM3%2Fimage.png?alt=media&amp;token=fc3f35b8-b592-4790-bdb2-71a9e660c27a" alt=""><figcaption></figcaption></figure>

You should see following screen, fill it as follows:

(replacing naturally your-domain.com with your domain)

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FiiIsnACVUwQVOSwhnq6f%2Fimage.png?alt=media&amp;token=c66fa81c-eb1f-4e69-b784-cd399dbd230e" alt=""><figcaption></figcaption></figure>

As **Endpoint URL** enter:

* For MyAAC 1.0+ and Gesior Shop System 6.0+
  * <https://your-domain.com/payments-notify/stripe>
* For MyAAC 0.8 and Gesior Shop System 5.0+
  * <https://your-domain.com/payments/stripe.php>

On the same screen, click on "Select events". You should see following screen.

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FXXGDLih7sskRIw1Ty1Id%2Fimage.png?alt=media&amp;token=c03e1539-187c-43aa-a171-6915e175248f" alt=""><figcaption></figcaption></figure>

From the events select **checkout.session.completed**

This is the only event we need.

Then click on Add events button

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FntQozHVUAlsTP9fYGpel%2Fimage.png?alt=media&amp;token=e46d49df-67e7-4865-96b2-1481eeb65e1d" alt=""><figcaption></figcaption></figure>

And finally click on "Add endpoint"

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2F5lM1b1MU08CDjw2voXCt%2Fimage.png?alt=media&amp;token=a654ebbe-d231-4f5c-86ba-1c6ed8c01962" alt=""><figcaption></figcaption></figure>

After that you should be redirected to your Webhook site

Click on "Reveal" Signing Secret:

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FeBWcus6Vmtz81nOsBAb9%2Fimage.png?alt=media&amp;token=3a53ec41-52d1-4fb5-b2e2-11ba06b53846" alt=""><figcaption></figcaption></figure>

You should see a key, which you enter in plugins/gesior-shop-system/config.php, in the Stripe section, under endpoint\_secret:

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FMwJc89dzgPGQIQAPxayA%2Fimage.png?alt=media&amp;token=f26de382-0b9b-4ac8-b4a7-0ab01c33da98" alt=""><figcaption></figcaption></figure>

## 2. Create Secret Key

Go into <https://dashboard.stripe.com/apikeys>

Click **Create secret key:**

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FssYAjA8o9NftJ7VOm8zH%2Fimage.png?alt=media&amp;token=62f668ca-899f-4b85-8e4a-04e6924494b6" alt=""><figcaption></figcaption></figure>

In the popup screen select the second option (Building your own integration):

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FIJm0njmMlpanCWQrY4Es%2Fimage.png?alt=media&amp;token=42e8fa56-136b-4d8d-91eb-33b3f3df6260" alt=""><figcaption></figcaption></figure>

Finally, click on **Create secret key**

You will receive a mail, and also will need probably to confirm using Auth App.

When everything goes smooth, you should see your secret key:

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2Faei8Xo2pUxu7txwkHZyP%2Fimage.png?alt=media&amp;token=20893c87-d7f4-4eec-b09b-f50aba09f1c5" alt=""><figcaption></figcaption></figure>

Enter in into same config.php like before under "secret\_key", here:

<figure><img src="https://161068528-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsnqkXPUzqMWAL9dgn3M9%2Fuploads%2FHfak7dUyIoPLvssXuIMZ%2Fimage.png?alt=media&amp;token=622e1d45-79af-4365-9d5f-29e565a65a66" alt=""><figcaption></figcaption></figure>

## 3. Configure payment options (in config.php)

Finally, you can configure the payment options in plugins/gesior-shop-system/config.php, which by default looks like this:

```php
	'payments' => [
		['price' => '10', 'currency' => 'USD', 'points' => '100', 'name' => '100 premium points on Your OTS'],
		['price' => '20', 'currency' => 'USD', 'points' => '200', 'name' => '200 premium points on Your OTS'],
		['price' => '30', 'currency' => 'USD', 'points' => '300', 'name' => '300 premium points on Your OTS'],
		['price' => '40', 'currency' => 'USD', 'points' => '400', 'name' => '400 premium points on Your OTS'],
		['price' => '50', 'currency' => 'USD', 'points' => '500', 'name' => '500 premium points on Your OTS'],
	],
```
