Skip to content

Conversation

@sai-harsha-vardhan
Copy link
Contributor

Type of Change

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

Description

Add is_guest_customer to the payment method list response.

This is required so the SDK can take appropriate actions, such as showing or hiding the checkbox based on the is_guest_customer flag.

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?

Tested Manually

  1. Create a payment by sending customer_id in the request
    CURL
curl --location 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Fk54NrPnU5sGnTO4UtCtdPSrAWYAeCR7I3nLRo2PPqSuQZkVKqhEhV0P2rMUwx15' \
--data '{
    "amount": 100,
    "currency": "USD",
    "confirm": false,
    "customer_id": "cus_123"
}'
  1. Perform PML for that payment_intent to observe is_guest_customer sent as false
    CURL
curl --location 'localhost:8080/account/payment_methods?client_secret=pay_vfX30nQkBTC2UjyyVW8H_secret_a2oaRjdcHnqVgB4MAz6T' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_4014d6aecda84e198bb723506bf837da'

Response

{
    "redirect_url": "https://example.com/success",
    "currency": "USD",
    "payment_methods": [],
    "mandate_payment": null,
    "merchant_name": "NewAge Retailer",
    "show_surcharge_breakup_screen": false,
    "payment_type": "normal",
    "request_external_three_ds_authentication": false,
    "collect_shipping_details_from_wallets": false,
    "collect_billing_details_from_wallets": false,
    "is_tax_calculation_enabled": false,
    "sdk_next_action": {
        "next_action": "confirm"
    },
    "is_guest_customer": false
}
  1. Create a payment by not sending customer_id in the request
    CURL
curl --location 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Fk54NrPnU5sGnTO4UtCtdPSrAWYAeCR7I3nLRo2PPqSuQZkVKqhEhV0P2rMUwx15' \
--data '{
    "amount": 100,
    "currency": "USD",
    "confirm": false
}'
  1. Perform PML for that payment_intent to observe is_guest_customer sent as true
    CURL
curl --location --request GET 'localhost:8080/account/payment_methods?client_secret=pay_NKRFhGg1TeRtRdKddBPg_secret_3kos32lK71neCujThJvA' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_4014d6aecda84e198bb723506bf837da' \
--data '{
    "client_secret": "pay_NKRFhGg1TeRtRdKddBPg_secret_3kos32lK71neCujThJvA"
}'

Response

{
    "redirect_url": "https://example.com/success",
    "currency": "USD",
    "payment_methods": [],
    "mandate_payment": null,
    "merchant_name": "NewAge Retailer",
    "show_surcharge_breakup_screen": false,
    "payment_type": "normal",
    "request_external_three_ds_authentication": false,
    "collect_shipping_details_from_wallets": false,
    "collect_billing_details_from_wallets": false,
    "is_tax_calculation_enabled": false,
    "sdk_next_action": {
        "next_action": "confirm"
    },
    "is_guest_customer": true
}

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

@sai-harsha-vardhan sai-harsha-vardhan added this to the July 2025 Release milestone Dec 10, 2025
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this Dec 10, 2025
@sai-harsha-vardhan sai-harsha-vardhan requested a review from a team as a code owner December 10, 2025 08:10
@sai-harsha-vardhan sai-harsha-vardhan added A-core Area: Core flows A-payment-methods Area: Payment Methods labels Dec 10, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 10, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  api-reference/v1/openapi_spec_v1.json  29% smaller
  crates/api_models/src/payment_methods.rs  0% smaller
  crates/router/src/core/payment_methods/cards.rs  0% smaller

@hyperswitch-bot hyperswitch-bot bot requested a review from a team as a code owner December 10, 2025 08:17
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@2962902). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10598   +/-   ##
=======================================
  Coverage        ?    6.44%           
=======================================
  Files           ?     1254           
  Lines           ?   313328           
  Branches        ?        0           
=======================================
  Hits            ?    20208           
  Misses          ?   293120           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-core Area: Core flows A-payment-methods Area: Payment Methods M-api-contract-changes Metadata: This PR involves API contract changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants