Skip to content

feat(payment_link): expose configurations for payment links#7742

Merged
Gnanasundari24 merged 6 commits intomainfrom
7737-enhancement-expose-configurations-from-payment-links
Apr 9, 2025
Merged

feat(payment_link): expose configurations for payment links#7742
Gnanasundari24 merged 6 commits intomainfrom
7737-enhancement-expose-configurations-from-payment-links

Conversation

@kashif-m
Copy link
Contributor

@kashif-m kashif-m commented Apr 7, 2025

Type of Change

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

Description

This PR exposes three configurations for payment links

  1. payment_form_header_text - for rendering a header text for payment links
  2. payment_form_label_type - for specifying the type of payment form labels (floating / above / never)
  3. show_card_terms - for controlling visibility of the terms for cards (auto / always / never)

Additional Changes

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

Motivation and Context

Helps in exposing UI functionalities through some configs for SDK.

How did you test it?

Tested locally

Create payment link with new configs

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_ML2p8kRGcMvi4oQ3cPnIfz5R2rO31efjWKXzgMnbRCnj5pUpjiki8K2HONlmMAb4' \
    --data-raw '{"authentication_type":"three_ds","customer_id":"cus_9SCrW9x19m2WbGYHprJS","profile_id":"pro_jZ4ix0hYxn8qi2NSSYih","amount":100,"currency":"EUR","payment_link":true,"setup_future_usage":"off_session","capture_method":"automatic","billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"NL","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"random@juspay.in"},"return_url":"https://example.com","payment_link_config":{"theme":"#2167AE","enable_button_only_on_form_ready":true,"display_sdk_only":true,"show_card_terms":"never","payment_form_label_type":"floating","payment_form_header_text":"Detalles de tu tarjeta","payment_link_ui_rules":{"#submit":{"height":"max-content","borderRadius":"50px","padding":"14px 20px","marginTop":"48px","fontSize":"20px"},"#submit.not-ready":{"backgroundColor":"#A6ADAF !important"},"#submit.processing":{"paddingLeft":"50px !important","paddingRight":"50px !important"}},"sdk_ui_rules":{".Input, .Input:focus, .Input--invalid, .Input--empty":{"border":"none","boxShadow":"none","borderRadius":"28px","paddingLeft":"22px !important","paddingBottom":"2px !important","backgroundColor":"rgb(231, 234, 235) !important","height":"56px","fontSize":"20px"},".Input, .Input:focus, .Input--empty":{"color":"#23366F"},".Input--invalid":{"border":"2px solid #CB4B40 !important"},".Label":{"marginLeft":"22px","color":"#2167AE","opacity":"1 !important","bottom":"5px"},".Label--invalid, .Input--invalid, .Error":{"color":"#CB4B40 !important","opacity":"1 !important"},".Label--floating":{"opacity":"1 !important"},".InputLogo--empty":{"color":"#979797"},".InputLogo":{"color":"#23366F"},".InputLogo--invalid":{"color":"#CB4B40"},".PaymentLabel":{"color":"#23366F !important","fontSize":"24px"}}}}'

Response

{"payment_id":"pay_McmUUZfc21SHM7Hpc9Sr","merchant_id":"merchant_1743758708","status":"requires_payment_method","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":null,"client_secret":"pay_McmUUZfc21SHM7Hpc9Sr_secret_ohEWaukkfjWDkoB2U7pc","created":"2025-04-07T11:49:19.273Z","currency":"EUR","customer_id":"cus_9SCrW9x19m2WbGYHprJS","customer":{"id":"cus_9SCrW9x19m2WbGYHprJS","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"NL","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"John","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"random@juspay.in"},"order_details":null,"email":null,"name":null,"phone":null,"return_url":"https://example.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_9SCrW9x19m2WbGYHprJS","created_at":1744026559,"expires":1744030159,"secret":"epk_74f58545483841e7a27ef0bddca9b8b5"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"http://localhost:8080/payment_link/merchant_1743758708/pay_McmUUZfc21SHM7Hpc9Sr?locale=en","secure_link":"http://localhost:8080/payment_link/s/merchant_1743758708/pay_McmUUZfc21SHM7Hpc9Sr?locale=en","payment_link_id":"plink_1VJHoVm7E71veuUAJhI8"},"profile_id":"pro_jZ4ix0hYxn8qi2NSSYih","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-04-07T12:04:19.254Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-04-07T11:49:19.358Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null}

Verify below things

  1. Label is floating when
  2. Payment form has a header text
  3. Card terms are missing for off_session payment type
Screenshot 2025-04-07 at 5 21 04 PM

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

@kashif-m kashif-m self-assigned this Apr 7, 2025
@kashif-m kashif-m requested review from a team as code owners April 7, 2025 11:51
@kashif-m kashif-m linked an issue Apr 7, 2025 that may be closed by this pull request
@semanticdiff-com
Copy link

semanticdiff-com bot commented Apr 7, 2025

sahkal
sahkal previously approved these changes Apr 8, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Apr 8, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Apr 9, 2025
Merged via the queue into main with commit b475171 Apr 9, 2025
16 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the 7737-enhancement-expose-configurations-from-payment-links branch April 9, 2025 07:47
pixincreate added a commit that referenced this pull request Apr 10, 2025
…acilitapay-pix-pmt

* 'main' of github.com:juspay/hyperswitch: (21 commits)
  chore(version): 2025.04.10.0
  refactor(connector): [STRIPE] Remove sofort bank redirect from stripe (#7733)
  feat(connector): Add invoice number and email in AuthorizeDotNet connector (#7726)
  fix(router): fix retry_count and add validation for process_tracker (#7614)
  feat(payment_link): expose configurations for payment links (#7742)
  chore(version): 2025.04.09.0
  chore(postman): update Postman collection files
  feat(connector): [AIRWALLEX, ELAVON, NOVALNET, XENDIT] add in feature API (#7163)
  refactor: move merchant_key_store table to accounts schema (#7746)
  chore(postman): update `Stripe` response `status`, `error_code`, and `error_message` for deprecated `Sofort` (#7730)
  feat(connector): Add recovery support for recurly [v2] (#7497)
  refactor(cypress): update BOA configs for manual payments' refunds and connector agnostic (#7690)
  feat(router): Support `card` in `payment_method_subtype` [V2] (#7662)
  feat: Add open API reference for Intelligent router (#7727)
  ci(cypress-ci): remove wise payout from running in github ci (#7756)
  feat(authentication): create authentications to fallback to ApiKeyAuth if AdminApiAuth fails (#7744)
  chore(version): 2025.04.08.0
  feat(core): added force_3ds_challenge for decoupled txns (#7484)
  chore(version): 2025.04.07.0
  chore(postman): update Postman collection files
  ...
@kashif-m kashif-m restored the 7737-enhancement-expose-configurations-from-payment-links branch April 10, 2025 15:16
@kashif-m kashif-m deleted the 7737-enhancement-expose-configurations-from-payment-links branch April 10, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-api-contract-changes Metadata: This PR involves API contract changes Payment Links

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] expose configurations from payment links

4 participants