Skip to content

feat(payments): Add feature_metadata in the payments response for v2#8667

Merged
likhinbopanna merged 5 commits intomainfrom
openapi-changes
Jul 16, 2025
Merged

feat(payments): Add feature_metadata in the payments response for v2#8667
likhinbopanna merged 5 commits intomainfrom
openapi-changes

Conversation

@Aprabhat19
Copy link
Contributor

@Aprabhat19 Aprabhat19 commented Jul 16, 2025

Type of Change

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

Description

Add feature_metadata in the payments response for revenue recovery in v2. Also added it in the open api spec

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?

  • Create a Org and MA and MCA in v2
  • Create a payment in v2
curl --location 'http://localhost:8080/v2/payments/create-intent' \
--header 'api-key: dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_xwf1Kn6sgcq34ih9HHPa' \
--header 'Authorization: api-key=dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--data-raw '{
    "amount_details": {
        "order_amount": 100,
        "currency": "USD"
    },
    "capture_method": "manual",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Dough"
        },
        "email": "example@example.com"
    },
    "shipping": {
        "address": {
            "first_name": "John",
            "last_name": "Dough",
            "city": "Karwar",
            "zip": "581301",
            "state": "Karnataka"
        },
        "email": "example@example.com"
    }
}'
  • Confirm the payment
Request 
curl --location 'http://localhost:8080/v2/payments/12345_pay_019813ec28f073d38d5fe2d117a0a660/confirm-intent' \
--header 'x-client-secret: cs_019813ec291571039181693bb212e6dd' \
--header 'x-profile-id: pro_xwf1Kn6sgcq34ih9HHPa' \
--header 'Authorization: api-key=dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_RvJ0UsrpfypkXccsGyytfee97LjWGSymDBIoR2K1zpxmUvaDScyXr9e4QH5cSUKc' \
--data '{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "card_exp_year": "25",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit"
}'
  • Feature Metadata would be present
Response

{
    "id": "12345_pay_019813ec28f073d38d5fe2d117a0a660",
    "status": "failed",
    "amount": {
        "order_amount": 100,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": null
    },
    "customer_id": null,
    "connector": "stripe",
    "created": "2025-07-16T15:48:20.872Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": null,
    "connector_reference_id": null,
    "merchant_connector_id": "mca_to621nCh9AUHtzEEgQWp",
    "browser_info": null,
    "error": {
        "code": "No error code",
        "message": "No error message",
        "unified_code": null,
        "unified_message": null,
        "network_advice_code": null,
        "network_decline_code": null,
        "network_error_message": null
    },
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": "no_three_ds",
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": null,
    "raw_connector_response": null,
    "feature_metadata": null
}

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

@Aprabhat19 Aprabhat19 requested review from a team as code owners July 16, 2025 14:37
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jul 16, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_domain_models/src/lib.rs  86% smaller
  crates/router/src/core/payments/transformers.rs  1% smaller
  api-reference/v2/openapi_spec_v2.json  0% smaller
  crates/api_models/src/payments.rs  0% smaller

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jul 16, 2025
@Aprabhat19 Aprabhat19 changed the title feat(payments): Add feature_metadata in the payments response feat(payments): Add feature_metadata in the payments response for v2 Jul 16, 2025
@Aprabhat19 Aprabhat19 linked an issue Jul 16, 2025 that may be closed by this pull request
@likhinbopanna likhinbopanna enabled auto-merge July 16, 2025 15:47
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 16, 2025
Merged via the queue into main with commit dcf867d Jul 16, 2025
36 of 43 checks passed
@likhinbopanna likhinbopanna deleted the openapi-changes branch July 16, 2025 16:48
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] : Add feature metadata in payments response

4 participants