hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

[WEB - SDK] - Add Payment Method with Dynamic Field Rendering - Multibanco

Open sakksham7 opened this issue 1 year ago • 1 comments

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 Multibanco -

    {
      "payment_method": "bank_transfer",
      "payment_method_types": [
        {
          "payment_method_type": "multibanco",
          "payment_experience": [
            {
              "payment_experience_type": "redirect_to_url",
              "eligible_connectors": ["stripe"]
            }
          ],
          "card_networks": null,
          "bank_names": null,
          "bank_debits": null,
          "bank_transfers": null,
          "required_fields": {
            "billing.email": {
              "required_field": "payment_method_data.billing.email",
              "display_name": "email",
              "field_type": "user_email_address",
              "value": "[email protected]"
            }
          },
          "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: dev_n9y9SATrxsd8LxVDN7hkyEJcnl1CLdIii8eynRLWfj84Q6BGGS5hXhhljMT6AK1A' \
    --data-raw '{
    	"amount": 1000,
    	"currency": "EUR",
    	"confirm": true,
    	"capture_method": "automatic",
    	"capture_on": "2022-09-10T10:11:12Z",
    	"amount_to_capture": 1000,
    	"phone_country_code": "+1",
    	"description": "Its my first payment request",
    	"authentication_type": "no_three_ds",
    	"return_url": "https://duck.com",
    	"payment_method": "bank_transfer",
    	"payment_method_type": "multibanco",
    	"payment_method_data": {
     	"bank_transfer": {
         	"multibanco_bank_transfer": {}
     	},
     	"billing": {
         	"email": "[email protected]"
     	}
    	}
    }'
    
  2. Dynamic Field Rendering:

  • Based on the backend response, the WebSDK should dynamically generate the necessary input fields.
  • Each field should be properly validated (e.g., required, length, pattern matching) based on the backend specifications.
  • Support different types of fields such as:
    • Text fields (e.g., for name, card number)
    • Select dropdowns (e.g., for country or card type)
    • Checkbox fields (e.g., for terms and conditions)
  1. User Inputs:
  • Once the user fills in the fields, the WebSDK should package the input data and send it back to the backend for payment processing.

Contribution Guidelines:

  • Fork the repository and create a new branch for your work.
  • Ensure the WebSDK follows best practices for API integration and field rendering.
  • Write clean, well-documented code with clear commit messages.
  • Add unit tests to ensure the dynamic field rendering works as expected.
  • Make sure to follow our coding standards and contribution guidelines.

Helpful Resources:

Submission Process:

  • Ask the maintainers for assignment of the issue, you can request for assignment by commenting on the issue itself.
  • Once assigned, submit a pull request (PR).
  • Maintainers will review and provide feedback, if any.
  • Maintainers can unassign issues due to inactivity, read more here.

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!

sakksham7 avatar Sep 25 '24 14:09 sakksham7

Hi, I would like to take up this issue for hacktoberfest :)

aazam-gh avatar Sep 28 '24 08:09 aazam-gh

Hello @sakksham7 :) I would like to work on this issue, Please assign to me. Thank you!

naaa760 avatar Oct 03 '24 05:10 naaa760

Hey @naaa760 this issue is already assigned to @aazam-gh , kindly pick another issue from here

gorakhnathy7 avatar Oct 03 '24 05:10 gorakhnathy7

Hey @aazam-gh ,

Quick check-in on the status of this issue. If you have any questions or need assistance, feel free to reach out in the community.

gorakhnathy7 avatar Oct 06 '24 06:10 gorakhnathy7

Hey @aazam-gh Kindly let us know, if you're still working on the issue? If you have any questions or need assistance, feel free to reach out in the community.

gorakhnathy7 avatar Oct 24 '24 06:10 gorakhnathy7

Sorry for the late reply, I won't have enough time to work on this

On Thu, Oct 24, 2024 at 12:27 PM GORAKHNATH YADAV @.***> wrote:

Hey @aazam-gh https://github.com/aazam-gh Kindly let us know, if you're still working on the issue? If you have any questions or need assistance, feel free to reach out in the community https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2jqxmpsbm-WXUENx022HjNEy~Ark7Orw .

— Reply to this email directly, view it on GitHub https://github.com/juspay/hyperswitch/issues/6056#issuecomment-2434451069, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOGNSLEC7WZT32VJPIGXOQLZ5CK6PAVCNFSM6AAAAABO3ICVUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZUGQ2TCMBWHE . You are receiving this because you were mentioned.Message ID: @.***>

aazam-gh avatar Oct 24 '24 07:10 aazam-gh

Hey @gorakhnathy7 I would like to work on this issue. Can you please assign this to me? Thank you :)

prkpndy avatar Dec 25 '24 10:12 prkpndy

Hey @gorakhnathy7 would love to work on this issue and contribute could you please assign it to me!

ayussh-2 avatar Oct 02 '25 03:10 ayussh-2