juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
12.31k stars 1.33k forks source link

[FEATURE] Add self hosting documentation #1656

Closed XAMPPRocky closed 1 year ago

XAMPPRocky commented 1 year ago

Feature Description

Hello 👋 I was interesting in using the open source version of hyperswitch for my project. However as far as I can tell there's no documentation around hosting it yourself. It would be great if there was documentation around how people can administer and operate hyperswitch.

Possible Implementation

Ideally a section in the documentation, I think it should have answers to the following questions.

Have you spent some time to check if this feature request has been raised before?

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

No, I don't have time to work on this right now

SanchithHegde commented 1 year ago

Hey @XAMPPRocky, we're glad to know that interested in self-hosting Hyperswitch.

  • What is the architecture of Hyperswitch? What services does it depend on? Which are required and which are optional?

We're in the process of updating our architecture diagram. We'll have it available in some time.

  • What are the minimum expected specs that Hyperswitch expects to run on? Storage, CPU, RAM, etc.

You can run each container/pod easily in a machine with 1 core and 1 GB RAM. As for storage, we use Postgres and Redis. You don't need disk space unless you're using file logs instead of console logs.

  • Is there an API for administering and managing Hyperswitch from a custom client?

As of now, there are no APIs for administering or managing Hyperswitch. You can use the admin API key to access most endpoints. Just curious, what capabilities are you expecting?

  • What metrics are exposed?

You can refer to the metrics.rs file for a list of Prometheus metrics exposed by Hyperswitch.

XAMPPRocky commented 1 year ago

Just curious, what capabilities are you expecting?

I'd like to use hyperswitch as the payment gateway backend for my project. I'd like users to be able to add, switch, remove, and prioritise which payment provider they're using. I want to manage that through my UI, and then have my project call hyperswitch's API.

To give example of a similar project, I'd like to use this like Ory, but for payment management rather than identity management. https://www.ory.sh/docs/welcome

SanchithHegde commented 1 year ago

That sounds good. I can help you with the setup. However, you would need PCI compliance to securely process (or store) customer card information which you would need to arrange for.

XAMPPRocky commented 1 year ago

However, you would need PCI compliance to securely process (or store) customer card information which you would need to arrange for.

Hmm, correct me if I'm wrong, but I thought that would be stored in the chosen payment backend? For example; if a user selected stripe, their credit card would be added to stripe, and I would have an abstract ID for the card. Which is the case when using the stripe API directly, I don't have an interest in storing the payment information directly, that's why I want to use a project like this.

SanchithHegde commented 1 year ago

Can you please let me know the list of payment processors you are planning to integrate?

Payment provider selection is usually not left to the end user because that is decided by Hyperswitch backend based on certain pre-configured routing rules set by you.

Transforming the incoming payment request to that of the payment provider is done on the Hyperswitch backend which requires the card details to be sent to the server (hence requiring PCI compliance).

Allowing the user to select the payment provider would require integrating all the payment provider SDKs on your checkout page which something that Hyperswitch simplifies for you.

Creating a card token would also require sending the card data from Hyperswitch for the first time. This would still complicate things because a token created by one provider would not work with another and the end user would have to re-enter card details if they were to switch providers for subsequent transactions.

We are internally trying to come up with a workaround for this. Until then, you could try our hosted version which is free to use (till 10k transactions a month).

Curious: Can you please elaborate on the use case for letting the end user select the payment provider?

XAMPPRocky commented 1 year ago

Curious: Can you please elaborate on the use case for letting the end user select the payment provider?

I'm building a eCommerce system, similar to something like shopify or WooCommerce, so in this case my users are the merchants themselves, who are then choosing which payment providers they want to use on their website. So I can't give a list of payment processors, because it's any and all of them.

Allowing the user to select the payment provider would require integrating all the payment provider SDKs on your checkout page which something that Hyperswitch simplifies for you.

Again since my users are the merchants we would just include the payment providers that they have selected in the backend, and switch between them as needed.

It seems then that this project won't be suitable for use-case because I don't want to pre-configure the rules, I want to be able to dynamically add, remove, and change which payment processor is being used.

SanchithHegde commented 1 year ago

Sure, what I meant by pre-configured rules is that your merchant would be able to set these rules dynamically for their payment processors, you can get a flavor of this from our dashboard.

XAMPPRocky commented 1 year ago

Creating a card token would also require sending the card data from Hyperswitch for the first time. This would still complicate things because a token created by one provider would not work with another and the end user would have to re-enter card details if they were to switch providers for subsequent transactions.

Not if you register the card with all providers individually at once on the frontend and then create an entry associating your card token with all of the providers.

Sure, what I meant by pre-configured rules is that your merchant would be able to set these rules dynamically for their payment processors, you can get a flavor of this from our dashboard.

Yeah but having the payment processing handled by the backend isn't something I want, what I want is a "payment gateway", I don't want any storage of that information on a service users or I are hosting. I just want a service that routes the payment API to the appropriate provider based on a priority list.

SanchithHegde commented 1 year ago

As of now, Hyperswitch is designed to send the payment details from its server to the payment provider. We will keep you posted if we are able to support your use case. Meanwhile, do let me know if I can help you with anything else. We can explore other ways to reuse the codebase for your project if that would help.

SanchithHegde commented 1 year ago

Closing this as completed in #1825. You can find the architecture docs here:

https://github.com/juspay/hyperswitch/blob/main/docs/architecture.md

Let us know if anything is still unclear.

Nikola-Milovic commented 11 months ago

Since Hypeswitch is marketed as open-source and not self-hosted, I understand that this might not be a priority, but are there any plans to expand upon this request and add actual docs that provide more info on self-hosting option? Maybe adding support for hobby tier option with docker/ kubernetes setup (something like these open source products do highlight.io, signoz). This is what I usually reach out to when I want to try something and integrate it into my system to demo it. But I guess that with Hypeswitch, there are probably compliance issues that prevent self-hosting. But just throwing this out there since I've went through the entire docs looking for a way to spin up my own Hypeswitch server locally. Maybe its just me, but having the ability to spin it up myself and try it beats even the free trial and generous free tiers.

Thanks for the awesome product! Will probably go for the cloud version nonetheless

AnandKGanesh commented 11 months ago

Hi @Nikola-Milovic Thanks for your interest in Hyperswitch! We're enhancing documentation for self-hosting and developing CDK scripts for easy deployment in AWS, supporting Kubernetes. We've set up a Docker configuration for local installation as well. Here's the document you can refer to https://opensource.hyperswitch.io/ . We're still working on it before we can make it available to a broader audience. Your feedback is crucial, so feel free to share suggestions. Also, stay tuned for updates as we open source more components for you to adopt.

cc - @shakthi-22