Skip to content

docs: update connector guide #8739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

nfarah86
Copy link
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Updating the connector documentation

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Make it easier for developers to contribute

How did you test it?

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@nfarah86 nfarah86 self-assigned this Jul 24, 2025
@nfarah86 nfarah86 added the Developer Experience Product enhancements to enhance developer experience label Jul 24, 2025
@nfarah86 nfarah86 requested a review from a team as a code owner July 24, 2025 01:48
Copy link

Review changes with  SemanticDiff

@nfarah86 nfarah86 linked an issue Jul 24, 2025 that may be closed by this pull request
@nfarah86
Copy link
Contributor Author

This is not ready, getting early feedback

@nfarah86 nfarah86 force-pushed the update-connector-guide branch 4 times, most recently from 341aa93 to d2e7796 Compare July 31, 2025 17:31
@nfarah86
Copy link
Contributor Author

nfarah86 commented Jul 31, 2025

This is ready for review

@nfarah86 nfarah86 force-pushed the update-connector-guide branch from 07524e8 to 6af9f32 Compare August 5, 2025 23:24
AkshayaFoiger
AkshayaFoiger previously approved these changes Aug 7, 2025
@nfarah86
Copy link
Contributor Author

nfarah86 commented Aug 8, 2025

@deepanshu-iiitu incorporated your feedback, if you want to take a look

@nfarah86 nfarah86 force-pushed the update-connector-guide branch from 2b801b7 to da92600 Compare August 11, 2025 19:29
@nfarah86 nfarah86 changed the title Update connector guide DOCS: Update connector guide Aug 11, 2025
AkshayaFoiger
AkshayaFoiger previously approved these changes Aug 12, 2025
@nfarah86 nfarah86 dismissed stale reviews from AkshayaFoiger and deepanshu-iiitu via b697b7f August 12, 2025 21:39
@nfarah86 nfarah86 force-pushed the update-connector-guide branch from b697b7f to 371489c Compare August 12, 2025 21:40
@SanchithHegde SanchithHegde changed the title DOCS: Update connector guide docs: Update connector guide Aug 13, 2025
@SanchithHegde SanchithHegde changed the title docs: Update connector guide docs: update connector guide Aug 13, 2025
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do the same for the rest of the source code links, please use permalinks instead of links to code on the main branch.

* Familiarity with the Connector API you’re integrating
* A locally set up and running Router repository
* API credentials for testing (sign up for sandbox/UAT credentials on the connector’s website).
* Need help? Join the [Hyperswitch Slack Channel](https://join.slack.com/t/hyperswitch-io/shared_invite/zt-39d4w0043-CgAyb75Kn0YldNyZpd8hWA). We also have weekly office hours every Thursday at 8:00 AM PT (11:00 AM ET, 4:00 PM BST, 5:00 PM CEST, and 8:30 PM IST). Link to office hours are shared in the **#general channel**.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to include the inviter link here?

From the root of the project, generate a new connector by running the following command. Use a single-word name for your `ConnectorName`:

```bash
sh scripts/add_connector.sh <ConnectorName> <ConnectorBaseUrl>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we're running this script, we would need cargo-generate tool to be installed. Have we documented anywhere that it must be installed?


---

### 1. Flow Summary Table
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The source code links in this table may go stale, if new lines are added in the file. We can consider including permalinks to lines in code instead, if that helps.

Comment on lines +216 to +218
1. **Tokenization** – e.g., Billwerk’s implementation:
- [Tokenization](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/billwerk.rs#L178-L271)
- [Authorization](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/billwerk.rs#L273-L366)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, please use permalinks instead.

Comment on lines +230 to +237
- **Authorize.net** – [code](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs#L401-L497)
Builds `CreateTransactionRequest` directly from payment data in `get_request_body()`.

- **Helcim** – [code](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/helcim.rs#L295-L385)
Chooses purchase (auto‑capture) or preauth endpoint in `get_url()` and processes payment data directly.

- **Deutsche Bank** – [code](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/deutschebank.rs#L330-L461)
Selects flow based on 3DS and payment type (card or direct debit).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well, use permalinks instead.

Comment on lines +677 to +679
- 4xx → [`get_error_response`](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/billwerk.rs#L256)
- 5xx → [`get_5xx_error_response`](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/billwerk.rs#L264)
- 2xx → [`handle_response`](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/billwerk.rs#L332)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, use permalinks instead.

- `mod.rs` - This file implements the standardized Hyperswitch connector interface using the transformers.

### The `mod.rs` Implementation Pattern
The file creates the bridge between the data transformation logic (defined in `transformers.rs`) and the connector interface requirements. It serves as the main connector implementation file that brings together all the components defined in the transformers module and implements all the required traits for payment processing. Looking at the connector template structure [`connector-template/mod.rs:54-67`](https://github.com/juspay/hyperswitch/blob/main/connector-template/mod.rs#L54-L67), you can see how it:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, use permalinks.

```

- `get_error_response` method to manage error responses. As the handling of checkout errors remains consistent across various flows, we've incorporated it from the `build_error_response` method within the `ConnectorCommon` trait.
## ConnectorCommon: The Foundation Trait
The `ConnectorCommon` trait defines the standardized interface required by Hyperswitch (as outlined in [`crates/hyperswitch_interfaces/src/api.rs`](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_interfaces/src/api.rs#L319-L367) and acts as the bridge to your PSP-specific logic in `transformers.rs`. The `connector-template/mod.rs` file implements this trait using the data types and transformation functions from `transformers.rs`. This allows Hyperswitch to interact with your connector in a consistent, processor-agnostic manner. Every connector must implement the `ConnectorCommon` trait, which provides essential connector properties:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, use permalinks instead.

Comment on lines +848 to +853
- **Defined in `api.rs`**
[`crates/hyperswitch_interfaces/src/api.rs:150–153`](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_interfaces/src/api.rs#L150)
Provides the standardized interface contracts for connector integration.

**PaymentCapture :** This trait extends the `api::ConnectorIntegration `trait with specific types related to manual payment capture.
- **Implemented in `mod.rs`**
Each connector’s main file (`mod.rs`) implements the trait methods for specific payment flows like authorize, capture, refund, etc. You can see how the Tsys connector implements [ConnectorIntegration](https://github.com/juspay/hyperswitch/blob/main/crates/hyperswitch_connectors/src/connectors/tsys.rs#L219)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, use permalinks instead.


**RefundSync :** This trait extends the `api::ConnectorIntegration `trait with specific types related to refunds retrieve.
### Request/Response Flow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well, we can use permalinks instead wherever source code links are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Product enhancements to enhance developer experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update add_connector contributing guide
4 participants