Skip to content

Commit 540ef07

Browse files
gorakhnathy7hyperswitch-bot[bot]kashif-mNarayanbhat166
authored
Docs: API-Ref changes for Payouts (#5236)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Kashif <[email protected]> Co-authored-by: Narayan Bhat <[email protected]>
1 parent 217f1f4 commit 540ef07

File tree

5 files changed

+34
-33
lines changed

5 files changed

+34
-33
lines changed

api-reference/openapi_spec.json

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7817,7 +7817,7 @@
78177817
},
78187818
"ChargeRefunds": {
78197819
"type": "object",
7820-
"description": "Charge object for refunds",
7820+
"description": "Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.",
78217821
"required": [
78227822
"charge_id"
78237823
],
@@ -16251,13 +16251,6 @@
1625116251
"example": true,
1625216252
"nullable": true
1625316253
},
16254-
"capture_on": {
16255-
"type": "string",
16256-
"format": "date-time",
16257-
"description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true",
16258-
"example": "2022-09-10T10:11:12Z",
16259-
"nullable": true
16260-
},
1626116254
"capture_method": {
1626216255
"allOf": [
1626316256
{
@@ -18313,7 +18306,8 @@
1831318306
}
1831418307
}
1831518308
}
18316-
]
18309+
],
18310+
"description": "Custom payout link config for the particular payout, if payout link is to be generated."
1831718311
},
1831818312
"PayoutCreateRequest": {
1831918313
"type": "object",
@@ -18332,15 +18326,15 @@
1833218326
"properties": {
1833318327
"payout_id": {
1833418328
"type": "string",
18335-
"description": "Unique identifier for the payout. This ensures idempotency for multiple payouts\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.",
18329+
"description": "Unique identifier for the payout. This ensures idempotency for multiple payouts that have been done by a single merchant. This field is auto generated and is returned in the API response, **not required to be included in the Payout Create/Update Request.**",
1833618330
"example": "payout_mbabizu24mvu3mela5njyhpit4",
1833718331
"nullable": true,
1833818332
"maxLength": 30,
1833918333
"minLength": 30
1834018334
},
1834118335
"merchant_id": {
1834218336
"type": "string",
18343-
"description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
18337+
"description": "This is an identifier for the merchant account. This is inferred from the API key provided during the request, **not required to be included in the Payout Create/Update Request.**",
1834418338
"example": "merchant_1668273825",
1834518339
"nullable": true,
1834618340
"maxLength": 255
@@ -18367,7 +18361,7 @@
1836718361
"items": {
1836818362
"$ref": "#/components/schemas/PayoutConnectors"
1836918363
},
18370-
"description": "This allows the merchant to manually select a connector with which the payout can go through",
18364+
"description": "This field allows the merchant to manually select a connector with which the payout can go through.",
1837118365
"example": [
1837218366
"wise",
1837318367
"adyen"
@@ -18376,7 +18370,7 @@
1837618370
},
1837718371
"confirm": {
1837818372
"type": "boolean",
18379-
"description": "The boolean value to create payout with connector",
18373+
"description": "This field is used when merchant wants to confirm the payout, thus useful for the payout _Confirm_ request. Ideally merchants should _Create_ a payout, _Update_ it (if required), then _Confirm_ it.",
1838018374
"default": false,
1838118375
"example": true
1838218376
},
@@ -18477,21 +18471,21 @@
1847718471
},
1847818472
"payout_token": {
1847918473
"type": "string",
18480-
"description": "Provide a reference to a stored payout method",
18474+
"description": "Provide a reference to a stored payout method, used to process the payout.",
1848118475
"example": "187282ab-40ef-47a9-9206-5099ba31e432",
1848218476
"nullable": true
1848318477
},
1848418478
"profile_id": {
1848518479
"type": "string",
18486-
"description": "The business profile to use for this payout, if not passed the default business profile\nassociated with the merchant account will be used.",
18480+
"description": "The business profile to use for this payout, especially if there are multiple business profiles associated with the account, otherwise default business profile associated with the merchant account will be used.",
1848718481
"nullable": true
1848818482
},
1848918483
"priority": {
1849018484
"$ref": "#/components/schemas/PayoutSendPriority"
1849118485
},
1849218486
"payout_link": {
1849318487
"type": "boolean",
18494-
"description": "Whether to get the payout link (if applicable)",
18488+
"description": "Whether to get the payout link (if applicable). Merchant need to specify this during the Payout _Create_, this field can not be updated during Payout _Update_.",
1849518489
"default": false,
1849618490
"example": true,
1849718491
"nullable": true
@@ -18713,6 +18707,7 @@
1871318707
},
1871418708
"PayoutEntityType": {
1871518709
"type": "string",
18710+
"description": "Type of entity to whom the payout is being carried out to, select from the given list of options",
1871618711
"enum": [
1871718712
"Individual",
1871818713
"Company",
@@ -18953,7 +18948,8 @@
1895318948
}
1895418949
}
1895518950
}
18956-
]
18951+
],
18952+
"description": "The payout method information required for carrying out a payout"
1895718953
},
1895818954
"PayoutRequest": {
1895918955
"oneOf": [
@@ -19034,6 +19030,7 @@
1903419030
},
1903519031
"PayoutSendPriority": {
1903619032
"type": "string",
19033+
"description": "The send method which will be required for processing payouts, check options for better understanding.",
1903719034
"enum": [
1903819035
"instant",
1903919036
"fast",
@@ -19063,6 +19060,7 @@
1906319060
},
1906419061
"PayoutType": {
1906519062
"type": "string",
19063+
"description": "The payout_type of the payout request is a mandatory field for confirming the payouts. It should be specified in the Create request. If not provided, it must be updated in the Payout Update request before it can be confirmed.",
1906619064
"enum": [
1906719065
"card",
1906819066
"bank",

crates/api_models/src/payments.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,6 +3674,7 @@ pub struct PaymentsResponse {
36743674
/// Providing this field will automatically set `capture` to true
36753675
#[schema(example = "2022-09-10T10:11:12Z")]
36763676
#[serde(with = "common_utils::custom_serde::iso8601::option")]
3677+
#[remove_in(PaymentsCreateResponseOpenApi)]
36773678
pub capture_on: Option<PrimitiveDateTime>,
36783679

36793680
/// This is the instruction for capture/ debit the money from the users' card. On the other hand authorization refers to blocking the amount on the users' payment method.

crates/api_models/src/payouts.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ pub enum PayoutRequest {
2121
#[derive(Default, Debug, Deserialize, Serialize, Clone, ToSchema)]
2222
#[serde(deny_unknown_fields)]
2323
pub struct PayoutCreateRequest {
24-
/// Unique identifier for the payout. This ensures idempotency for multiple payouts
25-
/// that have been done by a single merchant. This field is auto generated and is returned in the API response.
24+
/// Unique identifier for the payout. This ensures idempotency for multiple payouts that have been done by a single merchant. This field is auto generated and is returned in the API response, **not required to be included in the Payout Create/Update Request.**
2625
#[schema(
2726
value_type = Option<String>,
2827
min_length = 30,
@@ -31,8 +30,7 @@ pub struct PayoutCreateRequest {
3130
)]
3231
pub payout_id: Option<String>, // TODO: #1321 https://github.com/juspay/hyperswitch/issues/1321
3332

34-
/// This is an identifier for the merchant account. This is inferred from the API key
35-
/// provided during the request
33+
/// This is an identifier for the merchant account. This is inferred from the API key provided during the request, **not required to be included in the Payout Create/Update Request.**
3634
#[schema(max_length = 255, value_type = Option<String>, example = "merchant_1668273825")]
3735
pub merchant_id: Option<id_type::MerchantId>,
3836

@@ -52,15 +50,15 @@ pub struct PayoutCreateRequest {
5250
}))]
5351
pub routing: Option<serde_json::Value>,
5452

55-
/// This allows the merchant to manually select a connector with which the payout can go through
53+
/// This field allows the merchant to manually select a connector with which the payout can go through.
5654
#[schema(value_type = Option<Vec<PayoutConnectors>>, max_length = 255, example = json!(["wise", "adyen"]))]
5755
pub connector: Option<Vec<api_enums::PayoutConnectors>>,
5856

59-
/// The boolean value to create payout with connector
57+
/// This field is used when merchant wants to confirm the payout, thus useful for the payout _Confirm_ request. Ideally merchants should _Create_ a payout, _Update_ it (if required), then _Confirm_ it.
6058
#[schema(value_type = bool, example = true, default = false)]
6159
pub confirm: Option<bool>,
6260

63-
/// The payout_type of the payout request can be specified here
61+
/// The payout_type of the payout request can be specified here, this is a mandatory field to _Confirm_ the payout, i.e., should be passed in _Create_ request, if not then should be updated in the payout _Update_ request, then only it can be confirmed.
6462
#[schema(value_type = PayoutType, example = "card")]
6563
pub payout_type: Option<api_enums::PayoutType>,
6664

@@ -129,7 +127,7 @@ pub struct PayoutCreateRequest {
129127
#[schema(example = "It's my first payout request", value_type = String)]
130128
pub description: Option<String>,
131129

132-
/// Type of entity to whom the payout is being carried out to
130+
/// Type of entity to whom the payout is being carried out to, select from the given list of options
133131
#[schema(value_type = PayoutEntityType, example = "Individual")]
134132
pub entity_type: Option<api_enums::PayoutEntityType>,
135133

@@ -141,23 +139,22 @@ pub struct PayoutCreateRequest {
141139
#[schema(value_type = Option<Object>, example = r#"{ "udf1": "some-value", "udf2": "some-value" }"#)]
142140
pub metadata: Option<pii::SecretSerdeValue>,
143141

144-
/// Provide a reference to a stored payout method
142+
/// Provide a reference to a stored payout method, used to process the payout.
145143
#[schema(example = "187282ab-40ef-47a9-9206-5099ba31e432")]
146144
pub payout_token: Option<String>,
147145

148-
/// The business profile to use for this payout, if not passed the default business profile
149-
/// associated with the merchant account will be used.
146+
/// The business profile to use for this payout, especially if there are multiple business profiles associated with the account, otherwise default business profile associated with the merchant account will be used.
150147
pub profile_id: Option<String>,
151148

152-
/// The send method for processing payouts
149+
/// The send method which will be required for processing payouts, check options for better understanding.
153150
#[schema(value_type = PayoutSendPriority, example = "instant")]
154151
pub priority: Option<api_enums::PayoutSendPriority>,
155152

156-
/// Whether to get the payout link (if applicable)
153+
/// Whether to get the payout link (if applicable). Merchant need to specify this during the Payout _Create_, this field can not be updated during Payout _Update_.
157154
#[schema(default = false, example = true)]
158155
pub payout_link: Option<bool>,
159156

160-
/// custom payout link config for the particular payout
157+
/// Custom payout link config for the particular payout, if payout link is to be generated.
161158
#[schema(value_type = Option<PayoutCreatePayoutLinkConfig>)]
162159
pub payout_link_config: Option<PayoutCreatePayoutLinkConfig>,
163160

@@ -167,6 +164,7 @@ pub struct PayoutCreateRequest {
167164
pub session_expiry: Option<u32>,
168165
}
169166

167+
/// Custom payout link config for the particular payout, if payout link is to be generated.
170168
#[derive(Default, Debug, Deserialize, Serialize, Clone, ToSchema)]
171169
pub struct PayoutCreatePayoutLinkConfig {
172170
/// The unique identifier for the collect link.
@@ -182,6 +180,7 @@ pub struct PayoutCreatePayoutLinkConfig {
182180
pub enabled_payment_methods: Option<Vec<link_utils::EnabledPaymentMethod>>,
183181
}
184182

183+
/// The payout method information required for carrying out a payout
185184
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
186185
#[serde(rename_all = "snake_case")]
187186
pub enum PayoutMethodData {
@@ -486,7 +485,7 @@ pub struct PayoutCreateResponse {
486485
#[serde(skip_serializing_if = "Option::is_none")]
487486
pub attempts: Option<Vec<PayoutAttemptResponse>>,
488487

489-
// If payout link is request, this represents response on
488+
/// If payout link was requested, this contains the link's ID and the URL to render the payout widget
490489
#[schema(value_type = Option<PayoutLinkResponse>)]
491490
pub payout_link: Option<PayoutLinkResponse>,
492491
}

crates/common_enums/src/enums.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,6 +2310,7 @@ pub enum PayoutStatus {
23102310
RequiresVendorAccountCreation,
23112311
}
23122312

2313+
/// The payout_type of the payout request is a mandatory field for confirming the payouts. It should be specified in the Create request. If not provided, it must be updated in the Payout Update request before it can be confirmed.
23132314
#[derive(
23142315
Clone,
23152316
Copy,
@@ -2336,6 +2337,7 @@ pub enum PayoutType {
23362337
Wallet,
23372338
}
23382339

2340+
/// Type of entity to whom the payout is being carried out to, select from the given list of options
23392341
#[derive(
23402342
Clone,
23412343
Copy,
@@ -2369,6 +2371,7 @@ pub enum PayoutEntityType {
23692371
Personal,
23702372
}
23712373

2374+
/// The send method which will be required for processing payouts, check options for better understanding.
23722375
#[derive(
23732376
Clone,
23742377
Copy,

crates/common_utils/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ mod amount_conversion_tests {
690690
Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
691691
)]
692692
#[diesel(sql_type = Jsonb)]
693-
/// Charge object for refunds
693+
/// Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.
694694
pub struct ChargeRefunds {
695695
/// Identifier for charge created for the payment
696696
pub charge_id: String,

0 commit comments

Comments
 (0)