Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Add payments update-intent API for v2 #6490

Merged
merged 32 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2af8526
feat(core): Add payments update-intent API for v2
AnuthaDev Nov 6, 2024
d88cfa5
Fixed clippy
AnuthaDev Nov 6, 2024
199be74
Added amount_details fields
AnuthaDev Nov 7, 2024
59a9d80
Addressed review comments
AnuthaDev Nov 8, 2024
a11abfa
Address review comments
AnuthaDev Nov 13, 2024
6e916f3
Fixed clippy
AnuthaDev Nov 14, 2024
0b71f01
Merge branch 'main' into update-intent-v2
AnuthaDev Nov 15, 2024
e94ce87
Fixes
AnuthaDev Nov 15, 2024
1402b04
Merge branch 'main' into update-intent-v2
AnuthaDev Nov 27, 2024
724b2f2
Box only a single struct inside UpdateIntent
AnuthaDev Nov 28, 2024
3f0c1b7
Remove storage_enums alias and add as_bool impl
AnuthaDev Nov 28, 2024
49bf10d
Add AmountDetailsUpdate struct
AnuthaDev Nov 29, 2024
8d5c27f
Updated Comment
AnuthaDev Nov 29, 2024
6e0ff5d
Updated OpenAPI spec, cleanup
AnuthaDev Nov 29, 2024
1d4ca14
Fix clippy
AnuthaDev Nov 29, 2024
6a5b611
Merge branch 'main' into update-intent-v2
AnuthaDev Dec 2, 2024
d6a84f6
Fix clippy
AnuthaDev Dec 2, 2024
b87e1cc
Address review comments
AnuthaDev Dec 3, 2024
338f4b7
Merge branch 'main' into update-intent-v2
AnuthaDev Dec 3, 2024
2c4a705
Fix clippy
AnuthaDev Dec 3, 2024
9758969
Fix payment_link_config
AnuthaDev Dec 4, 2024
8303b58
Import instead of specifying super::
AnuthaDev Dec 4, 2024
e6dc33a
Remove #[serde(default)] from Options
AnuthaDev Dec 4, 2024
9508ce9
Update 'PresenceOfCustomerDuringPayment' description and change to sn…
AnuthaDev Dec 4, 2024
9857110
Remove redundant domain types
AnuthaDev Dec 4, 2024
89f0a4a
Fix mintlify docs
AnuthaDev Dec 4, 2024
2c04dca
Merge branch 'main' into update-intent-v2
AnuthaDev Dec 4, 2024
a122070
Handle tax_details
AnuthaDev Dec 4, 2024
914269b
Fix Clippy
AnuthaDev Dec 5, 2024
c118078
Remove enable_payment_link from update request
AnuthaDev Dec 5, 2024
cb0a55b
Merge branch 'main' into update-intent-v2
AnuthaDev Dec 6, 2024
c4377b9
chore: run formatter
hyperswitch-bot[bot] Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: put /v2/payments/{id}/update-intent
---
1 change: 1 addition & 0 deletions api-reference-v2/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"pages": [
"api-reference/payments/payments--create-intent",
"api-reference/payments/payments--get-intent",
"api-reference/payments/payments--update-intent",
"api-reference/payments/payments--session-token",
"api-reference/payments/payments--confirm-intent",
"api-reference/payments/payments--get"
Expand Down
318 changes: 315 additions & 3 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,79 @@
]
}
},
"/v2/payments/{id}/update-intent": {
"put": {
"tags": [
"Payments"
],
"summary": "Payments - Update Intent",
"description": "**Update a payment intent object**\n\nYou will require the 'API - Key' from the Hyperswitch dashboard to make the call.",
"operationId": "Update a Payment Intent",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The unique identifier for the Payment Intent",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Profile-Id",
"in": "header",
"description": "Profile ID associated to the payment intent",
"required": true,
"schema": {
"type": "string"
},
"example": {
"X-Profile-Id": "pro_abcdefghijklmnop"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentsUpdateIntentRequest"
},
"examples": {
"Update a payment intent with minimal fields": {
"value": {
"amount_details": {
"currency": "USD",
"order_amount": 6540
}
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Payment Intent Updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentsIntentResponse"
}
}
}
},
"404": {
"description": "Payment Intent Not Found"
}
},
"security": [
{
"api_key": []
}
]
}
},
"/v2/payments/{id}/confirm-intent": {
"post": {
"tags": [
Expand Down Expand Up @@ -3026,6 +3099,75 @@
}
}
},
"AmountDetailsUpdate": {
"type": "object",
"properties": {
"order_amount": {
"type": "integer",
"format": "int64",
"description": "The payment amount. Amount for the payment in the lowest denomination of the currency, (i.e) in cents for USD denomination, in yen for JPY denomination etc. E.g., Pass 100 to charge $1.00 and 1 for 1¥ since ¥ is a zero-decimal currency. Read more about [the Decimal and Non-Decimal Currencies](https://github.com/juspay/hyperswitch/wiki/Decimal-and-Non%E2%80%90Decimal-Currencies)",
"example": 6540,
"nullable": true,
"minimum": 0
},
"currency": {
"allOf": [
{
"$ref": "#/components/schemas/Currency"
}
],
"nullable": true
},
"shipping_cost": {
"allOf": [
{
"$ref": "#/components/schemas/MinorUnit"
}
],
"nullable": true
},
"order_tax_amount": {
"allOf": [
{
"$ref": "#/components/schemas/MinorUnit"
}
],
"nullable": true
},
"skip_external_tax_calculation": {
"allOf": [
{
"$ref": "#/components/schemas/TaxCalculationOverride"
}
],
"nullable": true
},
"skip_surcharge_calculation": {
"allOf": [
{
"$ref": "#/components/schemas/SurchargeCalculationOverride"
}
],
"nullable": true
},
"surcharge_amount": {
"allOf": [
{
"$ref": "#/components/schemas/MinorUnit"
}
],
"nullable": true
},
"tax_on_surcharge": {
"allOf": [
{
"$ref": "#/components/schemas/MinorUnit"
}
],
"nullable": true
}
}
},
"AmountFilter": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -15898,6 +16040,176 @@
}
}
},
"PaymentsUpdateIntentRequest": {
"type": "object",
"properties": {
"amount_details": {
"allOf": [
{
"$ref": "#/components/schemas/AmountDetailsUpdate"
}
],
"nullable": true
},
"routing_algorithm_id": {
"type": "string",
"description": "The routing algorithm id to be used for the payment",
"nullable": true
},
"capture_method": {
"allOf": [
{
"$ref": "#/components/schemas/CaptureMethod"
}
],
"nullable": true
},
"authentication_type": {
"allOf": [
{
"$ref": "#/components/schemas/AuthenticationType"
}
],
"default": "no_three_ds",
"nullable": true
},
"billing": {
"allOf": [
{
"$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
"shipping": {
"allOf": [
{
"$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
"customer_present": {
"allOf": [
{
"$ref": "#/components/schemas/PresenceOfCustomerDuringPayment"
}
],
"nullable": true
},
"description": {
"type": "string",
"description": "A description for the payment",
"example": "It's my first payment request",
"nullable": true
},
"return_url": {
"type": "string",
"description": "The URL to which you want the user to be redirected after the completion of the payment operation",
"example": "https://hyperswitch.io",
"nullable": true
},
"setup_future_usage": {
"allOf": [
{
"$ref": "#/components/schemas/FutureUsage"
}
],
"nullable": true
},
"apply_mit_exemption": {
"allOf": [
{
"$ref": "#/components/schemas/MitExemptionRequest"
}
],
"nullable": true
},
"statement_descriptor": {
"type": "string",
"description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
"example": "Hyperswitch Router",
"nullable": true,
"maxLength": 22
},
"order_details": {
"type": "array",
"items": {
"$ref": "#/components/schemas/OrderDetailsWithAmount"
},
"description": "Use this object to capture the details about the different products for which the payment is being made. The sum of amount across different products here should be equal to the overall payment amount",
"example": "[{\n \"product_name\": \"Apple iPhone 16\",\n \"quantity\": 1,\n \"amount\" : 69000\n \"product_img_link\" : \"https://dummy-img-link.com\"\n }]",
"nullable": true
},
"allowed_payment_method_types": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PaymentMethodType"
},
"description": "Use this parameter to restrict the Payment Method Types to show for a given PaymentIntent",
"nullable": true
},
"metadata": {
"type": "object",
"description": "Metadata is useful for storing additional, unstructured information on an object. This metadata will override the metadata that was passed in payments",
"nullable": true
},
"connector_metadata": {
"allOf": [
{
"$ref": "#/components/schemas/ConnectorMetadata"
}
],
"nullable": true
},
"feature_metadata": {
"allOf": [
{
"$ref": "#/components/schemas/FeatureMetadata"
}
],
"nullable": true
},
"payment_link_config": {
"allOf": [
{
"$ref": "#/components/schemas/PaymentLinkConfigRequest"
}
],
"nullable": true
},
"request_incremental_authorization": {
"allOf": [
{
"$ref": "#/components/schemas/RequestIncrementalAuthorization"
}
],
"nullable": true
},
"session_expiry": {
"type": "integer",
"format": "int32",
"description": "Will be used to expire client secret after certain amount of time to be supplied in seconds, if not sent it will be taken from profile config\n(900) for 15 mins",
"example": 900,
"nullable": true,
"minimum": 0
},
"frm_metadata": {
"type": "object",
"description": "Additional data related to some frm(Fraud Risk Management) connectors",
"nullable": true
},
"request_external_three_ds_authentication": {
"allOf": [
{
"$ref": "#/components/schemas/External3dsAuthenticationRequest"
}
],
"nullable": true
}
},
"additionalProperties": false
},
"PayoutActionRequest": {
"type": "object"
},
Expand Down Expand Up @@ -17189,10 +17501,10 @@
},
"PresenceOfCustomerDuringPayment": {
"type": "string",
"description": "Set to true to indicate that the customer is in your checkout flow during this payment, and therefore is able to authenticate. This parameter should be false when merchant's doing merchant initiated payments and customer is not present while doing the payment.",
"description": "Set to `present` to indicate that the customer is in your checkout flow during this payment, and therefore is able to authenticate. This parameter should be `absent` when merchant's doing merchant initiated payments and customer is not present while doing the payment.",
"enum": [
"Present",
"Absent"
"present",
"absent"
]
},
"PrimaryBusinessDetails": {
Expand Down
Loading
Loading