hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(payments): [Payment links] add hide card nickname field config for secure payment links

Open srujanchikke opened this issue 3 months ago • 1 comments

Type of Change

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

Description

Add hide card nickname field config for secure payment links. https://docs.hyperswitch.io/explore-hyperswitch/merchant-controls/integration-guide/web/customization#id-9.-hide-card-nickname-field .

Additional Changes

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

Motivation and Context

How did you test it?

Secure links

1. Update `allowed_domains` in business profile - (unfold to view cURL)
curl --location 'http://localhost:8080/account/merchant_1721984694/business_profile/pro_oXHnmgfZSnfe92PvodqP' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "payment_link_config": {
        "allowed_domains": [
            "*"
        ],
        "enabled_saved_payment_method": true,
        "hide_card_nickname_field" : true
    }
}'

2. Create a payment link - (unfold to view cURL)
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_eBTVu8OMN1HmE2xr0I0dsfypWOVwQBlietvkxf0sgYMdyFM5nRO40M8M4MLH42Jk' \
--data '{
    "customer_id": "cus_izAOZiynP5URGEvEfmgH",
    "amount": 100,
    "currency": "USD",
    "payment_link": true,
    "connector": [
        "stripe"
    ],
    "session_expiry": 1000000,
    "return_url": "http://127.0.0.1:5500/src/pl_iframe.html",
    "payment_link_config": {
        "theme": "#14356f",
        "logo": "https://logosandtypes.com/wp-content/uploads/2020/08/zurich.svg",
        "seller_name": "Zurich Inc."
    }
}'

3. Open the secure payment link (`secure_link` in API response) in an iframe for validating the functionality. card nickname field should be disabled even when Save card details checkbox is enabled in sdk. Screenshot 2024-11-13 at 4 19 23 PM

Checklist

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

srujanchikke avatar Nov 13 '24 10:11 srujanchikke