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.62k stars 1.36k forks source link

[WEB - SDK] - Add Payment Method with Dynamic Field Rendering - BACS Bank Transfer #6036

Open sakksham7 opened 1 month ago

sakksham7 commented 1 month ago

The Hyperswitch SDK is a versatile tool built to streamline payment integration for developers. It simplifies the process of adding multiple payment methods, allowing you to quickly implement support for various gateways without the need to manually integrate each one. With Hyperswitch, you can efficiently manage payments across platforms, reducing complexity and boosting development speed.

Getting started

  1. Get familiar with ReScript.
  2. Check the README.md for project structure and setup instructions.
  3. To setup locally, follow these steps
#  Clone repository
cd hyperswitch-web
yarn install
yarn run server     # This starts the mock server
yarn run re:start   # In another terminal

# Start Demo App in another terminal
cd hyperswitch-react-demo-app
yarn install
yarn run start        # This starts the demo app

Description:

We are looking to implement a new payment method in our WebSDK that supports dynamic field rendering. The goal is to allow the backend to define the fields required for the payment method and have the frontend WebSDK render these fields dynamically based on the response.

This feature should be flexible enough to handle different payment methods, each potentially requiring different types of input fields (e.g., text fields, dropdowns, checkboxes, etc.).


Requirements:

  1. Payment Method Integration Details:

    In this section, we provide details on the payment call response and the confirm call payload for the newly integrated payment method. Ensure you have configured the payment method at Hyperswitch Dashboard correctly. The backend already includes support for this payment method, so no additional configuration is needed.

    Payment Method List Response for BACS Bank Transfer -

    {
     "payment_method": "bank_transfer",
     "payment_method_types": [
       {
         "payment_method_type": "bacs",
         "payment_experience": null,
         "card_networks": null,
         "bank_names": null,
         "bank_debits": null,
         "bank_transfers": {
           "eligible_connectors": ["stripe"]
         },
         "required_fields": {
           "billing.address.first_name": {
             "required_field": "payment_method_data.billing.address.first_name",
             "display_name": "card_holder_name",
             "field_type": "user_full_name",
             "value": null
           },
           "billing.address.last_name": {
             "required_field": "payment_method_data.billing.address.last_name",
             "display_name": "card_holder_name",
             "field_type": "user_full_name",
             "value": null
           },
           "billing.email": {
             "required_field": "payment_method_data.billing.email",
             "display_name": "email",
             "field_type": "user_email_address",
             "value": "example@example.com"
           }
         },
         "surcharge_details": null,
         "pm_auth_connector": null
       }
     ]
    }

    Confirm call Payload should look like:

    curl --location 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: ********************************************************' \
    --data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "description": "Its my first payment request",
    "payment_method": "bank_transfer",
    "payment_method_type": "bacs",
    "payment_method_data": {
        "bank_transfer": {
            "bacs_bank_transfer": {}
        },
        "billing": {
            "email": "testing@someone.com",
            "address": {
                "first_name": "joseph",
                "last_name": "Doe"
            }
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "13.232.74.226"
    }
    }'
    
  2. Dynamic Field Rendering:

  1. User Inputs:

Contribution Guidelines:


Helpful Resources:

Submission Process:

Refer here for Terms and conditions for the contest.

If you have any questions or need help getting started, feel free to ask in the comments!

Garv-M commented 1 month ago

Hey, I would like to work on this issue, but during setup I am having some issue. Can anyone help me with this.

gorakhnathy7 commented 1 month ago

Hey @Garv-M Thanks for your interest, assigning this issue to you!

gorakhnathy7 commented 1 month ago

Hey @Garv-M

If you have any questions or need assistance, feel free to reach out in the community, do link the issue in the query.

gorakhnathy7 commented 3 weeks ago

Hey @Garv-M, Kindly let us know, if you're still working on the issue?

Garv-M commented 3 weeks ago

Hey @gorakhnathy7, Sorry for the inconvinience, I am unable to complete the task, I might come to this task later on if it is available in the future. You can handover this task to someone, who wants to attempt this task.

Thanks!