I need to understand exactly how the PaymentsAuthorizeData structure gets populated with…
- User
I need to understand exactly how the PaymentsAuthorizeData structure gets populated with merchant_reference_id in v2 flows. Based on the code analysis so far, I see that:
- The v2 PaymentsCreateIntentRequest includes merchant_reference_id field (line 178)
- The PaymentsAuthorizeData structure already has merchant_order_reference_id field (line 77 in router_request_types.rs)
- The field is documented as: "Merchant's identifier for the payment/invoice. This will be sent to the connector if the connector provides support to accept multiple reference ids."
The issue seems to be that in v2, the merchant_reference_id from the v2 request is not being copied to the merchant_order_reference_id field in PaymentsAuthorizeData.
Let me examine how this mapping should happen - specifically, where the v2 request data is converted to the internal PaymentsAuthorizeData structure.
Assistant
I'll help you understand how the
merchant_reference_idfrom the v2 PaymentsCreateIntentRequest gets mapped to themerchant_order_reference_idin thePaymentsAuthorizeDatastructure. Let me search for the relevant code to trace this flow.Assistant
Let me search more broadly for payment-related files, especially those containing the structures we're interested in.
Assistant
Now let me search for the router_request_types.rs file that contains the PaymentsAuthorizeData structure mentioned in your question.
Assistant
Let me read the router_request_types.rs file to understand the PaymentsAuthorizeData structure.
Assistant
Now let me look at the API models to understand the v2 PaymentsCreateIntentRequest structure with merchant_reference_id.
Assistant
Let me search for payment request structures in the API models more broadly:
Assistant
Let me look for the main payment request structure definitions:
Assistant
(no content)
Assistant
Let me look at the main payments module structure:
Assistant
Let me search for "merchant_reference_id" in the entire codebase to understand how it's being used:
Assistant
Let me look at the API models for payments to understand the structure:
Assistant
(no content)
Assistant
Now I can see that the merchant_reference_id is indeed part of the v2 payments request structure. Let me look for how the v2 request gets converted to the internal data structures, particularly focusing on payment creation flow:
Assistant
Now let me search for where PaymentsCreateIntentRequest gets converted into PaymentsAuthorizeData, focusing on the payment creation flow:
Assistant
(no content)
Assistant
Now I need to understand how the PaymentsAuthorizeData is populated from the v2 request. Looking at line 144, I see that it's calling
hyperswitch_domain_models::payments::PaymentIntent::create_domain_model_from_request()to create the domain model. Let me check the payment intent domain model:Assistant
(no content)
Assistant
Let me look at the full function definition and implementation in the payments.rs file:
Assistant
Great! Now I can see that on line 642,
merchant_reference_idis being correctly assigned from the request to the payment intent. However, now I need to find out how the conversion fromPaymentIntenttoPaymentsAuthorizeDatahappens. This happens during payment confirmation or authorization. Let me look for transformers or payment flows:Assistant
Let me also check where PaymentsAuthorizeData gets populated in the payment flows:
Assistant
Perfect! This is revealing. I can see there are references to
merchant_order_reference_idin various places. Line 3347 shows:merchant_order_reference_id: payment_intent.merchant_order_reference_id,And line 3560 shows:
merchant_order_reference_id: pi.merchant_order_reference_id,But wait, looking back at the payments.rs file where we saw the assignment on line 642, I see
merchant_reference_idwas set from the request. Let me double-check if that's the right field. Let me look at the specific transformer code:Assistant
Now let me also check line 3560:
Assistant
Looking at both of these cases, it seems that in some parts of the codebase
merchant_order_reference_idis being populated frompi.merchant_order_reference_id(which comes from the payment intent). However, the question is whether there is a case where we need to copy frommerchant_reference_idtomerchant_order_reference_idduring a conversion process.Let me examine the exact transformation logic to understand when this mapping occurs. But first, I notice something interesting - let me search for where the
PaymentsAuthorizeDatagets created from a payment intent or request:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →
claude-haiku-4-5-20251001Compare side by side →