Skip to content

fix: Payments redirects for v2#8405

Merged
Gnanasundari24 merged 1 commit intomainfrom
fix-redirects-v2
Jun 23, 2025
Merged

fix: Payments redirects for v2#8405
Gnanasundari24 merged 1 commit intomainfrom
fix-redirects-v2

Conversation

@Aishwariyaa-Anand
Copy link
Contributor

@Aishwariyaa-Anand Aishwariyaa-Anand commented Jun 20, 2025

Type of Change

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

Description

This PR fixes payment redirects in v2. This was due to the field merchant_connector_details set as todo!()

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?

  • Make 3DS payment
curl --location 'http://localhost:8080/v2/payments' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_295oknnkIU8LhiO6RTCy' \
--header 'Authorization: api-key=dev_8OKnwsVtu4ZIxxgqDfVQwnQrUfdORX3Ivo9i8Yxp0rB3mEZxiv9UZchQimjPgNnx' \
--data-raw '{
  "amount_details": {
    "currency": "USD",
    "order_amount": 6540
  },
  "authentication_type": "three_ds",
  "payment_method_data": {
    "card": {
      "card_cvc": "123",
      "card_exp_month": "10",
      "card_exp_year": "25",
      "card_holder_name": "joseph Doe",
      "card_number": "4242424242424242"
    }
  },
  "payment_method_subtype": "credit",
  "payment_method_type": "card"
}'

Response

{
    "id": "12345_pay_01978cfda5fa7c12b1ba298cca0470c2",
    "status": "requires_customer_action",
    "amount": {
        "order_amount": 6540,
        "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": 6540,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": null
    },
    "customer_id": null,
    "connector": "stripe",
    "created": "2025-06-20T10:58:42.813Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": "pi_3Rc2edD5R7gDAGff01vwkClL",
    "connector_reference_id": null,
    "merchant_connector_id": "mca_0GI0dABwex0qdnwlUelt",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": {
        "token": "pm_1Rc2edD5R7gDAGffEOosatGV",
        "connector_token_request_reference_id": "eDuVwDClp0zQPbbkLZ"
    },
    "payment_method_id": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/v2/payments/12345_pay_01978cfda5fa7c12b1ba298cca0470c2/start-redirection?publishable_key=pk_dev_4499ca4660714d6b83b379218164187a&profile_id=pro_295oknnkIU8LhiO6RTCy"
    },
    "return_url": "https://google.com/success",
    "authentication_type": "three_ds",
    "authentication_type_applied": "three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": null
}

Redirect to URL

  • Payments Sync
curl --location 'http://localhost:8080/v2/payments/12345_pay_01978cfda5fa7c12b1ba298cca0470c2?force_sync=true' \
--header 'x-profile-id: pro_295oknnkIU8LhiO6RTCy' \
--header 'Authorization: api-key=dev_8OKnwsVtu4ZIxxgqDfVQwnQrUfdORX3Ivo9i8Yxp0rB3mEZxiv9UZchQimjPgNnx' \
--data ''

Response

{
    "id": "12345_pay_01978cfda5fa7c12b1ba298cca0470c2",
    "status": "succeeded",
    "amount": {
        "order_amount": 6540,
        "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": 6540,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 6540
    },
    "customer_id": null,
    "connector": "stripe",
    "created": "2025-06-20T10:58:42.813Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": "pi_3Rc2edD5R7gDAGff01vwkClL",
    "connector_reference_id": null,
    "merchant_connector_id": "mca_0GI0dABwex0qdnwlUelt",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": {
        "token": "pm_1Rc2edD5R7gDAGffEOosatGV",
        "connector_token_request_reference_id": "eDuVwDClp0zQPbbkLZ"
    },
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": "three_ds",
    "authentication_type_applied": null,
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": 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

@Aishwariyaa-Anand Aishwariyaa-Anand self-assigned this Jun 20, 2025
@Aishwariyaa-Anand Aishwariyaa-Anand added the C-bug Category: Bug label Jun 20, 2025
@Aishwariyaa-Anand Aishwariyaa-Anand requested a review from a team as a code owner June 20, 2025 11:02
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jun 20, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments.rs  0% smaller

@Aishwariyaa-Anand Aishwariyaa-Anand linked an issue Jun 20, 2025 that may be closed by this pull request
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 23, 2025
Merged via the queue into main with commit 7338a8d Jun 23, 2025
22 of 27 checks passed
@Gnanasundari24 Gnanasundari24 deleted the fix-redirects-v2 branch June 23, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug Category: Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix payment redirects for v2

4 participants