diff --git a/openapi.json b/openapi.json index d046cfa..b838c21 100755 --- a/openapi.json +++ b/openapi.json @@ -152,7 +152,7 @@ "post": { "operationId": "CreateCheckout", "summary": "Create a checkout", - "description": "Creates a new payment checkout resource. The unique `checkout_reference` created by this request, is used for further manipulation of the checkout.\n\nFor 3DS checkouts, add the `redirect_url` parameter to your request body schema.\n\nFollow by processing a checkout to charge the provided payment instrument.", + "description": "Creates a new payment checkout resource. The unique `checkout_reference` created by this request, is used for further manipulation of the checkout.\n\nFor 3DS checkouts, add the `redirect_url` parameter to your request body schema.\nTo use the [Hosted Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) page, set the `hosted_checkout.enabled` to `true`.\n\nFollow by processing a checkout to charge the provided payment instrument.", "requestBody": { "description": "Details for creating a checkout resource.", "required": true, @@ -196,6 +196,20 @@ "merchant_code": "MH4H92C7", "redirect_url": "https://mysite.com/completed_purchase" } + }, + "HostedCheckout": { + "description": "Create a checkout with a SumUp-hosted payment page", + "x-beta": true, + "value": { + "checkout_reference": "b50pr914-6k0e-3091-a592-890010285b3d", + "amount": 12, + "currency": "EUR", + "merchant_code": "MCXXXXXX", + "description": "A sample checkout", + "hosted_checkout": { + "enabled": true + } + } } } } @@ -316,6 +330,27 @@ } ] } + }, + "HostedCheckout": { + "description": "Response body for a checkout with a SumUp-hosted payment page", + "value": { + "checkout_reference": "b50pr914-6k0e-3091-a592-890010285b3d", + "amount": 12, + "currency": "EUR", + "merchant_code": "MCXXXXXX", + "merchant_country": "DE", + "merchant_name": "Sample Shop", + "description": "A sample checkout", + "id": "64553e20-3f0e-49e4-8af3-fd0eca86ce91", + "status": "PENDING", + "date": "2000-01-01T12:49:24.899+00:00", + "purpose": "CHECKOUT", + "hosted_checkout": { + "enabled": true + }, + "hosted_checkout_url": "https://checkout.sumup.com/pay/8f9316a3-cda9-42a9-9771-54d534315676", + "transactions": [] + } } } } @@ -6610,6 +6645,21 @@ }, "title": "ELV Card Account" }, + "HostedCheckout": { + "description": "Hosted Checkout configuration. Enable it to receive a SumUp-hosted payment page URL in the checkout response.", + "type": "object", + "properties": { + "enabled": { + "description": "Whether the checkout should include a SumUp-hosted payment page.", + "type": "boolean", + "example": true + } + }, + "required": [ + "enabled" + ], + "title": "Hosted Checkout" + }, "Checkout": { "description": "Core checkout resource returned by the Checkouts API. A checkout is created before payment processing and then updated as payment attempts, redirects, and resulting transactions are attached to it.", "type": "object", @@ -6683,6 +6733,13 @@ "mandate": { "$ref": "#/components/schemas/MandateResponse" }, + "hosted_checkout_url": { + "description": "URL of the SumUp-hosted payment page that handles the payment flow. Returned when Hosted Checkout is enabled for the checkout.", + "type": "string", + "format": "uri", + "example": "https://checkout.sumup.com/pay/8f9316a3-cda9-42a9-9771-54d534315676", + "readOnly": true + }, "transactions": { "description": "Payment attempts and resulting transaction records linked to this checkout. Use the Transactions endpoints when you need the authoritative payment result and event history.", "type": "array", @@ -6778,6 +6835,9 @@ "description": "URL where the payer should be sent after a redirect-based payment or SCA flow completes. This is required for [APMs](https://developer.sumup.com/online-payments/apm/introduction) and recommended for card checkouts that may require [3DS](https://developer.sumup.com/online-payments/features/3ds). If it is omitted, the [Payment Widget](https://developer.sumup.com/online-payments/checkouts) can render the challenge in an iframe instead of using a full-page redirect.", "type": "string", "example": "https://mysite.com/completed_purchase" + }, + "hosted_checkout": { + "$ref": "#/components/schemas/HostedCheckout" } }, "required": [ @@ -10449,6 +10509,20 @@ "merchant_code": "MH4H92C7", "redirect_url": "https://mysite.com/completed_purchase" } + }, + "HostedCheckout": { + "description": "Create a checkout with a SumUp-hosted payment page", + "x-beta": true, + "value": { + "checkout_reference": "b50pr914-6k0e-3091-a592-890010285b3d", + "amount": 12, + "currency": "EUR", + "merchant_code": "MCXXXXXX", + "description": "A sample checkout", + "hosted_checkout": { + "enabled": true + } + } } } } @@ -10709,6 +10783,27 @@ } ] } + }, + "HostedCheckout": { + "description": "Response body for a checkout with a SumUp-hosted payment page", + "value": { + "checkout_reference": "b50pr914-6k0e-3091-a592-890010285b3d", + "amount": 12, + "currency": "EUR", + "merchant_code": "MCXXXXXX", + "merchant_country": "DE", + "merchant_name": "Sample Shop", + "description": "A sample checkout", + "id": "64553e20-3f0e-49e4-8af3-fd0eca86ce91", + "status": "PENDING", + "date": "2000-01-01T12:49:24.899+00:00", + "purpose": "CHECKOUT", + "hosted_checkout": { + "enabled": true + }, + "hosted_checkout_url": "https://checkout.sumup.com/pay/8f9316a3-cda9-42a9-9771-54d534315676", + "transactions": [] + } } } } diff --git a/src/main/java/com/sumup/sdk/clients/CheckoutsAsyncClient.java b/src/main/java/com/sumup/sdk/clients/CheckoutsAsyncClient.java index 416d6e2..cf565fe 100644 --- a/src/main/java/com/sumup/sdk/clients/CheckoutsAsyncClient.java +++ b/src/main/java/com/sumup/sdk/clients/CheckoutsAsyncClient.java @@ -45,8 +45,10 @@ public CheckoutsAsyncClient(ApiClient apiClient) { * *

Creates a new payment checkout resource. The unique `checkout_reference` created by this * request, is used for further manipulation of the checkout. For 3DS checkouts, add the - * `redirect_url` parameter to your request body schema. Follow by processing a checkout to charge - * the provided payment instrument. + * `redirect_url` parameter to your request body schema. To use the [Hosted + * Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) page, set the + * `hosted_checkout.enabled` to `true`. Follow by processing a checkout to charge the provided + * payment instrument. * *

Operation ID: CreateCheckout * @@ -66,8 +68,10 @@ public CompletableFuture create( * *

Creates a new payment checkout resource. The unique `checkout_reference` created by this * request, is used for further manipulation of the checkout. For 3DS checkouts, add the - * `redirect_url` parameter to your request body schema. Follow by processing a checkout to charge - * the provided payment instrument. + * `redirect_url` parameter to your request body schema. To use the [Hosted + * Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) page, set the + * `hosted_checkout.enabled` to `true`. Follow by processing a checkout to charge the provided + * payment instrument. * *

Operation ID: CreateCheckout * diff --git a/src/main/java/com/sumup/sdk/clients/CheckoutsClient.java b/src/main/java/com/sumup/sdk/clients/CheckoutsClient.java index b1ea934..28b2dc2 100644 --- a/src/main/java/com/sumup/sdk/clients/CheckoutsClient.java +++ b/src/main/java/com/sumup/sdk/clients/CheckoutsClient.java @@ -44,8 +44,10 @@ public CheckoutsClient(ApiClient apiClient) { * *

Creates a new payment checkout resource. The unique `checkout_reference` created by this * request, is used for further manipulation of the checkout. For 3DS checkouts, add the - * `redirect_url` parameter to your request body schema. Follow by processing a checkout to charge - * the provided payment instrument. + * `redirect_url` parameter to your request body schema. To use the [Hosted + * Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) page, set the + * `hosted_checkout.enabled` to `true`. Follow by processing a checkout to charge the provided + * payment instrument. * *

Operation ID: CreateCheckout * @@ -65,8 +67,10 @@ public com.sumup.sdk.models.Checkout create(com.sumup.sdk.models.CheckoutCreateR * *

Creates a new payment checkout resource. The unique `checkout_reference` created by this * request, is used for further manipulation of the checkout. For 3DS checkouts, add the - * `redirect_url` parameter to your request body schema. Follow by processing a checkout to charge - * the provided payment instrument. + * `redirect_url` parameter to your request body schema. To use the [Hosted + * Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) page, set the + * `hosted_checkout.enabled` to `true`. Follow by processing a checkout to charge the provided + * payment instrument. * *

Operation ID: CreateCheckout * diff --git a/src/main/java/com/sumup/sdk/models/Checkout.java b/src/main/java/com/sumup/sdk/models/Checkout.java index 38807b5..5b7778d 100644 --- a/src/main/java/com/sumup/sdk/models/Checkout.java +++ b/src/main/java/com/sumup/sdk/models/Checkout.java @@ -41,6 +41,12 @@ public record Checkout( */ String description, + /** + * URL of the SumUp-hosted payment page that handles the payment flow. Returned when Hosted + * Checkout is enabled for the checkout. + */ + String hostedCheckoutUrl, + /** Unique SumUp identifier of the checkout resource. */ String id, @@ -261,6 +267,7 @@ public Checkout build() { date, description, null, + null, mandate, merchantCode, returnUrl, diff --git a/src/main/java/com/sumup/sdk/models/CheckoutCreateRequest.java b/src/main/java/com/sumup/sdk/models/CheckoutCreateRequest.java index bb2b269..e16e9c4 100644 --- a/src/main/java/com/sumup/sdk/models/CheckoutCreateRequest.java +++ b/src/main/java/com/sumup/sdk/models/CheckoutCreateRequest.java @@ -35,6 +35,12 @@ public record CheckoutCreateRequest( */ String description, + /** + * Hosted Checkout configuration. Enable it to receive a SumUp-hosted payment page URL in the + * checkout response. + */ + com.sumup.sdk.models.HostedCheckout hostedCheckout, + /** Merchant account that should receive the payment. */ String merchantCode, @@ -82,6 +88,7 @@ public static final class Builder { private com.sumup.sdk.models.Currency currency; private String customerId; private String description; + private com.sumup.sdk.models.HostedCheckout hostedCheckout; private String merchantCode; private com.sumup.sdk.models.CheckoutCreateRequestPurpose purpose; private String redirectUrl; @@ -149,6 +156,18 @@ public Builder description(String description) { return this; } + /** + * Sets the value for {@code hostedCheckout}. + * + * @param hostedCheckout Hosted Checkout configuration. Enable it to receive a SumUp-hosted + * payment page URL in the checkout response. + * @return This builder instance. + */ + public Builder hostedCheckout(com.sumup.sdk.models.HostedCheckout hostedCheckout) { + this.hostedCheckout = hostedCheckout; + return this; + } + /** * Sets the value for {@code merchantCode}. * @@ -227,6 +246,7 @@ public CheckoutCreateRequest build() { Objects.requireNonNull(currency, "currency"), customerId, description, + hostedCheckout, Objects.requireNonNull(merchantCode, "merchantCode"), purpose, redirectUrl, diff --git a/src/main/java/com/sumup/sdk/models/HostedCheckout.java b/src/main/java/com/sumup/sdk/models/HostedCheckout.java new file mode 100644 index 0000000..617b8af --- /dev/null +++ b/src/main/java/com/sumup/sdk/models/HostedCheckout.java @@ -0,0 +1,48 @@ +// Code generated by sumup-java/codegen. DO NOT EDIT. +package com.sumup.sdk.models; + +import java.util.Objects; + +/** + * Hosted Checkout configuration. Enable it to receive a SumUp-hosted payment page URL in the + * checkout response. + */ +public record HostedCheckout( + /** Whether the checkout should include a SumUp-hosted payment page. */ + Boolean enabled) { + /** + * Creates a builder for HostedCheckout. + * + * @return Builder that constructs immutable HostedCheckout instances. + */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for HostedCheckout instances. */ + public static final class Builder { + private Boolean enabled; + + private Builder() {} + + /** + * Sets the value for {@code enabled}. + * + * @param enabled Whether the checkout should include a SumUp-hosted payment page. + * @return This builder instance. + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Builds an immutable HostedCheckout instance. + * + * @return Immutable HostedCheckout. + */ + public HostedCheckout build() { + return new HostedCheckout(Objects.requireNonNull(enabled, "enabled")); + } + } +}