> For the complete documentation index, see [llms.txt](https://yokifinance.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yokifinance.gitbook.io/docs/subscription-payments/for-merchant/api-integration/localhost-environment.md).

# Localhost environment

This page describes how to handle Yoki webhooks on localhost so that merchant can debug subscription statuses coming from Yoki.

**Short answer**

Use <https://webhookrelay.com/> to forward Yoki webhooks to localhost. In the Webhookrelay's dashboard go to Request Forwarding -> Buckets -> Forward To and choose Internal Destination. The flow is pretty well explained up there.

**Long answer**

1. Run webhook handler on localhost. Let's say, you receive requests on <http://localhost:8088>
2. Register on <https://webhookrelay.com/>
3. Go to webhookrelay's dashboard
4. Select Request Forwarding -> Buckets -> Forward To and choose Internal Destination.

   <figure><img src="https://3265399743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FICgNvamA13XK1KZtqMys%2Fuploads%2FoSRoIM9IrDzvZmscemSA%2FScreenshot%202024-03-29%20at%2015.07.13.png?alt=media&amp;token=1629cf9c-38ec-4906-b56a-b8fbcb5adfe5" alt="" width="375"><figcaption></figcaption></figure>
5. Specify local URL to forward requests to (in this case <http://localhost:8088>):

   <figure><img src="https://3265399743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FICgNvamA13XK1KZtqMys%2Fuploads%2Fyl1a4xywq3vcvbCzxcUK%2Fimage.png?alt=media&amp;token=0494f9e0-8d77-41ec-a47b-6ca0e1840c34" alt="" width="375"><figcaption></figcaption></figure>
6. Install the agent on local machine (commands for operating systems are given), press "Generate Auth Token", then run authenticate command. After completed, run forwarding command as per screenshot below.

   <figure><img src="https://3265399743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FICgNvamA13XK1KZtqMys%2Fuploads%2FDBHSp2niH24nm8VtUjm7%2Fimage.png?alt=media&amp;token=898abada-58b8-4072-9d25-a574a4b203d9" alt=""><figcaption></figcaption></figure>
7. After it is done, you'll see "Agent is connected and subscribed!". Press "Start forwarding".

   <figure><img src="https://3265399743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FICgNvamA13XK1KZtqMys%2Fuploads%2FKhngrzH4BS29SbEdGYEk%2Fimage.png?alt=media&amp;token=3c76b42c-757d-46ab-967d-0fc063b583db" alt=""><figcaption></figcaption></figure>
8. You're done! You can now see the public webhook handler URL that you can give to Yoki to test integration locally. All requests will be forwarded to localhost:8088 (or any other URL).

   <figure><img src="https://3265399743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FICgNvamA13XK1KZtqMys%2Fuploads%2Fq925FdJKpABiuM6hYN5J%2FScreenshot%202024-03-29%20at%2015.19.24.png?alt=media&amp;token=69265dfe-1c02-48b4-ba49-a1c29c8cc51f" alt=""><figcaption></figcaption></figure>
