Skip to content

Conversation

sai-harsha-vardhan
Copy link
Contributor

@sai-harsha-vardhan sai-harsha-vardhan commented Sep 25, 2025

Type of Change

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

Description

add api models and openapi changes for payments submit eligibility api

Additional Changes

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

Motivation and Context

Introduce a /eligibility POST API that the SDK can call before payments confirm to decide the course of action for that particular payment. This can include the next action block, extended payment method information, payment method eligibility, temp payment method data, etc.

How did you test it?

Testing is not required as this PR contains only api model changes, core flow to be added

Run mintlify dev locally to test api-reference changes

image

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 Sep 25, 2025
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this Sep 25, 2025
@sai-harsha-vardhan sai-harsha-vardhan requested a review from a team as a code owner September 25, 2025 17:56
@sai-harsha-vardhan sai-harsha-vardhan added A-core Area: Core flows M-api-contract-changes Metadata: This PR involves API contract changes labels Sep 25, 2025
Copy link

semanticdiff-com bot commented Sep 25, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  api-reference/docs.json  67% smaller
  api-reference/v2/openapi_spec_v2.json  67% smaller
  api-reference/v1/openapi_spec_v1.json  2% smaller
  api-reference/v1/payments/payments--submit-eligibility-data.mdx Unsupported file format
  crates/api_models/src/payments.rs  0% smaller
  crates/openapi/src/openapi.rs  0% smaller
  crates/openapi/src/routes/payments.rs  0% smaller

pub struct PaymentsEligibilityRequest {
/// Token used for client side verification
#[schema(value_type = String, example = "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo")]
pub client_secret: Secret<String>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in v2, this should come from header. Authorization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a V1 api model

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not about v1 and v2, unification of auth required this needs to be in headers. So move this header in a separate PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a tracking issue @sai-harsha-vardhan

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - #9577

pub struct PaymentsEligibilityRequest {
/// Token used for client side verification
#[schema(value_type = String, example = "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo")]
pub client_secret: Secret<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not about v1 and v2, unification of auth required this needs to be in headers. So move this header in a separate PR

pub struct PaymentsEligibilityRequest {
/// Token used for client side verification
#[schema(value_type = String, example = "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo")]
pub client_secret: Secret<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a tracking issue @sai-harsha-vardhan

pub payment_method: api_enums::PaymentMethod,
/// The payment method type to be used for the payment
#[schema(value_type = Option<PaymentMethodType>)]
pub payment_method_type: Option<api_enums::PaymentMethodType>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When payment_method is a mandatory field, how come payment_method_type is optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for card payment_method as sending credit / debit is optional

/// The next action call is Complete Authorize
CompleteAuthorize,
/// The next action is to await for a merchant callback
AwaitMerchantCallback,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Next action means, then is this CheckEligibility?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDK Next action indicates the action to be done by SDK, in this case SDK has to await for merchant callback and merchant is the one who is doing CheckEligibility here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants