diff --git a/.gitignore b/.gitignore index 32d4c58..7846546 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ build # Ignore Docker env file docker.env + +.env diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index af98895..79c61cd 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -5,8 +5,9 @@ name = "paypal.subscriptions" version = "1.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] -keywords = [] -# icon = "icon.png" # TODO: update icon.png +keywords = ["PayPal", "Subscriptions", "Plans","Billing", "Payments", "Recurring", "Connector"] +icon = "icon.png" + repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml new file mode 100644 index 0000000..6fdf7f8 --- /dev/null +++ b/ballerina/Dependencies.toml @@ -0,0 +1,350 @@ +# AUTO-GENERATED FILE. DO NOT MODIFY. + +# This file is auto-generated by Ballerina for managing dependency versions. +# It should not be modified by hand. + +[ballerina] +dependencies-toml-version = "2" +distribution-version = "2201.12.0" + +[[package]] +org = "ballerina" +name = "auth" +version = "2.14.0" +dependencies = [ + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.array"}, + {org = "ballerina", name = "lang.string"}, + {org = "ballerina", name = "log"} +] + +[[package]] +org = "ballerina" +name = "cache" +version = "3.10.0" +dependencies = [ + {org = "ballerina", name = "constraint"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "task"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "constraint" +version = "1.7.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] +modules = [ + {org = "ballerina", packageName = "constraint", moduleName = "constraint"} +] + +[[package]] +org = "ballerina" +name = "crypto" +version = "2.9.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "data.jsondata" +version = "1.1.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.object"} +] +modules = [ + {org = "ballerina", packageName = "data.jsondata", moduleName = "data.jsondata"} +] + +[[package]] +org = "ballerina" +name = "file" +version = "1.12.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "os"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "http" +version = "2.14.2" +dependencies = [ + {org = "ballerina", name = "auth"}, + {org = "ballerina", name = "cache"}, + {org = "ballerina", name = "constraint"}, + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "data.jsondata"}, + {org = "ballerina", name = "file"}, + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "jwt"}, + {org = "ballerina", name = "lang.array"}, + {org = "ballerina", name = "lang.decimal"}, + {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "lang.regexp"}, + {org = "ballerina", name = "lang.runtime"}, + {org = "ballerina", name = "lang.string"}, + {org = "ballerina", name = "lang.value"}, + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "mime"}, + {org = "ballerina", name = "oauth2"}, + {org = "ballerina", name = "observe"}, + {org = "ballerina", name = "time"}, + {org = "ballerina", name = "url"} +] +modules = [ + {org = "ballerina", packageName = "http", moduleName = "http"}, + {org = "ballerina", packageName = "http", moduleName = "http.httpscerr"} +] + +[[package]] +org = "ballerina" +name = "io" +version = "1.8.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.value"} +] + +[[package]] +org = "ballerina" +name = "jballerina.java" +version = "0.0.0" + +[[package]] +org = "ballerina" +name = "jwt" +version = "2.15.0" +dependencies = [ + {org = "ballerina", name = "cache"}, + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "lang.string"}, + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "lang.__internal" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.object"} +] + +[[package]] +org = "ballerina" +name = "lang.array" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.__internal"} +] + +[[package]] +org = "ballerina" +name = "lang.decimal" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.error" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.int" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.__internal"}, + {org = "ballerina", name = "lang.object"} +] + +[[package]] +org = "ballerina" +name = "lang.object" +version = "0.0.0" + +[[package]] +org = "ballerina" +name = "lang.regexp" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.runtime" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "lang.string" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.regexp"} +] + +[[package]] +org = "ballerina" +name = "lang.value" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "log" +version = "2.12.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.value"}, + {org = "ballerina", name = "observe"} +] +modules = [ + {org = "ballerina", packageName = "log", moduleName = "log"} +] + +[[package]] +org = "ballerina" +name = "mime" +version = "2.12.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "log"} +] + +[[package]] +org = "ballerina" +name = "oauth2" +version = "2.14.0" +dependencies = [ + {org = "ballerina", name = "cache"}, + {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "time"}, + {org = "ballerina", name = "url"} +] + +[[package]] +org = "ballerina" +name = "observe" +version = "1.5.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "os" +version = "1.10.0" +dependencies = [ + {org = "ballerina", name = "io"}, + {org = "ballerina", name = "jballerina.java"} +] + +[[package]] +org = "ballerina" +name = "task" +version = "2.7.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "time"} +] + +[[package]] +org = "ballerina" +name = "test" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.array"}, + {org = "ballerina", name = "lang.error"} +] +modules = [ + {org = "ballerina", packageName = "test", moduleName = "test"} +] + +[[package]] +org = "ballerina" +name = "time" +version = "2.7.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] +modules = [ + {org = "ballerina", packageName = "time", moduleName = "time"} +] + +[[package]] +org = "ballerina" +name = "url" +version = "2.6.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] +modules = [ + {org = "ballerina", packageName = "url", moduleName = "url"} +] + +[[package]] +org = "ballerinai" +name = "observe" +version = "0.0.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "observe"} +] +modules = [ + {org = "ballerinai", packageName = "observe", moduleName = "observe"} +] + +[[package]] +org = "ballerinax" +name = "paypal.subscriptions" +version = "1.0.0" +dependencies = [ + {org = "ballerina", name = "constraint"}, + {org = "ballerina", name = "data.jsondata"}, + {org = "ballerina", name = "http"}, + {org = "ballerina", name = "log"}, + {org = "ballerina", name = "test"}, + {org = "ballerina", name = "time"}, + {org = "ballerina", name = "url"}, + {org = "ballerinai", name = "observe"} +] +modules = [ + {org = "ballerinax", packageName = "paypal.subscriptions", moduleName = "paypal.subscriptions"} +] + diff --git a/ballerina/client.bal b/ballerina/client.bal index c000777..e45abe8 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -1,3 +1,6 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + // Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). // // WSO2 LLC. licenses this file to you under the Apache License, @@ -13,3 +16,219 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + +import ballerina/data.jsondata; +import ballerina/http; + +# You can use billing plans and subscriptions to create subscriptions that process recurring PayPal payments for physical or digital goods, or services. A plan includes pricing and billing cycle information that defines the amount and frequency of charge for a subscription. You can also define a fixed plan, such as a $5 basic plan or a volume- or graduated-based plan with pricing tiers based on the quantity purchased. For more information, see Subscriptions Overview. +public isolated client class Client { + final http:Client clientEp; + # Gets invoked to initialize the `connector`. + # + # + config - The configurations to be used when initializing the `connector` + # + serviceUrl - URL of the target service + # + return - An error if connector initialization failed + public isolated function init(ConnectionConfig config, string serviceUrl = "https://api-m.sandbox.paypal.com/v1/billing") returns error? { + http:ClientConfiguration httpClientConfig = {auth: config.auth, httpVersion: config.httpVersion, http1Settings: config.http1Settings, http2Settings: config.http2Settings, timeout: config.timeout, forwarded: config.forwarded, followRedirects: config.followRedirects, poolConfig: config.poolConfig, cache: config.cache, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, cookieConfig: config.cookieConfig, responseLimits: config.responseLimits, secureSocket: config.secureSocket, proxy: config.proxy, socketConfig: config.socketConfig, validation: config.validation, laxDataBinding: config.laxDataBinding}; + self.clientEp = check new (serviceUrl, httpClientConfig); + } + + # List plans + # + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans + resource isolated function get plans(PlansListHeaders headers = {}, *PlansListQueries queries) returns PlanCollection|error { + string resourcePath = string `/plans`; + resourcePath = resourcePath + check getPathForQueryParam(queries); + map httpHeaders = http:getHeaderMap(headers); + return self.clientEp->get(resourcePath, httpHeaders); + } + + # Create plan + # + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details + resource isolated function post plans(PlanRequestPOST payload, PlansCreateHeaders headers = {}) returns Plan|error { + string resourcePath = string `/plans`; + map httpHeaders = http:getHeaderMap(headers); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); + } + + # Show plan details + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details + resource isolated function get plans/[string id](map headers = {}) returns Plan|error { + string resourcePath = string `/plans/${getEncodedUri(id)}`; + return self.clientEp->get(resourcePath, headers); + } + + # Update plan + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function patch plans/[string id](PatchRequest payload, map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->patch(resourcePath, request, headers); + } + + # Activate plan + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post plans/[string id]/activate(map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}/activate`; + http:Request request = new; + return self.clientEp->post(resourcePath, request, headers); + } + + # Deactivate plan + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post plans/[string id]/deactivate(map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}/deactivate`; + http:Request request = new; + return self.clientEp->post(resourcePath, request, headers); + } + + # Update pricing + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post plans/[string id]/update\-pricing\-schemes(UpdatePricingSchemesListRequest payload, map headers = {}) returns error? { + string resourcePath = string `/plans/${getEncodedUri(id)}/update-pricing-schemes`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Create subscription + # + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions(SubscriptionRequestPost payload, SubscriptionsCreateHeaders headers = {}) returns Subscription|error { + string resourcePath = string `/subscriptions`; + map httpHeaders = http:getHeaderMap(headers); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); + } + + # Show subscription details + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function get subscriptions/[string id](map headers = {}, *SubscriptionsGetQueries queries) returns Subscription|error { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; + resourcePath = resourcePath + check getPathForQueryParam(queries); + return self.clientEp->get(resourcePath, headers); + } + + # Update subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function patch subscriptions/[string id](PatchRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->patch(resourcePath, request, headers); + } + + # Revise plan or quantity of subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions/[string id]/revise(SubscriptionReviseRequest payload, map headers = {}) returns SubscriptionReviseResponse|error { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/revise`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Suspend subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/suspend(SubscriptionSuspendRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/suspend`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Cancel subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/cancel(SubscriptionCancelRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/cancel`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Activate subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource isolated function post subscriptions/[string id]/activate(SubscriptionActivateRequest payload, map headers = {}) returns error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/activate`; + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, headers); + } + + # Capture authorized payment on subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function post subscriptions/[string id]/capture(SubscriptionCaptureRequest payload, SubscriptionsCaptureHeaders headers = {}) returns Transaction|error? { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/capture`; + map httpHeaders = http:getHeaderMap(headers); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); + } + + # List transactions for subscription + # + # + id - The ID of the subscription + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details + resource isolated function get subscriptions/[string id]/transactions(map headers = {}, *SubscriptionsTransactionsQueries queries) returns TransactionsList|error { + string resourcePath = string `/subscriptions/${getEncodedUri(id)}/transactions`; + resourcePath = resourcePath + check getPathForQueryParam(queries); + return self.clientEp->get(resourcePath, headers); + } +} diff --git a/ballerina/icon.png b/ballerina/icon.png new file mode 100644 index 0000000..224668c Binary files /dev/null and b/ballerina/icon.png differ diff --git a/ballerina/tests/README.md b/ballerina/tests/README.md new file mode 100644 index 0000000..8befc62 --- /dev/null +++ b/ballerina/tests/README.md @@ -0,0 +1,120 @@ +# Running Tests + +## Prerequisites + +To run the tests for this PayPal Subscriptions Ballerina connector, you need: +- A PayPal developer account with sandbox credentials (Client ID and Client Secret). +- (Optional) An activated subscription ID for certain live tests. + +For more information on obtaining credentials, refer to the [PayPal Developer Documentation](https://developer.paypal.com/api/rest/). + +--- + +## Test Environments + +There are two test environments for running the PayPal Subscriptions connector tests: + +| Test Group | Environment | +| ------------ | --------------------------------------------------- | +| `mock_tests` | Mock server for PayPal Subscriptions API (Default) | +| `live_tests` | PayPal Sandbox API | +| `live_active_subscription_tests`| PayPal Sandbox API (requires active subscription ID) | + +You can run tests in either environment. Each group has its own compatible set of tests. + +--- + +## Running Tests in the Mock Server + +To execute tests on the mock server, ensure that the `isLiveServer` configuration is set to `false` or is unset. + +You can configure this variable in the `Config.toml` file in the `tests` directory or set it as an environment variable. + +### Using a `Config.toml` file + +Create a `Config.toml` file in the `tests` directory with the following content: + +```toml +isLiveServer = false +clientId = "DUMMY_CLIENT_ID" +clientSecret = "DUMMY_CLIENT_SECRET" +``` + +### Using Environment Variables + +### Linux or macOS + +```bash +export IS_LIVE_SERVER=false +export CLIENT_ID="DUMMY_CLIENT_ID" +export CLIENT_SECRET="DUMMY_CLIENT_SECRET" +``` + +#### Windows + +```bash +setx IS_LIVE_SERVER false +setx CLIENT_ID DUMMY_CLIENT_ID +setx CLIENT_SECRET DUMMY_CLIENT_SECRET +``` +--- + +## Running Tests Against PayPal Sandbox API + +### Using a `Config.toml` file + +Create a `Config.toml` file in the `tests` directory and add your PayPal sandbox credentials: + +```toml +isLiveServer = true +clientId = "" +clientSecret = "" +# Optional: For some tests, you may need an activated subscription ID +testActivatedSubscriptionId = "" +``` + +Then, run the following command to run the tests: + +```bash +./gradlew clean test +``` + +### Using Environment Variables + +#### Linux or macOS + +```bash +export IS_LIVE_SERVER=true +export CLIENT_ID="" +export CLIENT_SECRET="" +export TEST_ACTIVATED_SUBSCRIPTION_ID="" +``` + +#### Windows + +```bash +setx IS_LIVE_SERVER true +setx CLIENT_ID +setx CLIENT_SECRET +setx TEST_ACTIVATED_SUBSCRIPTION_ID +``` + +Then, run the following command to run the tests: + +```bash +./gradlew clean test +``` + +## Running Specific Groups or Test Cases + +To run only certain test groups or individual test cases, pass the -Pgroups property: + +```bash +./gradlew clean test -Pgroups= +``` + +For example, to run only the mock tests: + +```bash +./gradlew clean test -Pgroups=mock_tests +``` \ No newline at end of file diff --git a/ballerina/tests/mock_service.bal b/ballerina/tests/mock_service.bal new file mode 100644 index 0000000..0469e77 --- /dev/null +++ b/ballerina/tests/mock_service.bal @@ -0,0 +1,288 @@ +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/http; +import ballerina/log; + +configurable boolean isLiveServer = ?; + +listener http:Listener httpListener = new (9090); + +http:Service mockService = service object { + + # # Mock service for testing billing plans API + + # List plans + # + # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that lists billing plans + resource function get plans() returns PlanCollection|error { + return { + plans: [ + { + name: "Basic Plan", + id: "P-1234567890", + status: "ACTIVE", + "product_id": "PROD-1234567890", + "billing_cycles": [ + { + sequence: 1, + tenure_type: "REGULAR", + total_cycles: 0, + frequency: {interval_unit: "MONTH", interval_count: 1}, + pricing_scheme: {fixed_price: {currency_code: "USD", value: "10.00"}} + } + ], + "payment_preferences": { + auto_bill_outstanding: true, + setup_fee: {currency_code: "USD", value: "0.00"}, + setup_fee_failure_action: "CANCEL", + payment_failure_threshold: 3 + }, + "create_time": "2025-06-16T10:53:00Z", + links: [{href: "/v1/billing/plans/P-1234567890", rel: "self", method: "GET"}] + } + ], + "total_items": 1, + "total_pages": 1, + links: [{href: "/v1/billing/plans?page=1", rel: "self", method: "GET"}] + }; + } + + # Create plan + + # + payload - The plan request payload + # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details + resource function post plans(@http:Payload PlanRequestPOST payload) returns Plan|error { + return { + name: payload.name, + id: "P-20250618", + status: payload.status, + product_id: payload.product_id, + "billing_cycles": [ + { + sequence: 1, + tenure_type: "REGULAR", + total_cycles: 0, + frequency: {interval_unit: "MONTH", interval_count: 1}, + pricing_scheme: {fixed_price: {currency_code: "USD", value: "10.00"}} + } + ], + "payment_preferences": { + auto_bill_outstanding: true, + setup_fee: {currency_code: "USD", value: "0.00"}, + setup_fee_failure_action: "CANCEL", + payment_failure_threshold: 3 + }, + "create_time": "2025-06-16T10:53:00Z", + links: [{href: "/v1/billing/plans/P-1234567890", rel: "self", method: "GET"}] + }; + } + + # Get plan by ID + # + # + planId - The ID of the plan to retrieve + # + return - A successful request returns the HTTP 200 OK status code with a JSON response body that shows billing plan details + resource function get plans/[string planId]() returns Plan|error { + return { + name: "Basic Plan", + id: planId, // Return the same plan ID that was requested + status: "ACTIVE", + "product_id": "PROD-1234567890", + "billing_cycles": [ + { + sequence: 1, + tenure_type: "REGULAR", + total_cycles: 0, + frequency: {interval_unit: "MONTH", interval_count: 1}, + pricing_scheme: {fixed_price: {currency_code: "USD", value: "10.00"}} + } + ], + "payment_preferences": { + auto_bill_outstanding: true, + setup_fee: {currency_code: "USD", value: "0.00"}, + setup_fee_failure_action: "CANCEL", + payment_failure_threshold: 3 + }, + "create_time": "2025-06-16T10:53:00Z", + links: [{href: string `/v1/billing/plans/${planId}`, rel: "self", method: "GET"}] + }; + } + + # Update plan by ID + # + planId - The ID of the plan to update + # + payload - The plan request payload + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function patch plans/[string planId](@http:Payload PatchRequest payload) returns http:Ok|error? { + log:printInfo("Mock service received patch request for plan ID: " + planId); + log:printInfo("Patch payload: " + payload.toString()); + return {}; + } + + # Deactivate plan + # + # + id - The ID of the subscription + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function post plans/[string id]/deactivate() returns http:Ok|error { + log:printInfo("Mock service received deactivate request for plan ID: " + id); + return {}; + } + + # Activate plan + # + # + id - The ID of the subscription + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function post plans/[string id]/activate() returns http:Ok|error { + log:printInfo("Mock service received activate request for plan ID: " + id); + return {}; + } + + # Update pricing + # + # + id - The ID of the subscription + # + payload - The request payload containing the pricing schemes to update + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function post plans/[string id]/update\-pricing\-schemes(@http:Payload UpdatePricingSchemesListRequest payload) returns http:Ok|error { + log:printInfo("Mock service received update pricing request for plan ID: " + id); + log:printInfo("Update pricing payload: " + payload.toString()); + return {}; + } + + # # Mock service for testing billing Subscriptions API + # + + # create a new subscription + # + payload - The subscription request payload + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function post subscriptions(@http:Payload SubscriptionRequestPost payload) returns Subscription|error { + return + { + id: "I-1234567890", + status: "APPROVAL_PENDING", + plan_id: payload.plan_id, + start_time: payload.start_time, + shipping_amount: payload.shipping_amount, + create_time: "2025-06-16T10:53:00Z", + update_time: "2025-06-16T10:53:00Z", + links: [ + { + href: "/v1/billing/subscriptions/I-1234567890", + rel: "self", + method: "GET" + } + ] + } + ; + } + + # get subscription by ID + # + # + id - The ID of the subscription to retrieve + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function get subscriptions/[string id]() returns Subscription|error { + return { + id: id, + status: "ACTIVE", + plan_id: "P-1234567890", + start_time: "2025-06-16T10:53:00Z", + shipping_amount: {currency_code: "USD", value: "0.00"}, + create_time: "2025-06-16T10:53:00Z", + update_time: "2025-06-16T10:53:00Z", + links: [ + { + href: string `/v1/billing/subscriptions/${id}`, + rel: "self", + method: "GET" + } + ] + }; + + }; + + # update subscription + # + # + id - The ID of the subscription to update + # + payload - The request payload containing the subscription details to update + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body + resource function patch subscriptions/[string id](@http:Payload PatchRequest payload) returns http:Ok|error? { + log:printInfo("Mock service received update request for subscription ID: " + id); + log:printInfo("Update payload: " + payload.toString()); + return {}; + } + + # Revise plan or quantity of subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details. + resource function post subscriptions/[string id]/revise(@http:Payload SubscriptionReviseRequest payload) returns SubscriptionReviseResponse|error { + log:printInfo("Mock service received revise request for subscription ID: " + id); + log:printInfo("Revise payload: " + payload.toString()); + return { + plan_id: payload.plan_id, + shipping_amount: payload.shipping_amount, + links: [ + { + href: string `/v1/billing/subscriptions/${id}`, + rel: "self", + method: "GET" + } + ] + }; + } + + # Suspend subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/suspend(@http:Payload SubscriptionSuspendRequest payload) returns http:Ok|error { + log:printInfo("Mock service received suspend request for subscription ID: " + id); + log:printInfo("Reason for suspension: " + payload.reason.toString()); + return {}; + } + + # Activate subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/activate(@http:Payload SubscriptionActivateRequest payload) returns http:Ok|error { + log:printInfo("Mock service received activate request for subscription ID: " + id); + log:printInfo("Reason for activation: " + payload.reason.toString()); + return {}; + } + + # Cancel subscription + # + # + id - The ID of the subscription. + # + payload - Headers to be sent with the request + # + return - A successful request returns the HTTP `204 No Content` status code with no JSON response body. + resource function post subscriptions/[string id]/cancel(@http:Payload SubscriptionCancelRequest payload) returns http:Ok|error { + log:printInfo("Mock service received cancel request for subscription ID: " + id); + log:printInfo("Reason for cancellation: " + payload.reason.toString()); + return {}; + } +}; + +function init() returns error? { + if isLiveServer { + log:printInfo("Skipping mock server initialization as the tests are running on live server"); + return; + } + log:printInfo("Initiating mock server"); + check httpListener.attach(mockService, "/v1/billing"); + check httpListener.'start(); +} diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal new file mode 100644 index 0000000..e102bc6 --- /dev/null +++ b/ballerina/tests/tests.bal @@ -0,0 +1,345 @@ +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/http; +import ballerina/test; +import ballerina/time; + +configurable string serviceUrl = isLiveServer ? "https://api-m.sandbox.paypal.com/v1/billing" : "http://localhost:9090/v1/billing"; +configurable string clientId = ?; +configurable string clientSecret = ?; +configurable string testActivatedSubscriptionId = ?; + +string testProductId = ""; +string testPlanId = ""; +string testSubscriptionId = ""; +string testActivatedSubscriptionPlanId = ""; + +ConnectionConfig config = { + auth: { + clientId, + clientSecret + } +}; + +final Client paypal = check new Client(config, serviceUrl); + +@test:BeforeSuite +function createProduct() returns error? { + if !isLiveServer { + testProductId = "PRD-TEMP"; + return; + } + time:Utc currentTime = time:utcNow(); + int timestamp = currentTime[0]; + http:Client productClient = check new ("https://api-m.sandbox.paypal.com/v1/catalogs", config = { + auth: { + tokenUrl: "https://api-m.sandbox.paypal.com/v1/oauth2/token", + clientId, + clientSecret + } + }); + + http:Response response = check productClient->/products.post({ + id: timestamp.toString(), + name: "T-Shirt", + 'type: "PHYSICAL", + description: "Cotton XL", + category: "CLOTHING", + image_url: string `https://example.com/gallery/images/${timestamp}.jpg`, + home_url: string `https://example.com/catalog/${timestamp}.jpg` + }); + + json responseJson = check response.getJsonPayload(); + string productId = check responseJson.id; + testProductId = productId; +} + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testListPlans() returns error? { + PlanCollection response = check paypal->/plans(); + test:assertTrue(response?.plans !is ()); +} + +@test:Config { + groups: ["live_tests", "mock_tests"] +} +function testCreatePlan() returns error? { + PlanRequestPOST payload = { + product_id: testProductId, + name: "Fresh Clean Tees Plan", + status: "ACTIVE", + billing_cycles: [ + { + frequency: { + interval_unit: "MONTH", + interval_count: 1 + }, + tenure_type: "TRIAL", + sequence: 1, + total_cycles: 1, + pricing_scheme: { + fixed_price: { + value: "1", + currency_code: "USD" + } + } + }, + { + frequency: { + interval_unit: "MONTH", + interval_count: 1 + }, + tenure_type: "REGULAR", + sequence: 2, + total_cycles: 12, + pricing_scheme: { + fixed_price: { + value: "44", + currency_code: "USD" + } + } + } + ], + payment_preferences: { + auto_bill_outstanding: true, + setup_fee_failure_action: "CONTINUE", + payment_failure_threshold: 3 + } + }; + Plan createdPlan = check paypal->/plans.post(payload); + test:assertTrue(createdPlan.id is string, "Created plan should have an ID"); + testPlanId = check createdPlan.id.ensureType(string); +} + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testGetPlan() returns error? { + Plan plan = check paypal->/plans/[testPlanId].get(); + test:assertEquals(plan.id, testPlanId, "Retrieved plan ID should match the requested ID"); +} + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testUpdatePlan() returns error? { + PatchRequest payload = [ + { + op: "replace", + path: "/name", + value: "Updated Fresh Clean Tees Plan" + } + ]; + check paypal->/plans/[testPlanId].patch(payload); +} + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan] +} +function testDeactivatePlan() returns error? { + check paypal->/plans/[testPlanId]/deactivate.post(); +} + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan, testDeactivatePlan] +} +function testActivatePlan() returns error? { + check paypal->/plans/[testPlanId]/activate.post(); +} + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testCreatePlan, testGetPlan] +} +function testUpdatePricingSchemes() returns error? { + UpdatePricingSchemesListRequest payload = { + pricing_schemes: [ + { + billing_cycle_sequence: 1, + pricing_scheme: { + fixed_price: { + value: "120", + currency_code: "USD" + } + } + }, + { + billing_cycle_sequence: 2, + pricing_scheme: { + fixed_price: { + value: "555", + currency_code: "USD" + } + } + } + ] + }; + check paypal->/plans/[testPlanId]/update\-pricing\-schemes.post(payload); +} + +@test:Config { + groups: ["live_tests", "mock_tests"], + dependsOn: [testActivatePlan] +} +function testCreateSubscription() returns error? { + string twoMinutesFromNow = time:utcToString(time:utcAddSeconds(time:utcNow(), 120)); + SubscriptionRequestPost payload = { + plan_id: testPlanId, + start_time: twoMinutesFromNow, + shipping_amount: { + currency_code: "USD", + value: "10.00" + }, + subscriber: { + name: { + given_name: "FooBuyer", + surname: "Jones" + }, + email_address: "foobuyer@example.com", + shipping_address: { + name: { + full_name: "John Doe" + }, + address: { + address_line_1: "2211 N First Street", + address_line_2: "Building 17", + admin_area_2: "San Jose", + admin_area_1: "CA", + postal_code: "95131", + country_code: "US" + } + } + }, + application_context: { + brand_name: "Example Inc", + locale: "en-US", + shipping_preference: "SET_PROVIDED_ADDRESS", + user_action: "SUBSCRIBE_NOW", + payment_method: { + payer_selected: "PAYPAL", + payee_preferred: "IMMEDIATE_PAYMENT_REQUIRED" + }, + return_url: "https://example.com/return", + cancel_url: "https://example.com/cancel" + } + }; + Subscription response = check paypal->/subscriptions.post(payload); + test:assertTrue(response.id is string, "Created subscription should have an ID"); + testSubscriptionId = check response.id.ensureType(string); +} + +@test:Config { + groups: ["live_tests", "mock_tests"] +} +function testGetSubscription() returns error? { + SubscriptionsGetQueries queries = { + fields: "id,plan_id,status" + }; + Subscription response = check paypal->/subscriptions/[testSubscriptionId].get(queries = queries); + test:assertEquals(response.id, testSubscriptionId, "Retrieved subscription ID should match the requested ID"); + testActivatedSubscriptionPlanId = check response.plan_id.ensureType(string); +} + +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + after: testGetSubscription +} +function testUpdateSubscription() returns error? { + PatchRequest payload = [ + { + op: "replace", + path: "/subscriber/shipping_address", + value: { + name: { + full_name: "Roy Nesarajah Viththagan" + }, + address: { + address_line_1: "2211 N First Street", + address_line_2: "Building 17", + admin_area_2: "San Jose", + admin_area_1: "CA", + postal_code: "95131", + country_code: "US" + } + } + } + ]; + check paypal->/subscriptions/[testActivatedSubscriptionId].patch(payload); + testSubscriptionId = testActivatedSubscriptionId; +} + +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testUpdateSubscription], + after: testGetSubscription +} +function testReviseSubscription() returns error? { + SubscriptionReviseRequest payload = { + plan_id: testActivatedSubscriptionPlanId, + shipping_amount: { + currency_code: "USD", + value: "2222.00" + } + }; + + SubscriptionReviseResponse response = check paypal->/subscriptions/[testActivatedSubscriptionId]/revise.post(payload); + test:assertTrue(response.plan_id is string, "Revised subscription should have a plan ID"); + testSubscriptionId = testActivatedSubscriptionId; +} + +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testReviseSubscription], + after: testGetSubscription +} +function testSuspendSubscription() returns error? { + SubscriptionSuspendRequest payload = { + reason: "Item out of stock" + }; + check paypal->/subscriptions/[testActivatedSubscriptionId]/suspend.post(payload); +} + +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testSuspendSubscription], + after: testGetSubscription +} +function testActivateSubscription() returns error? { + SubscriptionActivateRequest payload = { + reason: "Items are back in stock" + }; + check paypal->/subscriptions/[testActivatedSubscriptionId]/activate.post(payload); +} + +@test:Config { + groups: ["mock_tests", "live_active_subscription_tests"], + dependsOn: [testActivateSubscription], + after: testGetSubscription +} +function testCancelSubscription() returns error? { + SubscriptionCancelRequest payload = { + reason: "Customer requested cancellation" + }; + check paypal->/subscriptions/[testActivatedSubscriptionId]/cancel.post(payload); +} diff --git a/ballerina/types.bal b/ballerina/types.bal new file mode 100644 index 0000000..ab9700b --- /dev/null +++ b/ballerina/types.bal @@ -0,0 +1,947 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/constraint; +import ballerina/http; + +# OAuth2 Client Credentials Grant Configs +public type OAuth2ClientCredentialsGrantConfig record {| + *http:OAuth2ClientCredentialsGrantConfig; + # Token URL + string tokenUrl = "https://api-m.sandbox.paypal.com/v1/oauth2/token"; +|}; + +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254} +public type Email string; + +# The account identifier for a PayPal account +@constraint:String {maxLength: 13, minLength: 13, pattern: re `^[2-9A-HJ-NP-Z]{13}$`} +public type AccountId string; + +# The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent +public type SubscriptionReviseResponse record { + *SubscriptionReviseRequest; + *SubscriptionReviseResponseAllOf2; +}; + +# The update pricing scheme request details +public type UpdatePricingSchemeRequest record { + # The billing cycle sequence + @constraint:Int {minValue: 1, maxValue: 99} + int billing_cycle_sequence; + PricingScheme pricing_scheme; +}; + +# The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions +public type PaymentSource record { + # The payment card to use to fund a payment. Can be a credit or debit card + Card card?; +}; + +# The card network or brand. Applies to credit, debit, gift, and payment cards +public type CardBrand "VISA"|"MASTERCARD"|"DISCOVER"|"AMEX"|"SOLO"|"JCB"|"STAR"|"DELTA"|"SWITCH"|"MAESTRO"|"CB_NATIONALE"|"CONFIGOGA"|"CONFIDIS"|"ELECTRON"|"CETELEM"|"CHINA_UNION_PAY"; + +# The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+@constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} +public type DateTime string; + +public type TransactionAllOf2 record { + # The PayPal-generated transaction ID. + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts + AmountWithBreakdown amount_with_breakdown?; + # The name of the party + Name payer_name?; + # The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+ EmailAddress payer_email?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime time?; +}; + +# The name of the party +public type Name record { + # When the party is a person, the party's full name + @constraint:String {maxLength: 300} + string full_name?; + # The prefix, or title, to the party's name + @constraint:String {maxLength: 140} + string prefix?; + # When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname + @constraint:String {maxLength: 140} + string surname?; + # When the party is a person, the party's given, or first, name + @constraint:String {maxLength: 140} + string given_name?; + # When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name + @constraint:String {maxLength: 140} + string middle_name?; + # The suffix for the party's name + @constraint:String {maxLength: 140} + string suffix?; + # DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business + @constraint:String {maxLength: 300} + string alternate_full_name?; +}; + +# The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency +@constraint:String {maxLength: 3, minLength: 3} +public type CurrencyCode string; + +# The payment preferences for a subscription +public type PaymentPreferences record { + Money setup_fee?; + # The action to take on the subscription if the initial payment for the setup fails + "CONTINUE"|"CANCEL" setup_fee_failure_action = "CANCEL"; + # Indicates whether to automatically bill the outstanding amount in the next billing cycle + boolean auto_bill_outstanding = true; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail + @constraint:Int {minValue: 0, maxValue: 999} + int payment_failure_threshold = 0; +}; + +# Status of Authentication eligibility +public type Enrolled "Y"|"N"|"U"|"B"; + +# The list transactions for a subscription request details +public type TransactionsList record { + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The total number of pages + @constraint:Int {minValue: 0, maxValue: 100000000} + int total_pages?; + # An array of transactions + @constraint:Array {maxLength: 32767} + Transaction[] transactions?; + # The total number of items + @constraint:Int {minValue: 0, maxValue: 500000000} + int total_items?; +}; + +# The application context, which customizes the payer experience during the subscription approval process with PayPal +public type ApplicationContext record { + # Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience + "CONTINUE"|"SUBSCRIBE_NOW" user_action = "SUBSCRIBE_NOW"; + # The URL where the customer is redirected after the customer approves the payment + @constraint:String {maxLength: 4000, minLength: 10} + string return_url; + # The label that overrides the business name in the PayPal account on the PayPal site + @constraint:String {maxLength: 127, minLength: 1} + string brand_name?; + # The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) + Language locale?; + # The URL where the customer is redirected after the customer cancels the payment + @constraint:String {maxLength: 4000, minLength: 10} + string cancel_url; + # The location from which the shipping address is derived + "GET_FROM_FILE"|"NO_SHIPPING"|"SET_PROVIDED_ADDRESS" shipping_preference = "GET_FROM_FILE"; + PaymentMethod payment_method?; +}; + +# The phone information +public type PhoneWithType record { + PhoneType phone_type?; + Phone phone_number; +}; + +# The details of the captured payment status +public type CaptureStatusDetails record { + # The reason why the captured payment status is `PENDING` or `DENIED` + "BUYER_COMPLAINT"|"CHARGEBACK"|"ECHECK"|"INTERNATIONAL_WITHDRAWAL"|"OTHER"|"PENDING_REVIEW"|"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"|"REFUNDED"|"TRANSACTION_APPROVED_AWAITING_FUNDING"|"UNILATERAL"|"VERIFICATION_REQUIRED" reason?; +}; + +# The subscriber response information +public type Subscriber record { + *Payer; + *SubscriberAllOf2; +}; + +# The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required +public type TaxInfo record { + # The customer's tax ID type + "BR_CPF"|"BR_CNPJ" tax_id_type; + # The customer's tax ID value + @constraint:String {maxLength: 14} + string tax_id; +}; + +# The pricing scheme details +public type PricingScheme record { + # An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified + @constraint:Array {maxLength: 32, minLength: 1} + PricingTier[] tiers?; + DateTime update_time?; + DateTime create_time?; + # The pricing model for tiered plan. The `tiers` parameter is required + "VOLUME"|"TIERED" pricing_model?; + Money fixed_price?; + # The version of the pricing scheme + @constraint:Int {minValue: 0, maxValue: 999} + int version?; +}; + +# The payment source used to fund the payment +public type PaymentSourceResponse record { + # The payment card used to fund the payment. Card can be a credit or debit card + CardResponseWithBillingAddress card?; +}; + +# An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object +public type PlanOverride record { + PaymentPreferencesOverride payment_preferences?; + # An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition + @constraint:Array {maxLength: 12, minLength: 1} + BillingCycleOverride[] billing_cycles?; + # The tax details + TaxesOverride taxes?; +}; + +# The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) +@constraint:String {maxLength: 7, minLength: 7, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])$`} +public type DateYearMonth string; + +# The create subscription request details +public type SubscriptionRequestPost record { + Money shipping_amount?; + DateTime start_time?; + # The quantity of the product in the subscription + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + # The subscriber request information + SubscriberRequest subscriber?; + # The custom id for the subscription. Can be invoice id + @constraint:String {maxLength: 127, minLength: 1} + string custom_id?; + ApplicationContext application_context?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object + PlanOverride plan?; + # The ID of the plan + @constraint:String {maxLength: 50, minLength: 3} + string plan_id; + # DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete + # + # # Deprecated + @deprecated + boolean auto_renewal = false; +}; + +# Represents the Headers record for the operation: plans.create +public type PlansCreateHeaders record { + # The server stores keys for 72 hours + string PayPal\-Request\-Id?; + # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
+ string Prefer = "return=minimal"; +}; + +public type SubscriberAllOf2 record { + # The shipping details + ShippingDetail shipping_address?; + # The payment source used to fund the payment + PaymentSourceResponse payment_source?; +}; + +# The subscription details +public type Subscription record { + *SubscriptionStatus; + *SubscriptionAllOf2; +}; + +# The cancel subscription request details +public type SubscriptionCancelRequest record { + # The reason for the cancellation of a subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason; +}; + +# Represents the Queries record for the operation: subscriptions.get +public type SubscriptionsGetQueries record { + # List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan + @constraint:String {maxLength: 100, minLength: 1} + string fields?; +}; + +# Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint. +@display {label: "Connection Config"} +public type ConnectionConfig record {| + # Configurations related to client authentication + OAuth2ClientCredentialsGrantConfig auth; + # The HTTP version understood by the client + http:HttpVersion httpVersion = http:HTTP_2_0; + # Configurations related to HTTP/1.x protocol + http:ClientHttp1Settings http1Settings = {}; + # Configurations related to HTTP/2 protocol + http:ClientHttp2Settings http2Settings = {}; + # The maximum time to wait (in seconds) for a response before closing the connection + decimal timeout = 30; + # The choice of setting `forwarded`/`x-forwarded` header + string forwarded = "disable"; + # Configurations associated with Redirection + http:FollowRedirects followRedirects?; + # Configurations associated with request pooling + http:PoolConfiguration poolConfig?; + # HTTP caching related configurations + http:CacheConfig cache = {}; + # Specifies the way of handling compression (`accept-encoding`) header + http:Compression compression = http:COMPRESSION_AUTO; + # Configurations associated with the behaviour of the Circuit Breaker + http:CircuitBreakerConfig circuitBreaker?; + # Configurations associated with retrying + http:RetryConfig retryConfig?; + # Configurations associated with cookies + http:CookieConfig cookieConfig?; + # Configurations associated with inbound response size limits + http:ResponseLimitConfigs responseLimits = {}; + # SSL/TLS-related options + http:ClientSecureSocket secureSocket?; + # Proxy server related options + http:ProxyConfig proxy?; + # Provides settings related to client socket configuration + http:ClientSocketConfig socketConfig = {}; + # Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default + boolean validation = true; + # Enables relaxed data binding on the client side. When enabled, `nil` values are treated as optional, + # and absent fields are handled as `nilable` types. Enabled by default. + boolean laxDataBinding = true; +|}; + +public type SubscriptionReviseResponseAllOf2 record { + # Indicates whether the subscription has overridden any plan attributes. + boolean plan_overridden?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). + LinkDescription[] links?; +}; + +# The customer who approves and pays for the order. The customer is also known as the payer +public type Payer record { + *PayerBase; + *PayerAllOf2; +}; + +public type SubscriptionAllOf2 record { + # The PayPal-generated ID for the subscription. + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The ID of the plan. + @constraint:String {maxLength: 50, minLength: 3} + string plan_id?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime start_time?; + # The quantity of the product in the subscription. + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + # The currency and amount for a financial transaction, such as a balance or payment due + Money shipping_amount?; + # The subscriber response information + Subscriber subscriber?; + # The billing details for the subscription. If the subscription was or is active, these fields are populated + SubscriptionBillingInfo billing_info?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime create_time?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime update_time?; + # The custom id for the subscription. Can be invoice id. + @constraint:String {maxLength: 127, minLength: 1} + string custom_id?; + # Indicates whether the subscription has overridden any plan attributes. + boolean plan_overridden?; + # The plan details + Plan plan?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). + LinkDescription[] links?; +}; + +# The billing cycle details +public type BillingCycle record { + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan + "REGULAR"|"TRIAL" tenure_type; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles = 1; + PricingScheme pricing_scheme?; + # The frequency of the billing cycle + Frequency frequency; +}; + +# Results of 3D Secure Authentication +public type ThreeDSecureAuthenticationResponse record { + ParesStatus authentication_status?; + Enrolled enrollment_status?; +}; + +# The suspend subscription request details +public type SubscriptionSuspendRequest record { + # The reason for suspenson of the subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason; +}; + +# An array of JSON patch objects to apply partial updates to resources +public type PatchRequest Patch[]; + +# The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) +public type AddressPortable record { + CountryCode country_code; + # The highest level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision. Format for postal delivery. For example, `CA` and not `California`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
+ @constraint:String {maxLength: 300} + string admin_area_1?; + # The first line of the address. For example, number or street. For example, `173 Drury Lane`. Required for data entry and compliance and risk checks. Must contain the full address + @constraint:String {maxLength: 300} + string address_line_1?; + # A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
+ @constraint:String {maxLength: 100} + string admin_area_3?; + AddressDetails address_details?; + # A city, town, or village. Smaller than `admin_area_level_1` + @constraint:String {maxLength: 120} + string admin_area_2?; + # The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address + @constraint:String {maxLength: 100} + string address_line_3?; + # The second line of the address. For example, suite or apartment number + @constraint:String {maxLength: 300} + string address_line_2?; + # The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
+ @constraint:String {maxLength: 100} + string admin_area_4?; + # The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code) + @constraint:String {maxLength: 60} + string postal_code?; +}; + +# The payment preferences to override at subscription level +public type PaymentPreferencesOverride record { + Money setup_fee?; + # The action to take on the subscription if the initial payment for the setup fails + "CONTINUE"|"CANCEL" setup_fee_failure_action?; + # Indicates whether to automatically bill the outstanding amount in the next billing cycle + boolean auto_bill_outstanding?; + # The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail + @constraint:Int {minValue: 0, maxValue: 999} + int payment_failure_threshold?; +}; + +# The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
+@constraint:String {maxLength: 254, minLength: 3, pattern: re `^.+@[^"\-].+$`} +public type EmailAddress string; + +# The payment card to use to fund a payment. Can be a credit or debit card +public type Card record { + # The primary account number (PAN) for the payment card + @constraint:String {maxLength: 19, minLength: 13} + string number; + # The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT` + @constraint:String {pattern: re `[0-9]{3,4}`} + string security_code?; + # The card holder's name as it appears on the card + @constraint:String {maxLength: 300} + string name?; + AddressPortable billing_address?; + # The PayPal-generated ID for the card + string id?; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) + DateYearMonth expiry; + CardBrand card_type?; + # The last digits of the payment card + @constraint:String {pattern: re `[0-9]{2,}`} + string last_digits?; +}; + +# Represents the Headers record for the operation: subscriptions.create +public type SubscriptionsCreateHeaders record { + # The server stores keys for 72 hours + string PayPal\-Request\-Id?; + # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
+ string Prefer = "return=minimal"; +}; + +# The tax details +public type Taxes record { + # Indicates whether the tax was already included in the billing amount + boolean inclusive = true; + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` + Percentage percentage; +}; + +# The update pricing scheme request details +public type UpdatePricingSchemesListRequest record { + # An array of pricing schemes + @constraint:Array {maxLength: 99, minLength: 1} + UpdatePricingSchemeRequest[] pricing_schemes; +}; + +# The phone type +public type PhoneType "FAX"|"HOME"|"MOBILE"|"OTHER"|"PAGER"; + +# The transaction details +public type Transaction record { + *CaptureStatus; + *TransactionAllOf2; + DateTime time; + AmountWithBreakdown amount_with_breakdown; + string id; +}; + +# The payment card to use to fund a payment. Card can be a credit or debit card +public type CardResponse record { + AuthenticationResponse authentication_result?; + # The payment card type + "CREDIT"|"DEBIT"|"PREPAID"|"UNKNOWN" 'type?; + # The last digits of the payment card + @constraint:String {pattern: re `[0-9]{2,}`} + string last_digits?; + # The card network or brand. Applies to credit, debit, gift, and payment cards + CardBrand brand?; +}; + +# The create plan request details +public type PlanRequestPOST record { + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service + boolean quantity_supported = false; + PaymentPreferences payment_preferences; + # The ID of the product created through Catalog Products API + @constraint:String {maxLength: 50, minLength: 6} + string product_id; + # The plan name + @constraint:String {maxLength: 127, minLength: 1} + string name; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle + @constraint:Array {maxLength: 12, minLength: 1} + BillingCycle[] billing_cycles; + # The detailed description of the plan + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # The tax details + Taxes taxes?; + # The initial state of the plan. Allowed input values are CREATED and ACTIVE + "CREATED"|"INACTIVE"|"ACTIVE" status = "ACTIVE"; +}; + +# The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years +@constraint:String {maxLength: 10, minLength: 10, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$`} +public type DateNoTime string; + +# The customer and merchant payment preferences +public type PaymentMethod record { + # The customer-selected payment method on the merchant site + @constraint:String {minLength: 1, pattern: re `^[0-9A-Z_]+$`} + string payer_selected = "PAYPAL"; + PayeePaymentMethodPreference payee_preferred?; + # NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes + "TEL"|"WEB"|"CCD"|"PPD" standard_entry_class_code = "WEB"; +}; + +# The subscriber request information +public type SubscriberRequest record { + *Payer; + *SubscriberRequestAllOf2; +}; + +# The status of a captured payment +public type CaptureStatus record { + CaptureStatusDetails status_details?; + # The status of the captured payment + "COMPLETED"|"DECLINED"|"PARTIALLY_REFUNDED"|"PENDING"|"REFUNDED" status?; +}; + +# The JSON patch object to apply partial updates to resources +public type Patch record { + # The operation + "add"|"remove"|"replace"|"move"|"copy"|"test" op; + # The JSON Pointer to the target document location at which to complete the operation + string path?; + # The JSON Pointer to the target document location from which to move the value. Required for the move operation + string 'from?; + # The value to apply. The remove operation does not require a value + anydata value?; +}; + +# The details for the failed payment of the subscription +public type FailedPaymentDetails record { + # The reason code for the payment failure + "PAYMENT_DENIED"|"INTERNAL_SERVER_ERROR"|"PAYEE_ACCOUNT_RESTRICTED"|"PAYER_ACCOUNT_RESTRICTED"|"PAYER_CANNOT_PAY"|"SENDING_LIMIT_EXCEEDED"|"TRANSACTION_RECEIVING_LIMIT_EXCEEDED"|"CURRENCY_MISMATCH" reason_code?; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + DateTime next_payment_retry_time?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime time; +}; + +# The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information +public type LinkDescription record { + # The HTTP method required to make the related call + "GET"|"POST"|"PUT"|"DELETE"|"HEAD"|"CONNECT"|"OPTIONS"|"PATCH" method?; + # The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml) + string rel; + # The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call + string href; +}; + +# The shipping details +public type ShippingDetail record { + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable address?; + # The name of the party + Name name?; + # The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present + "SHIPPING"|"PICKUP_IN_PERSON" 'type?; +}; + +# Represents the Queries record for the operation: subscriptions.transactions +public type SubscriptionsTransactionsQueries record { + # The start time of the range of transactions to list + @constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} + string start_time; + # The end time of the range of transactions to list + @constraint:String {maxLength: 64, minLength: 20, pattern: re `^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$`} + string end_time; +}; + +# The tax details +public type TaxesOverride record { + # Indicates whether the tax was already included in the billing amount + boolean inclusive?; + # The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` + Percentage percentage?; +}; + +# Liability shift indicator. The outcome of the issuer's authentication +public type LiabilityShift "YES"|"NO"|"POSSIBLE"|"UNKNOWN"; + +# The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts +public type AmountWithBreakdown record { + Money shipping_amount?; + Money tax_amount?; + Money fee_amount?; + Money total_item_amount?; + Money gross_amount; + Money net_amount?; +}; + +# The currency and amount for a financial transaction, such as a balance or payment due +public type Money record { + # The value, which might be:
  • An integer for currencies like `JPY` that are not typically fractional.
  • A decimal fraction for currencies like `TND` that are subdivided into thousandths.
For the required number of decimal places for a currency code, see [Currency Codes](/docs/integration/direct/rest/currency-codes/) + @constraint:String {maxLength: 32, pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} + string value; + CurrencyCode currency_code; +}; + +# The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/) +@constraint:String {maxLength: 10, minLength: 2, pattern: re `^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$`} +public type Language string; + +# The details for the last payment +public type LastPaymentDetails LastPaymentDetailsAllOf1; + +# The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en) +public type Phone record { + # The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) + @constraint:String {maxLength: 3, minLength: 1, pattern: re `^[0-9]{1,3}?$`} + string country_code; + # The extension number + @constraint:String {maxLength: 15, minLength: 1, pattern: re `^[0-9]{1,15}?$`} + string extension_number?; + # The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN) + @constraint:String {maxLength: 14, minLength: 1, pattern: re `^[0-9]{1,14}?$`} + string national_number; +}; + +# The activate subscription request details +public type SubscriptionActivateRequest record { + # The reason for activation of a subscription. Required to reactivate the subscription + @constraint:String {maxLength: 128, minLength: 1} + string reason?; +}; + +# Represents the Headers record for the operation: subscriptions.capture +public type SubscriptionsCaptureHeaders record { + # The server stores keys for 72 hours + string PayPal\-Request\-Id?; +}; + +# The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
+@constraint:String {maxLength: 2, minLength: 2, pattern: re `^([A-Z]{2}|C2)$`} +public type CountryCode string; + +# The pricing tier details +public type PricingTier record { + # The starting quantity for the tier + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string starting_quantity; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + # The ending quantity for the tier. Optional for the last tier + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string ending_quantity?; +}; + +# The customer who approves and pays for the order. The customer is also known as the payer +public type PayerBase record { + Email email_address?; + AccountId payer_id?; +}; + +public type SubscriberRequestAllOf2 record { + # The shipping details + ShippingDetail shipping_address?; + # The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions + PaymentSource payment_source?; +}; + +# The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99` +@constraint:String {pattern: re `^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$`} +public type Percentage string; + +# The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type` +public type AddressDetails record { + # A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House + @constraint:String {maxLength: 100} + string building_name?; + # The street number + @constraint:String {maxLength: 100} + string street_number?; + # The street type. For example, avenue, boulevard, road, or expressway + @constraint:String {maxLength: 100} + string street_type?; + # The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment + @constraint:String {maxLength: 100} + string sub_building?; + # The delivery service. Post office box, bag number, or post office name + @constraint:String {maxLength: 100} + string delivery_service?; + # The street name. Just `Drury` in `Drury Lane` + @constraint:String {maxLength: 100} + string street_name?; +}; + +# Represents the Queries record for the operation: plans.list +public type PlansListQueries record { + # Filters the response by a Product ID + @constraint:String {maxLength: 50, minLength: 6} + string product_id?; + # Filters the response by list of plan IDs. Filter supports upto 10 plan IDs + string plan_ids?; + # A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items + @constraint:Int {minValue: 1, maxValue: 100000} + int page = 1; + # Indicates whether to show the total count in the response + boolean total_required = false; + # The number of items to return in the response + @constraint:Int {minValue: 1, maxValue: 20} + int page_size = 10; +}; + +# Represents the Headers record for the operation: plans.list +public type PlansListHeaders record { + # The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
+ string Prefer = "return=minimal"; +}; + +# The plan details +public type Plan record { + # Indicates whether you can subscribe to this plan by providing a quantity for the goods or service + boolean quantity_supported = false; + DateTime update_time?; + DateTime create_time?; + PaymentPreferences payment_preferences?; + # The ID for the product + @constraint:String {maxLength: 50, minLength: 6} + string product_id?; + # The plan name + @constraint:String {maxLength: 127, minLength: 1} + string name?; + # An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle + @constraint:Array {maxLength: 12, minLength: 1} + BillingCycle[] billing_cycles?; + # The detailed description of the plan + @constraint:String {maxLength: 127, minLength: 1} + string description?; + # The tax details + Taxes taxes?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The unique PayPal-generated ID for the plan + @constraint:String {maxLength: 50, minLength: 3} + string id?; + # The plan status + "CREATED"|"INACTIVE"|"ACTIVE" status?; +}; + +# The charge amount from the subscriber +public type SubscriptionCaptureRequest record { + # The reason or note for the subscription charge + @constraint:String {maxLength: 128, minLength: 1} + string note; + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount; + # The type of capture + "OUTSTANDING_BALANCE" capture_type; +}; + +# Results of Authentication such as 3D Secure +public type AuthenticationResponse record { + LiabilityShift liability_shift?; + ThreeDSecureAuthenticationResponse three_d_secure?; +}; + +public type CardResponseWithBillingAddressAllOf2 record { + # The card holder's name as it appears on the card. + @constraint:String {maxLength: 300, minLength: 2} + string name?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable billing_address?; + # The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6) + DateYearMonth expiry?; + # The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency + CurrencyCode currency_code?; +}; + +public type LastPaymentDetailsAllOf1 record { + # The currency and amount for a financial transaction, such as a balance or payment due + Money amount?; + # The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
+ DateTime time?; +}; + +# The subscription status details +public type SubscriptionStatus record { + # The reason or notes for the status of the subscription + @constraint:String {maxLength: 128, minLength: 1} + string status_change_note?; + # The status of the subscription + "APPROVAL_PENDING"|"APPROVED"|"ACTIVE"|"SUSPENDED"|"CANCELLED"|"EXPIRED" status?; + DateTime status_update_time?; +}; + +# The billing details for the subscription. If the subscription was or is active, these fields are populated +public type SubscriptionBillingInfo record { + DateTime final_payment_time?; + # The trial and regular billing executions + @constraint:Array {maxLength: 3} + CycleExecution[] cycle_executions?; + # The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state + @constraint:Int {minValue: 0, maxValue: 999} + int failed_payments_count; + DateTime next_billing_time?; + FailedPaymentDetails last_failed_payment?; + Money outstanding_balance; + LastPaymentDetails last_payment?; +}; + +# The list of plans with details +public type PlanCollection record { + # An array of plans + @constraint:Array {maxLength: 32767} + Plan[] plans?; + # An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links) + @constraint:Array {maxLength: 10, minLength: 1} + LinkDescription[] links?; + # The total number of pages + @constraint:Int {minValue: 0, maxValue: 100000000} + int total_pages?; + # The total number of items + @constraint:Int {minValue: 0, maxValue: 500000000} + int total_items?; +}; + +# The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent +public type SubscriptionReviseRequest record { + Money shipping_amount?; + # The quantity of the product or service in the subscription + @constraint:String {maxLength: 32, minLength: 1, pattern: re `^([0-9]+|([0-9]+)?[.][0-9]+)$`} + string quantity?; + ApplicationContext application_context?; + ShippingDetail shipping_address?; + # An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object + PlanOverride plan?; + # The unique PayPal-generated ID for the plan + @constraint:String {maxLength: 50, minLength: 3} + string plan_id?; +}; + +# The frequency of the billing cycle +public type Frequency record { + # The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
+ @constraint:Int {minValue: 1, maxValue: 365} + int interval_count = 1; + # The interval at which the subscription is charged or billed + "DAY"|"WEEK"|"MONTH"|"YEAR" interval_unit; +}; + +# The merchant-preferred payment methods +public type PayeePaymentMethodPreference "UNRESTRICTED"|"IMMEDIATE_PAYMENT_REQUIRED"; + +# Transactions status result identifier. The outcome of the issuer's authentication +public type ParesStatus "Y"|"N"|"U"|"A"|"C"|"R"|"D"|"I"; + +# The payment card used to fund the payment. Card can be a credit or debit card +public type CardResponseWithBillingAddress record { + *CardResponse; + *CardResponseWithBillingAddressAllOf2; +}; + +public type PayerAllOf2 record { + # The name of the party + Name name?; + # The phone information + PhoneWithType phone?; + # The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years + DateNoTime birth_date?; + # The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required + TaxInfo tax_info?; + # The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute) + AddressPortable address?; +}; + +# The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition +public type BillingCycleOverride record { + # The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle + @constraint:Int {minValue: 1, maxValue: 99} + int sequence; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles?; + PricingScheme pricing_scheme?; +}; + +# The regular and trial execution details for a billing cycle +public type CycleExecution record { + # The order in which to run this cycle among other billing cycles + @constraint:Int {minValue: 0, maxValue: 99} + int sequence; + # For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0 + @constraint:Int {minValue: 0, maxValue: 9999} + int cycles_remaining?; + # The type of the billing cycle + "REGULAR"|"TRIAL" tenure_type; + # The number of billing cycles that have completed + @constraint:Int {minValue: 0, maxValue: 9999} + int cycles_completed; + # The active pricing scheme version for the billing cycle + @constraint:Int {minValue: 1, maxValue: 99} + int current_pricing_scheme_version?; + # The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles) + @constraint:Int {minValue: 0, maxValue: 999} + int total_cycles?; +}; diff --git a/ballerina/utils.bal b/ballerina/utils.bal new file mode 100644 index 0000000..8269f00 --- /dev/null +++ b/ballerina/utils.bal @@ -0,0 +1,219 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/http; +import ballerina/url; + +type SimpleBasicType string|boolean|int|float|decimal; + +# Represents encoding mechanism details. +type Encoding record { + # Defines how multiple values are delimited + string style = FORM; + # Specifies whether arrays and objects should generate as separate fields + boolean explode = true; + # Specifies the custom content type + string contentType?; + # Specifies the custom headers + map headers?; +}; + +enum EncodingStyle { + DEEPOBJECT, FORM, SPACEDELIMITED, PIPEDELIMITED +} + +final Encoding & readonly defaultEncoding = {}; + +# Serialize the record according to the deepObject style. +# +# + parent - Parent record name +# + anyRecord - Record to be serialized +# + return - Serialized record as a string +isolated function getDeepObjectStyleRequest(string parent, record {} anyRecord) returns string { + string[] recordArray = []; + foreach [string, anydata] [key, value] in anyRecord.entries() { + if value is SimpleBasicType { + recordArray.push(parent + "[" + key + "]" + "=" + getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + recordArray.push(getSerializedArray(parent + "[" + key + "]" + "[]", value, DEEPOBJECT, true)); + } else if value is record {} { + string nextParent = parent + "[" + key + "]"; + recordArray.push(getDeepObjectStyleRequest(nextParent, value)); + } else if value is record {}[] { + string nextParent = parent + "[" + key + "]"; + recordArray.push(getSerializedRecordArray(nextParent, value, DEEPOBJECT)); + } + recordArray.push("&"); + } + _ = recordArray.pop(); + return string:'join("", ...recordArray); +} + +# Serialize the record according to the form style. +# +# + parent - Parent record name +# + anyRecord - Record to be serialized +# + explode - Specifies whether arrays and objects should generate separate parameters +# + return - Serialized record as a string +isolated function getFormStyleRequest(string parent, record {} anyRecord, boolean explode = true) returns string { + string[] recordArray = []; + if explode { + foreach [string, anydata] [key, value] in anyRecord.entries() { + if value is SimpleBasicType { + recordArray.push(key, "=", getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + recordArray.push(getSerializedArray(key, value, explode = explode)); + } else if value is record {} { + recordArray.push(getFormStyleRequest(parent, value, explode)); + } + recordArray.push("&"); + } + _ = recordArray.pop(); + } else { + foreach [string, anydata] [key, value] in anyRecord.entries() { + if value is SimpleBasicType { + recordArray.push(key, ",", getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + recordArray.push(getSerializedArray(key, value, explode = false)); + } else if value is record {} { + recordArray.push(getFormStyleRequest(parent, value, explode)); + } + recordArray.push(","); + } + _ = recordArray.pop(); + } + return string:'join("", ...recordArray); +} + +# Serialize arrays. +# +# + arrayName - Name of the field with arrays +# + anyArray - Array to be serialized +# + style - Defines how multiple values are delimited +# + explode - Specifies whether arrays and objects should generate separate parameters +# + return - Serialized array as a string +isolated function getSerializedArray(string arrayName, anydata[] anyArray, string style = "form", boolean explode = true) returns string { + string key = arrayName; + string[] arrayValues = []; + if anyArray.length() > 0 { + if style == FORM && !explode { + arrayValues.push(key, "="); + foreach anydata i in anyArray { + arrayValues.push(getEncodedUri(i.toString()), ","); + } + } else if style == SPACEDELIMITED && !explode { + arrayValues.push(key, "="); + foreach anydata i in anyArray { + arrayValues.push(getEncodedUri(i.toString()), "%20"); + } + } else if style == PIPEDELIMITED && !explode { + arrayValues.push(key, "="); + foreach anydata i in anyArray { + arrayValues.push(getEncodedUri(i.toString()), "|"); + } + } else if style == DEEPOBJECT { + foreach anydata i in anyArray { + arrayValues.push(key, "[]", "=", getEncodedUri(i.toString()), "&"); + } + } else { + foreach anydata i in anyArray { + arrayValues.push(key, "=", getEncodedUri(i.toString()), "&"); + } + } + _ = arrayValues.pop(); + } + return string:'join("", ...arrayValues); +} + +# Serialize the array of records according to the form style. +# +# + parent - Parent record name +# + value - Array of records to be serialized +# + style - Defines how multiple values are delimited +# + explode - Specifies whether arrays and objects should generate separate parameters +# + return - Serialized record as a string +isolated function getSerializedRecordArray(string parent, record {}[] value, string style = FORM, boolean explode = true) returns string { + string[] serializedArray = []; + if style == DEEPOBJECT { + int arayIndex = 0; + foreach var recordItem in value { + serializedArray.push(getDeepObjectStyleRequest(parent + "[" + arayIndex.toString() + "]", recordItem), "&"); + arayIndex = arayIndex + 1; + } + } else { + if !explode { + serializedArray.push(parent, "="); + } + foreach var recordItem in value { + serializedArray.push(getFormStyleRequest(parent, recordItem, explode), ","); + } + } + _ = serializedArray.pop(); + return string:'join("", ...serializedArray); +} + +# Get Encoded URI for a given value. +# +# + value - Value to be encoded +# + return - Encoded string +isolated function getEncodedUri(anydata value) returns string { + string|error encoded = url:encode(value.toString(), "UTF8"); + if encoded is string { + return encoded; + } else { + return value.toString(); + } +} + +# Generate query path with query parameter. +# +# + queryParam - Query parameter map +# + encodingMap - Details on serialization mechanism +# + return - Returns generated Path or error at failure of client initialization +isolated function getPathForQueryParam(map queryParam, map encodingMap = {}) returns string|error { + map queriesMap = http:getQueryMap(queryParam); + string[] param = []; + if queriesMap.length() > 0 { + param.push("?"); + foreach var [key, value] in queriesMap.entries() { + if value is () { + _ = queriesMap.remove(key); + continue; + } + Encoding encodingData = encodingMap.hasKey(key) ? encodingMap.get(key) : defaultEncoding; + if value is SimpleBasicType { + param.push(key, "=", getEncodedUri(value.toString())); + } else if value is SimpleBasicType[] { + param.push(getSerializedArray(key, value, encodingData.style, encodingData.explode)); + } else if value is record {} { + if encodingData.style == DEEPOBJECT { + param.push(getDeepObjectStyleRequest(key, value)); + } else { + param.push(getFormStyleRequest(key, value, encodingData.explode)); + } + } else { + param.push(key, "=", value.toString()); + } + param.push("&"); + } + _ = param.pop(); + } + string restOfPath = string:'join("", ...param); + return restOfPath; +} diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index 4d8e3e2..701bc5c 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -5,8 +5,9 @@ name = "paypal.subscriptions" version = "@toml.version@" license = ["Apache-2.0"] authors = ["Ballerina"] -keywords = [] # TODO: Add keywords -# icon = "icon.png" # TODO: Add icon +keywords = ["PayPal", "Subscriptions", "Plans","Billing", "Payments", "Recurring", "Connector"] +icon = "icon.png" + repository = "https://github.com/ballerina-platform/module-ballerinax-paypal.subscriptions" [build-options] diff --git a/docs/spec/openapi.json b/docs/spec/openapi.json new file mode 100644 index 0000000..4c62f10 --- /dev/null +++ b/docs/spec/openapi.json @@ -0,0 +1,7186 @@ +{ + "openapi" : "3.0.3", + "info" : { + "title" : "Subscriptions", + "description" : "You can use billing plans and subscriptions to create subscriptions that process recurring PayPal payments for physical or digital goods, or services. A plan includes pricing and billing cycle information that defines the amount and frequency of charge for a subscription. You can also define a fixed plan, such as a $5 basic plan or a volume- or graduated-based plan with pricing tiers based on the quantity purchased. For more information, see Subscriptions Overview.", + "contact" : { }, + "version" : "1.6" + }, + "externalDocs" : { + "url" : "https://developer.paypal.com/docs/api/subscriptions/v1/" + }, + "servers" : [ { + "url" : "https://api-m.sandbox.paypal.com/v1/billing", + "description" : "PayPal Sandbox Environment" + }, { + "url" : "https://api-m.paypal.com/v1/billing", + "description" : "PayPal Live Environment" + } ], + "tags" : [ { + "name" : "plans", + "description" : "Use the `/billing/plans` resource to create and manage plans." + }, { + "name" : "subscriptions", + "description" : "Use the `/billing/subscriptions` resource to create and manage subscriptions." + } ], + "paths" : { + "/plans" : { + "get" : { + "tags" : [ "plans" ], + "summary" : "List plans", + "description" : "Lists billing plans.", + "operationId" : "plans.list", + "parameters" : [ { + "$ref" : "#/components/parameters/prefer" + }, { + "$ref" : "#/components/parameters/product_id" + }, { + "$ref" : "#/components/parameters/plan_ids" + }, { + "$ref" : "#/components/parameters/page_size" + }, { + "$ref" : "#/components/parameters/page" + }, { + "$ref" : "#/components/parameters/total_required" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that lists billing plans", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PlanCollection" + } + } + } + }, + "400" : { + "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse400" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + }, + "post" : { + "tags" : [ "plans" ], + "summary" : "Create plan", + "description" : "Creates a plan that defines pricing and billing cycle details for subscriptions.", + "operationId" : "plans.create", + "parameters" : [ { + "$ref" : "#/components/parameters/prefer" + }, { + "$ref" : "#/components/parameters/paypal_request_id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PlanRequestPOST" + }, + "examples" : { + "plan_request_post" : { + "value" : { + "product_id" : "PROD-XXCD1234QWER65782", + "name" : "Video Streaming Service Plan", + "description" : "Video Streaming Service basic plan", + "status" : "ACTIVE", + "billing_cycles" : [ { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 1, + "total_cycles" : 2, + "pricing_scheme" : { + "fixed_price" : { + "value" : "3", + "currency_code" : "USD" + } + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 2, + "total_cycles" : 3, + "pricing_scheme" : { + "fixed_price" : { + "value" : "6", + "currency_code" : "USD" + } + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "REGULAR", + "sequence" : 3, + "total_cycles" : 12, + "pricing_scheme" : { + "fixed_price" : { + "value" : "10", + "currency_code" : "USD" + } + } + } ], + "payment_preferences" : { + "auto_bill_outstanding" : true, + "setup_fee" : { + "value" : "10", + "currency_code" : "USD" + }, + "setup_fee_failure_action" : "CONTINUE", + "payment_failure_threshold" : 3 + }, + "taxes" : { + "percentage" : "10", + "inclusive" : false + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows billing plan details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Plan" + }, + "examples" : { + "plan" : { + "value" : { + "id" : "P-5ML4271244454362WXNWU5NQ", + "product_id" : "PROD-XXCD1234QWER65782", + "name" : "Video Streaming Service Plan", + "description" : "Video Streaming Service basic plan", + "status" : "ACTIVE", + "billing_cycles" : [ { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 1, + "total_cycles" : 2, + "pricing_scheme" : { + "fixed_price" : { + "value" : "3", + "currency_code" : "USD" + }, + "version" : 1, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z" + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "TRIAL", + "sequence" : 2, + "total_cycles" : 3, + "pricing_scheme" : { + "fixed_price" : { + "currency_code" : "USD", + "value" : "6" + }, + "version" : 1, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z" + } + }, { + "frequency" : { + "interval_unit" : "MONTH", + "interval_count" : 1 + }, + "tenure_type" : "REGULAR", + "sequence" : 3, + "total_cycles" : 12, + "pricing_scheme" : { + "fixed_price" : { + "currency_code" : "USD", + "value" : "10" + }, + "version" : 1, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z" + } + } ], + "payment_preferences" : { + "auto_bill_outstanding" : true, + "setup_fee" : { + "value" : "10", + "currency_code" : "USD" + }, + "setup_fee_failure_action" : "CONTINUE", + "payment_failure_threshold" : 3 + }, + "taxes" : { + "percentage" : "10", + "inclusive" : false + }, + "create_time" : "2020-05-27T12:13:51Z", + "update_time" : "2020-05-27T12:13:51Z", + "links" : [ { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ", + "rel" : "self", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/deactivate", + "rel" : "deactivate", + "method" : "POST" + }, { + "href" : "https://api-m.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/update-pricing-schemes", + "rel" : "edit", + "method" : "POST" + } ] + } + } + } + } + } + }, + "201" : { + "description" : "A successful request returns the HTTP `201 Created` status code and a JSON response body that shows billing plan details.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Plan" + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4001" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse422" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}" : { + "get" : { + "tags" : [ "plans" ], + "summary" : "Show plan details", + "description" : "Shows details for a plan, by ID.", + "operationId" : "plans.get", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows plan details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Plan" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + }, + "patch" : { + "tags" : [ "plans" ], + "summary" : "Update plan", + "description" : "Updates a plan with the `CREATED` or `ACTIVE` status. For an `INACTIVE` plan, you can make only status updates.
You can patch these attributes and objects:
Attribute or objectOperations
descriptionreplace
payment_preferences.auto_bill_outstandingreplace
taxes.percentagereplace
payment_preferences.payment_failure_thresholdreplace
payment_preferences.setup_feereplace
payment_preferences.setup_fee_failure_actionreplace
namereplace
", + "operationId" : "plans.patch", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "$ref" : "#/components/requestBodies/patch_request" + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4002" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4221" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}/activate" : { + "post" : { + "tags" : [ "plans" ], + "summary" : "Activate plan", + "description" : "Activates a plan, by ID.", + "operationId" : "plans.activate", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4222" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}/deactivate" : { + "post" : { + "tags" : [ "plans" ], + "summary" : "Deactivate plan", + "description" : "Deactivates a plan, by ID.", + "operationId" : "plans.deactivate", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4223" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/plans/{id}/update-pricing-schemes" : { + "post" : { + "tags" : [ "plans" ], + "summary" : "Update pricing", + "description" : "Updates pricing for a plan. For example, you can update a regular billing cycle from $5 per month to $7 per month.", + "operationId" : "plans.update-pricing-schemes", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UpdatePricingSchemesListRequest" + }, + "examples" : { + "update_pricing_schemes_list_request" : { + "value" : { + "pricing_schemes" : [ { + "billing_cycle_sequence" : 1, + "pricing_scheme" : { + "fixed_price" : { + "value" : "50", + "currency_code" : "USD" + } + } + }, { + "billing_cycle_sequence" : 2, + "pricing_scheme" : { + "fixed_price" : { + "value" : "100", + "currency_code" : "USD" + }, + "pricing_model" : "VOLUME", + "tiers" : [ { + "starting_quantity" : "1", + "ending_quantity" : "1000", + "amount" : { + "value" : "150", + "currency_code" : "USD" + } + }, { + "starting_quantity" : "1001", + "amount" : { + "value" : "250", + "currency_code" : "USD" + } + } ] + } + } ] + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4003" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4224" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Create subscription", + "description" : "Creates a subscription.", + "operationId" : "subscriptions.create", + "parameters" : [ { + "$ref" : "#/components/parameters/prefer" + }, { + "$ref" : "#/components/parameters/paypal_request_id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionRequestPost" + }, + "examples" : { + "subscription_request_post" : { + "value" : { + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "start_time" : "2018-11-01T00:00:00Z", + "quantity" : "20", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "subscriber" : { + "name" : { + "given_name" : "John", + "surname" : "Doe" + }, + "email_address" : "customer@example.com", + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + } + }, + "application_context" : { + "brand_name" : "walmart", + "locale" : "en-US", + "shipping_preference" : "SET_PROVIDED_ADDRESS", + "user_action" : "SUBSCRIBE_NOW", + "payment_method" : { + "payer_selected" : "PAYPAL", + "payee_preferred" : "IMMEDIATE_PAYMENT_REQUIRED" + }, + "return_url" : "https://example.com/returnUrl", + "cancel_url" : "https://example.com/cancelUrl" + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Subscription" + }, + "examples" : { + "subscription" : { + "value" : { + "id" : "I-BW452GLLEP1G", + "status" : "APPROVAL_PENDING", + "status_update_time" : "2018-12-10T21:20:49Z", + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "plan_overridden" : false, + "start_time" : "2018-11-01T00:00:00Z", + "quantity" : "20", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "subscriber" : { + "name" : { + "given_name" : "John", + "surname" : "Doe" + }, + "email_address" : "customer@example.com", + "payer_id" : "2J6QB8YJQSJRJ", + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + } + }, + "create_time" : "2018-12-10T21:20:49Z", + "links" : [ { + "href" : "https://www.paypal.com/webapps/billing/subscriptions?ba_token=BA-2M539689T3856352J", + "rel" : "approve", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "self", + "method" : "GET" + } ] + } + } + } + } + } + }, + "201" : { + "description" : "A successful request returns the HTTP `201 Created` status code and a JSON response body that shows subscription details.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Subscription" + }, + "examples" : { + "subscription" : { + "value" : { + "id" : "I-BW452GLLEP1G", + "status" : "APPROVAL_PENDING", + "status_update_time" : "2018-12-10T21:20:49Z", + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "plan_overridden" : false, + "start_time" : "2018-11-01T00:00:00Z", + "quantity" : "20", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "subscriber" : { + "name" : { + "given_name" : "John", + "surname" : "Doe" + }, + "email_address" : "customer@example.com", + "payer_id" : "2J6QB8YJQSJRJ", + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + } + }, + "create_time" : "2018-12-10T21:20:49Z", + "links" : [ { + "href" : "https://www.paypal.com/webapps/billing/subscriptions?ba_token=BA-2M539689T3856352J", + "rel" : "approve", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "self", + "method" : "GET" + } ] + } + } + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4004" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4225" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}" : { + "get" : { + "tags" : [ "subscriptions" ], + "summary" : "Show subscription details", + "description" : "Shows details for a subscription, by ID.", + "operationId" : "subscriptions.get", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + }, { + "$ref" : "#/components/parameters/fields" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Subscription" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + }, + "patch" : { + "tags" : [ "subscriptions" ], + "summary" : "Update subscription", + "description" : "Updates a subscription which could be in ACTIVE or SUSPENDED status. You can override plan level default attributes by providing customised values for plan path in the patch request.
  • You cannot update attributes that have already completed (Example - trial cycles can’t be updated if completed).
  • Once overridden, changes to plan resource will not impact subscription.
  • Any price update will not impact billing cycles within next 10 days (Applicable only for subscriptions funded by PayPal account).
Following are the fields eligible for patch.
Attribute or objectOperations
billing_info.outstanding_balancereplace
custom_idadd,replace
plan.billing_cycles[@sequence==n].
pricing_scheme.fixed_price
add,replace
plan.billing_cycles[@sequence==n].
pricing_scheme.tiers
replace
plan.billing_cycles[@sequence==n].
total_cycles
replace
plan.payment_preferences.
auto_bill_outstanding
replace
plan.payment_preferences.
payment_failure_threshold
replace
plan.taxes.inclusiveadd,replace
plan.taxes.percentageadd,replace
shipping_amountadd,replace
start_timereplace
subscriber.shipping_addressadd,replace
subscriber.payment_source (for subscriptions funded
by card payments)
replace
", + "operationId" : "subscriptions.patch", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "$ref" : "#/components/requestBodies/patch_request" + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4005" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4226" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/revise" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Revise plan or quantity of subscription", + "description" : "Updates the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount`, `shipping_address` values for the subscription. This type of update requires the buyer's consent.", + "operationId" : "subscriptions.revise", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionReviseRequest" + }, + "examples" : { + "subscription_revise_request" : { + "value" : { + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + }, + "application_context" : { + "brand_name" : "walmart", + "locale" : "en-US", + "shipping_preference" : "SET_PROVIDED_ADDRESS", + "payment_method" : { + "payer_selected" : "PAYPAL", + "payee_preferred" : "IMMEDIATE_PAYMENT_REQUIRED" + }, + "return_url" : "https://example.com/returnUrl", + "cancel_url" : "https://example.com/cancelUrl" + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionReviseResponse" + }, + "examples" : { + "subscription_revise_response" : { + "value" : { + "plan_id" : "P-5ML4271244454362WXNWU5NQ", + "plan_overridden" : false, + "shipping_amount" : { + "currency_code" : "USD", + "value" : "10.00" + }, + "shipping_address" : { + "name" : { + "full_name" : "John Doe" + }, + "address" : { + "address_line_1" : "2211 N First Street", + "address_line_2" : "Building 17", + "admin_area_2" : "San Jose", + "admin_area_1" : "CA", + "postal_code" : "95131", + "country_code" : "US" + } + }, + "links" : [ { + "href" : "https://www.paypal.com/webapps/billing/subscriptions/update?ba_token=BA-2M539689T3856352J", + "rel" : "approve", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "edit", + "method" : "PATCH" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G", + "rel" : "self", + "method" : "GET" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/cancel", + "rel" : "cancel", + "method" : "POST" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/suspend", + "rel" : "suspend", + "method" : "POST" + }, { + "href" : "https://api-m.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/capture", + "rel" : "capture", + "method" : "POST" + } ] + } + } + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4006" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4041" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4227" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/suspend" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Suspend subscription", + "description" : "Suspends the subscription.", + "operationId" : "subscriptions.suspend", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionSuspendRequest" + }, + "examples" : { + "subscription_suspend_request" : { + "value" : { + "reason" : "Item out of stock" + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4007" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4228" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/cancel" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Cancel subscription", + "description" : "Cancels the subscription.", + "operationId" : "subscriptions.cancel", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionCancelRequest" + }, + "examples" : { + "subscription_cancel_request" : { + "value" : { + "reason" : "Not satisfied with the service" + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4008" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4229" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/activate" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Activate subscription", + "description" : "Activates the subscription.", + "operationId" : "subscriptions.activate", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionActivateRequest" + }, + "examples" : { + "subscription_activate_request" : { + "value" : { + "reason" : "Reactivating the subscription" + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "A successful request returns the HTTP `204 No Content` status code with no JSON response body" + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse4009" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse42210" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/capture" : { + "post" : { + "tags" : [ "subscriptions" ], + "summary" : "Capture authorized payment on subscription", + "description" : "Captures an authorized payment from the subscriber on the subscription.", + "operationId" : "subscriptions.capture", + "parameters" : [ { + "$ref" : "#/components/parameters/paypal_request_id" + }, { + "$ref" : "#/components/parameters/id" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SubscriptionCaptureRequest" + }, + "examples" : { + "subscription_capture_request" : { + "value" : { + "note" : "Charging as the balance reached the limit", + "capture_type" : "OUTSTANDING_BALANCE", + "amount" : { + "currency_code" : "USD", + "value" : "100" + } + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Transaction" + } + } + } + }, + "202" : { + "description" : "Request Accepted." + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse40010" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "422" : { + "description" : "The requested action could not be performed, semantically incorrect, or failed business validation.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse42211" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + }, + "/subscriptions/{id}/transactions" : { + "get" : { + "tags" : [ "subscriptions" ], + "summary" : "List transactions for subscription", + "description" : "Lists transactions for a subscription.", + "operationId" : "subscriptions.transactions", + "parameters" : [ { + "$ref" : "#/components/parameters/id" + }, { + "$ref" : "#/components/parameters/start_time" + }, { + "$ref" : "#/components/parameters/end_time" + } ], + "responses" : { + "200" : { + "description" : "A successful request returns the HTTP `200 OK` status code and a JSON response body that shows subscription details", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/TransactionsList" + } + } + } + }, + "400" : { + "description" : "Bad Request. Request is not well-formed, syntactically incorrect, or violates schema.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse40011" + } + } + } + }, + "401" : { + "description" : "Authentication failed due to missing authorization header, or invalid authentication credentials.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse401" + } + } + } + }, + "403" : { + "description" : "Authorization failed due to insufficient permissions.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse403" + } + } + } + }, + "404" : { + "description" : "The specified resource does not exist.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InlineResponse404" + } + } + } + }, + "500" : { + "description" : "An internal server error has occurred.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Error500" + } + } + } + }, + "default" : { + "$ref" : "#/components/responses/default" + } + }, + "security" : [ { + "Oauth2" : [ "https://uri.paypal.com/services/subscriptions" ] + } ] + } + } + }, + "components" : { + "schemas" : { + "Subscriptionssuspend422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED7" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID1" + } ] + }, + "ErrorLocation" : { + "type" : "string", + "description" : "The location of the field that caused the error. Value is `body`, `path`, or `query`", + "default" : "body", + "enum" : [ "body", "path", "query" ] + }, + "UpdatePricingSchemeRequest" : { + "title" : "Update Pricing Scheme", + "required" : [ "billing_cycle_sequence", "pricing_scheme" ], + "type" : "object", + "properties" : { + "billing_cycle_sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The billing cycle sequence", + "x-ballerina-name-ignore" : "billingCycleSequence" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name-ignore" : "pricingScheme" + } + }, + "description" : "The update pricing scheme request details" + }, + "CurrencyCode" : { + "maxLength" : 3, + "minLength" : 3, + "type" : "string", + "description" : "The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency", + "format" : "ppaas_common_currency_code_v2" + }, + "Planscreate400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE1" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMINLENGTH" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE" + } ] + }, + "PhoneWithType" : { + "title" : "Phone With Type", + "required" : [ "phone_number" ], + "type" : "object", + "properties" : { + "phone_type" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PhoneType" + } ], + "x-ballerina-name-ignore" : "phoneType" + }, + "phone_number" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Phone" + } ], + "x-ballerina-name-ignore" : "phoneNumber" + } + }, + "description" : "The phone information" + }, + "Subscriptionspatch400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION1" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH2" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH3" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX3" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE7" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH3" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMINLENGTH1" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE2" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE2" + }, { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY1" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER3" + } ] + }, + "Subscriptionstransactions400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX5" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE10" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER6" + } ] + }, + "PricingScheme" : { + "title" : "Pricing Scheme", + "type" : "object", + "properties" : { + "tiers" : { + "maxItems" : 32, + "minItems" : 1, + "type" : "array", + "description" : "An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified", + "items" : { + "$ref" : "#/components/schemas/PricingTier" + } + }, + "update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "updateTime" + }, + "create_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "createTime" + }, + "pricing_model" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The pricing model for tiered plan. The `tiers` parameter is required", + "enum" : [ "VOLUME", "TIERED" ], + "x-ballerina-name-ignore" : "pricingModel" + }, + "fixed_price" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "fixedPrice" + }, + "version" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The version of the pricing scheme", + "readOnly" : true + } + }, + "description" : "The pricing scheme details" + }, + "SubscriptionsTransactions400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionstransactions400Details" + } + } + } + }, + "SubscriberAllOf2" : { + "properties" : { + "shipping_address" : { + "$ref" : "#/components/schemas/ShippingDetail" + }, + "payment_source" : { + "$ref" : "#/components/schemas/PaymentSourceResponse" + } + } + }, + "SubscriptionCancelRequest" : { + "title" : "Cancel Subscription Request", + "required" : [ "reason" ], + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for the cancellation of a subscription" + } + }, + "description" : "The cancel subscription request details" + }, + "SubscriptionAllOf2" : { + "properties" : { + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The PayPal-generated ID for the subscription.", + "readOnly" : true + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The ID of the plan." + }, + "start_time" : { + "$ref" : "#/components/schemas/DateTime" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product in the subscription." + }, + "shipping_amount" : { + "$ref" : "#/components/schemas/Money" + }, + "subscriber" : { + "$ref" : "#/components/schemas/Subscriber" + }, + "billing_info" : { + "$ref" : "#/components/schemas/SubscriptionBillingInfo" + }, + "create_time" : { + "$ref" : "#/components/schemas/DateTime" + }, + "update_time" : { + "$ref" : "#/components/schemas/DateTime" + }, + "custom_id" : { + "maxLength" : 127, + "minLength" : 1, + "pattern" : "^[\\x20-\\x7E]+", + "type" : "string", + "description" : "The custom id for the subscription. Can be invoice id." + }, + "plan_overridden" : { + "type" : "boolean", + "description" : "Indicates whether the subscription has overridden any plan attributes.", + "readOnly" : true + }, + "plan" : { + "$ref" : "#/components/schemas/Plan" + }, + "links" : { + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + } + } + }, + "INVALIDQUANTITYSUPPORTED" : { + "title" : "INVALID_QUANTITY_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_QUANTITY_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Quantity is always supported for volume and tiered plans." ] + } + } + }, + "BillingCycle" : { + "title" : "Billing Cycle", + "required" : [ "frequency", "sequence", "tenure_type" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" + }, + "tenure_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan", + "enum" : [ "REGULAR", "TRIAL" ], + "x-ballerina-name-ignore" : "tenureType" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "default" : 1, + "x-ballerina-name-ignore" : "totalCycles" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name-ignore" : "pricingScheme" + }, + "frequency" : { + "$ref" : "#/components/schemas/Frequency" + } + }, + "description" : "The billing cycle details" + }, + "InlineResponse42211" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsCapture422" + } ] + }, + "InlineResponse42210" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsActivate422" + } ] + }, + "INVALIDRESOURCEID1" : { + "title" : "INVALID_RESOURCE_ID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_RESOURCE_ID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Requested resource ID was not found." ] + } + } + }, + "PaymentPreferencesOverride" : { + "title" : "Payment Preferences Override", + "type" : "object", + "properties" : { + "setup_fee" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "setupFee" + }, + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The action to take on the subscription if the initial payment for the setup fails", + "enum" : [ "CONTINUE", "CANCEL" ], + "x-ballerina-name-ignore" : "setupFeeFailureAction" + }, + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", + "x-ballerina-name-ignore" : "autoBillOutstanding" + }, + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", + "x-ballerina-name-ignore" : "paymentFailureThreshold" + } + }, + "description" : "The payment preferences to override at subscription level" + }, + "Subscriptionscreate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED4" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINVALID2" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTHAVEQUANTITY" + }, { + "$ref" : "#/components/schemas/CARDSUBSCRIPTIONSNOTENABLED" + }, { + "$ref" : "#/components/schemas/3DSCARDSNOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE3" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGSCHEME1" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT2" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS2" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL2" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY2" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH2" + } ] + }, + "UpdatePricingSchemesListRequest" : { + "title" : "Update Pricing Scheme Request", + "required" : [ "pricing_schemes" ], + "type" : "object", + "properties" : { + "pricing_schemes" : { + "maxItems" : 99, + "minItems" : 1, + "type" : "array", + "description" : "An array of pricing schemes", + "items" : { + "$ref" : "#/components/schemas/UpdatePricingSchemeRequest" + }, + "x-ballerina-name-ignore" : "pricingSchemes" + } + }, + "description" : "The update pricing scheme request details" + }, + "DateNoTime" : { + "maxLength" : 10, + "minLength" : 10, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", + "type" : "string", + "description" : "The stand-alone date, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard `date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years", + "format" : "ppaas_date_notime_v2" + }, + "CURRENCYNOTSUPPORTEDFORRECEIVER" : { + "title" : "CURRENCY_NOT_SUPPORTED_FOR_RECEIVER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_NOT_SUPPORTED_FOR_RECEIVER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "This currency cannot be accepted for this recipient’s account." ] + } + } + }, + "SubscriberRequest" : { + "title" : "Subscriber Request Information", + "type" : "object", + "description" : "The subscriber request information ", + "allOf" : [ { + "$ref" : "#/components/schemas/Payer" + }, { + "$ref" : "#/components/schemas/SubscriberRequestAllOf2" + } ] + }, + "CaptureStatus" : { + "title" : "Capture Status", + "type" : "object", + "properties" : { + "status_details" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CaptureStatusDetails" + } ], + "x-ballerina-name-ignore" : "statusDetails" + }, + "status" : { + "type" : "string", + "description" : "The status of the captured payment", + "readOnly" : true, + "enum" : [ "COMPLETED", "DECLINED", "PARTIALLY_REFUNDED", "PENDING", "REFUNDED" ] + } + }, + "description" : "The status of a captured payment" + }, + "FailedPaymentDetails" : { + "title" : "Failed Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", + "properties" : { + "reason_code" : { + "maxLength" : 120, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The reason code for the payment failure", + "readOnly" : true, + "enum" : [ "PAYMENT_DENIED", "INTERNAL_SERVER_ERROR", "PAYEE_ACCOUNT_RESTRICTED", "PAYER_ACCOUNT_RESTRICTED", "PAYER_CANNOT_PAY", "SENDING_LIMIT_EXCEEDED", "TRANSACTION_RECEIVING_LIMIT_EXCEEDED", "CURRENCY_MISMATCH" ], + "x-ballerina-name-ignore" : "reasonCode" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "next_payment_retry_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "nextPaymentRetryTime" + }, + "time" : { + "$ref" : "#/components/schemas/DateTime" + } + }, + "description" : "The details for the failed payment of the subscription" + }, + "INVALIDBILLINGCYCLESEQUENCE1" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Trial Billing cycle should precede regular billing cycle." ] + } + } + }, + "CARDSUBSCRIPTIONSNOTENABLED1" : { + "title" : "CARD_SUBSCRIPTIONS_NOT_ENABLED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CARD_SUBSCRIPTIONS_NOT_ENABLED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The account is not setup to be able to process subscriptions funded by card payments. Please contact PayPal customer support." ] + } + } + }, + "INVALIDBILLINGCYCLESEQUENCE2" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The provided billing cycle sequence is not available." ] + } + } + }, + "PlansupdatePricingSchemes422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/CURRENCYMISMATCH1" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGSCHEME" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT1" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS1" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS1" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL1" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED1" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY1" + }, { + "$ref" : "#/components/schemas/PRICINGSCHEMEUPDATENOTALLOWED" + } ] + }, + "InlineResponse401" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error401" + }, { + "$ref" : "#/components/schemas/Unauthorized" + } ] + }, + "InlineResponse400" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/BadRequest" + } ] + }, + "ErrorDetails" : { + "title" : "Error Details", + "required" : [ "issue" ], + "type" : "object", + "properties" : { + "field" : { + "type" : "string", + "description" : "The field that caused the error. If this field is in the body, set this value to the field's JSON pointer value. Required for client-side errors" + }, + "issue" : { + "type" : "string", + "description" : "The unique, fine-grained application-level error code" + }, + "description" : { + "type" : "string", + "description" : "The human-readable description for an issue. The description can change over the lifetime of an API, so clients must not depend on this value" + }, + "location" : { + "$ref" : "#/components/schemas/ErrorLocation" + }, + "value" : { + "type" : "string", + "description" : "The value of the field that caused the error" + } + }, + "description" : "The error details. Required for client-side `4XX` errors" + }, + "InlineResponse403" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error403" + }, { + "$ref" : "#/components/schemas/Forbidden" + } ] + }, + "INVALIDACCOUNTSTATUS" : { + "title" : "INVALID_ACCOUNT_STATUS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_ACCOUNT_STATUS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Account validations failed for the user." ] + } + } + }, + "Subscriptionsrevise404Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDRESOURCEID1" + } ] + }, + "InlineResponse404" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error404" + }, { + "$ref" : "#/components/schemas/NotFound" + } ] + }, + "PlansPatch400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch400Details" + } + } + } + }, + "Subscriptionsrevise400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX4" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE8" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE3" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE3" + }, { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY2" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER4" + } ] + }, + "INVALIDBILLINGCYCLESEQUENCE3" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The provided billing cycle sequence is not available." ] + } + } + }, + "INVALIDBILLINGCYCLESEQUENCE4" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The provided billing cycle sequence is not available." ] + } + } + }, + "MULTIPLEFREETRIALBILLINGCYCLESNOTSUPPORTED" : { + "title" : "MULTIPLE_FREE_TRIAL_BILLING_CYCLES_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MULTIPLE_FREE_TRIAL_BILLING_CYCLES_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Only one free trial billing cycle is allowed." ] + } + } + }, + "404Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDRESOURCEID" + } ] + }, + "INVALIDPRICINGTIERAMOUNT1" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "SUBSCRIBERACCOUNTRESTRICTED" : { + "title" : "SUBSCRIBER_ACCOUNT_RESTRICTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIBER_ACCOUNT_RESTRICTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscriber Account Restricted." ] + } + } + }, + "AddressDetails" : { + "title" : "Address Details", + "type" : "object", + "properties" : { + "building_name" : { + "maxLength" : 100, + "type" : "string", + "description" : "A named locations that represents the premise. Usually a building name or number or collection of buildings with a common name or number. For example, Craven House", + "x-ballerina-name-ignore" : "buildingName" + }, + "street_number" : { + "maxLength" : 100, + "type" : "string", + "description" : "The street number", + "x-ballerina-name-ignore" : "streetNumber" + }, + "street_type" : { + "maxLength" : 100, + "type" : "string", + "description" : "The street type. For example, avenue, boulevard, road, or expressway", + "x-ballerina-name-ignore" : "streetType" + }, + "sub_building" : { + "maxLength" : 100, + "type" : "string", + "description" : "The first-order entity below a named building or location that represents the sub-premises. Usually a single building within a collection of buildings with a common name. Can be a flat, story, floor, room, or apartment", + "x-ballerina-name-ignore" : "subBuilding" + }, + "delivery_service" : { + "maxLength" : 100, + "type" : "string", + "description" : "The delivery service. Post office box, bag number, or post office name", + "x-ballerina-name-ignore" : "deliveryService" + }, + "street_name" : { + "maxLength" : 100, + "type" : "string", + "description" : "The street name. Just `Drury` in `Drury Lane`", + "x-ballerina-name-ignore" : "streetName" + } + }, + "description" : "The non-portable additional address details that are sometimes needed for compliance, risk, or other scenarios where fine-grain address information might be needed. Not portable with common third party and open source. Redundant with core fields.
For example, `address_portable.address_line_1` is usually a combination of `address_details.street_number`, `street_name`, and `street_type`" + }, + "INVALIDPRICINGTIERAMOUNT2" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "PlansUpdatePricingSchemes422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes422Details" + } + } + } + }, + "CARDSUBSCRIPTIONSNOTENABLED" : { + "title" : "CARD_SUBSCRIPTIONS_NOT_ENABLED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CARD_SUBSCRIPTIONS_NOT_ENABLED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The account is not setup to be able to process subscriptions funded by card payments. Please contact PayPal customer support." ] + } + } + }, + "INVALIDPRICINGTIERAMOUNT3" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE" + } ] + }, + "INVALIDPRICINGTIERAMOUNT4" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "INVALIDPATCHPATH" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified field cannot be patched." ] + } + } + }, + "LastPaymentDetailsAllOf1" : { + "properties" : { + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "time" : { + "$ref" : "#/components/schemas/DateTime" + } + } + }, + "SubscriptionsSuspend400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionssuspend400Details" + } + } + } + }, + "MISSINGREGULARBILLINGCYCLE" : { + "title" : "MISSING_REGULAR_BILLING_CYCLE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REGULAR_BILLING_CYCLE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Plan should have at least one regular billing cycle." ] + } + } + }, + "SubscriptionBillingInfo" : { + "title" : "Subscription Billing Information", + "required" : [ "failed_payments_count", "outstanding_balance" ], + "type" : "object", + "properties" : { + "final_payment_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "finalPaymentTime" + }, + "cycle_executions" : { + "maxItems" : 3, + "minItems" : 0, + "type" : "array", + "description" : "The trial and regular billing executions", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/CycleExecution" + }, + "x-ballerina-name-ignore" : "cycleExecutions" + }, + "failed_payments_count" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state", + "readOnly" : true, + "x-ballerina-name-ignore" : "failedPaymentsCount" + }, + "next_billing_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "nextBillingTime" + }, + "last_failed_payment" : { + "allOf" : [ { + "$ref" : "#/components/schemas/FailedPaymentDetails" + } ], + "x-ballerina-name-ignore" : "lastFailedPayment" + }, + "outstanding_balance" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "outstandingBalance" + }, + "last_payment" : { + "allOf" : [ { + "$ref" : "#/components/schemas/LastPaymentDetails" + } ], + "x-ballerina-name-ignore" : "lastPayment" + } + }, + "description" : "The billing details for the subscription. If the subscription was or is active, these fields are populated" + }, + "SubscriptionReviseRequest" : { + "title" : "Subscription Modify Plan Request", + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "shippingAmount" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product or service in the subscription" + }, + "application_context" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ApplicationContext" + } ], + "x-ballerina-name-ignore" : "applicationContext" + }, + "shipping_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ShippingDetail" + } ], + "x-ballerina-name-ignore" : "shippingAddress" + }, + "plan" : { + "$ref" : "#/components/schemas/PlanOverride" + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan", + "x-ballerina-name-ignore" : "planId" + } + }, + "description" : "The request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent" + }, + "INVALIDSTRINGMAXLENGTH" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PayeePaymentMethodPreference" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The merchant-preferred payment methods", + "default" : "UNRESTRICTED", + "enum" : [ "UNRESTRICTED", "IMMEDIATE_PAYMENT_REQUIRED" ] + }, + "Frequency" : { + "title" : "Billing Cycle Frequency", + "required" : [ "interval_unit" ], + "type" : "object", + "properties" : { + "interval_count" : { + "maximum" : 365, + "minimum" : 1, + "type" : "integer", + "description" : "The number of intervals after which a subscriber is billed. For example, if the `interval_unit` is `DAY` with an `interval_count` of `2`, the subscription is billed once every two days. The following table lists the maximum allowed values for the `interval_count` for each `interval_unit`:
Interval unitMaximum interval count
DAY365
WEEK52
MONTH12
YEAR1
", + "default" : 1, + "x-ballerina-name-ignore" : "intervalCount" + }, + "interval_unit" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The interval at which the subscription is charged or billed", + "enum" : [ "DAY", "WEEK", "MONTH", "YEAR" ], + "x-ballerina-name-ignore" : "intervalUnit" + } + }, + "description" : "The frequency of the billing cycle" + }, + "422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH" + }, { + "$ref" : "#/components/schemas/MULTIPLEFREETRIALBILLINGCYCLESNOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/MORETHANTWOTRIALBILLINGCYCLENOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/MISSINGREGULARBILLINGCYCLE" + }, { + "$ref" : "#/components/schemas/MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE1" + }, { + "$ref" : "#/components/schemas/INVALIDTRIALBILLINGTOTALCYCLES" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY" + }, { + "$ref" : "#/components/schemas/INVALIDQUANTITYSUPPORTED" + }, { + "$ref" : "#/components/schemas/CURRENCYNOTSUPPORTEDFORRECEIVER" + }, { + "$ref" : "#/components/schemas/INVALIDMETADATACUSTOMNOTE" + }, { + "$ref" : "#/components/schemas/INVALIDMETADATAINVOICEID" + } ] + }, + "Planspatch422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED1" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINACTIVE" + } ] + }, + "CardResponseWithBillingAddress" : { + "title" : "Card Response with billing address and name", + "type" : "object", + "description" : "The payment card used to fund the payment. Card can be a credit or debit card", + "allOf" : [ { + "$ref" : "#/components/schemas/CardResponse" + }, { + "$ref" : "#/components/schemas/CardResponseWithBillingAddressAllOf2" + } ] + }, + "PlansupdatePricingSchemes400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE4" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER1" + } ] + }, + "PayerAllOf2" : { + "properties" : { + "name" : { + "$ref" : "#/components/schemas/Name" + }, + "phone" : { + "$ref" : "#/components/schemas/PhoneWithType" + }, + "birth_date" : { + "$ref" : "#/components/schemas/DateNoTime" + }, + "tax_info" : { + "$ref" : "#/components/schemas/TaxInfo" + }, + "address" : { + "$ref" : "#/components/schemas/AddressPortable" + } + } + }, + "BillingCycleOverride" : { + "title" : "Billing Cycle Override", + "required" : [ "sequence" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a `sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "x-ballerina-name-ignore" : "totalCycles" + }, + "pricing_scheme" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PricingScheme" + } ], + "x-ballerina-name-ignore" : "pricingScheme" + } + }, + "description" : "The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition" + }, + "CycleExecution" : { + "title" : "Billing Cycle Execution Details", + "required" : [ "cycles_completed", "sequence", "tenure_type" ], + "type" : "object", + "properties" : { + "sequence" : { + "maximum" : 99, + "minimum" : 0, + "type" : "integer", + "description" : "The order in which to run this cycle among other billing cycles" + }, + "cycles_remaining" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "For a finite billing cycle, cycles_remaining is the number of remaining cycles. For an infinite billing cycle, cycles_remaining is set as 0", + "readOnly" : true, + "x-ballerina-name-ignore" : "cyclesRemaining" + }, + "tenure_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The type of the billing cycle", + "readOnly" : true, + "enum" : [ "REGULAR", "TRIAL" ], + "x-ballerina-name-ignore" : "tenureType" + }, + "cycles_completed" : { + "maximum" : 9999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of billing cycles that have completed", + "readOnly" : true, + "x-ballerina-name-ignore" : "cyclesCompleted" + }, + "current_pricing_scheme_version" : { + "maximum" : 99, + "minimum" : 1, + "type" : "integer", + "description" : "The active pricing scheme version for the billing cycle", + "readOnly" : true, + "x-ballerina-name-ignore" : "currentPricingSchemeVersion" + }, + "total_cycles" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles)", + "readOnly" : true, + "x-ballerina-name-ignore" : "totalCycles" + } + }, + "description" : "The regular and trial execution details for a billing cycle" + }, + "INVALIDTRIALBILLINGTOTALCYCLES" : { + "title" : "INVALID_TRIAL_BILLING_TOTAL_CYCLES", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_TRIAL_BILLING_TOTAL_CYCLES" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Total cycles for trial billing must be greater than '0'." ] + } + } + }, + "Email" : { + "maxLength" : 254, + "pattern" : "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "merchant_common_email_address_v2" + }, + "AccountId" : { + "title" : "PayPal Account Identifier", + "maxLength" : 13, + "minLength" : 13, + "pattern" : "^[2-9A-HJ-NP-Z]{13}$", + "type" : "string", + "description" : "The account identifier for a PayPal account", + "format" : "ppaas_payer_id_v3" + }, + "Subscriptionsactivate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED9" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID3" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED1" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONCANNOTBEACTIVATED2" + } ] + }, + "SubscriptionsCreate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscreate422Details" + } + } + } + }, + "INVALIDPRICINGTIERAMOUNT" : { + "title" : "INVALID_PRICING_TIER_AMOUNT", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_AMOUNT" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Free tiers are not supported." ] + } + } + }, + "Name" : { + "title" : "Name", + "type" : "object", + "properties" : { + "full_name" : { + "maxLength" : 300, + "type" : "string", + "description" : "When the party is a person, the party's full name", + "x-ballerina-name-ignore" : "fullName" + }, + "prefix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The prefix, or title, to the party's name" + }, + "surname" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's surname or family name. Also known as the last name. Required when the party is a person. Use also to store multiple surnames including the matronymic, or mother's, surname" + }, + "given_name" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's given, or first, name", + "x-ballerina-name-ignore" : "givenName" + }, + "middle_name" : { + "maxLength" : 140, + "type" : "string", + "description" : "When the party is a person, the party's middle name. Use also to store multiple middle names including the patronymic, or father's, middle name", + "x-ballerina-name-ignore" : "middleName" + }, + "suffix" : { + "maxLength" : 140, + "type" : "string", + "description" : "The suffix for the party's name" + }, + "alternate_full_name" : { + "maxLength" : 300, + "type" : "string", + "description" : "DEPRECATED. The party's alternate name. Can be a business name, nickname, or any other name that cannot be split into first, last name. Required when the party is a business", + "x-ballerina-name-ignore" : "alternateFullName" + } + }, + "description" : "The name of the party" + }, + "Enrolled" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Status of Authentication eligibility", + "enum" : [ "Y", "N", "U", "B" ] + }, + "BILLINGCYCLEEXECUTIONCOMPLETED" : { + "title" : "BILLING_CYCLE_EXECUTION_COMPLETED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "BILLING_CYCLE_EXECUTION_COMPLETED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Update cannot be performed on a billing cycle that has completed execution." ] + } + } + }, + "PaymentPreferences" : { + "title" : "Payment Preferences", + "type" : "object", + "properties" : { + "setup_fee" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "setupFee" + }, + "setup_fee_failure_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The action to take on the subscription if the initial payment for the setup fails", + "default" : "CANCEL", + "enum" : [ "CONTINUE", "CANCEL" ], + "x-ballerina-name-ignore" : "setupFeeFailureAction" + }, + "auto_bill_outstanding" : { + "type" : "boolean", + "description" : "Indicates whether to automatically bill the outstanding amount in the next billing cycle", + "default" : true, + "x-ballerina-name-ignore" : "autoBillOutstanding" + }, + "payment_failure_threshold" : { + "maximum" : 999, + "minimum" : 0, + "type" : "integer", + "description" : "The maximum number of payment failures before a subscription is suspended. For example, if `payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail", + "default" : 0, + "x-ballerina-name-ignore" : "paymentFailureThreshold" + } + }, + "description" : "The payment preferences for a subscription" + }, + "TransactionsList" : { + "title" : "List Transactions", + "type" : "object", + "properties" : { + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + }, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of pages", + "x-ballerina-name-ignore" : "totalPages" + }, + "transactions" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of transactions", + "items" : { + "$ref" : "#/components/schemas/Transaction" + } + }, + "total_items" : { + "maximum" : 500000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of items", + "x-ballerina-name-ignore" : "totalItems" + } + }, + "description" : "The list transactions for a subscription request details" + }, + "MULTIPLEREGULARBILLINGCYCLESNOTSUPPORTED" : { + "title" : "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MULTIPLE_REGULAR_BILLING_CYCLES_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Only one regular billing cycle is allowed." ] + } + } + }, + "PlansPatch422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planspatch422Details" + } + } + } + }, + "ApplicationContext" : { + "title" : "Application Context", + "required" : [ "cancel_url", "return_url" ], + "type" : "object", + "properties" : { + "user_action" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "Configures the label name to `Continue` or `Subscribe Now` for subscription consent experience", + "default" : "SUBSCRIBE_NOW", + "enum" : [ "CONTINUE", "SUBSCRIBE_NOW" ], + "x-ballerina-name-ignore" : "userAction" + }, + "return_url" : { + "maxLength" : 4000, + "minLength" : 10, + "type" : "string", + "description" : "The URL where the customer is redirected after the customer approves the payment", + "format" : "uri", + "x-ballerina-name-ignore" : "returnUrl" + }, + "brand_name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The label that overrides the business name in the PayPal account on the PayPal site", + "x-ballerina-name-ignore" : "brandName" + }, + "locale" : { + "$ref" : "#/components/schemas/Language" + }, + "cancel_url" : { + "maxLength" : 4000, + "minLength" : 10, + "type" : "string", + "description" : "The URL where the customer is redirected after the customer cancels the payment", + "format" : "uri", + "x-ballerina-name-ignore" : "cancelUrl" + }, + "shipping_preference" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The location from which the shipping address is derived", + "default" : "GET_FROM_FILE", + "enum" : [ "GET_FROM_FILE", "NO_SHIPPING", "SET_PROVIDED_ADDRESS" ], + "x-ballerina-name-ignore" : "shippingPreference" + }, + "payment_method" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentMethod" + } ], + "x-ballerina-name-ignore" : "paymentMethod" + } + }, + "description" : "The application context, which customizes the payer experience during the subscription approval process with PayPal" + }, + "Subscriber" : { + "title" : "Subscriber Response Information", + "type" : "object", + "description" : "The subscriber response information", + "allOf" : [ { + "$ref" : "#/components/schemas/Payer" + }, { + "$ref" : "#/components/schemas/SubscriberAllOf2" + } ] + }, + "AMOUNTGREATERTHANOUTSTANDINGBALANCE1" : { + "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The capture amount can not be greater than the current outstanding balance." ] + } + } + }, + "PaymentSourceResponse" : { + "title" : "Payment Source Response", + "type" : "object", + "properties" : { + "card" : { + "$ref" : "#/components/schemas/CardResponseWithBillingAddress" + } + }, + "description" : "The payment source used to fund the payment" + }, + "PlanOverride" : { + "title" : "Plan Override", + "type" : "object", + "properties" : { + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferencesOverride" + } ], + "x-ballerina-name-ignore" : "paymentPreferences" + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. The subscription billing cycle definition has to adhere to the plan billing cycle definition", + "items" : { + "$ref" : "#/components/schemas/BillingCycleOverride" + }, + "x-ballerina-name-ignore" : "billingCycles" + }, + "taxes" : { + "$ref" : "#/components/schemas/TaxesOverride" + } + }, + "description" : "An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object" + }, + "INVALIDINTEGERMINVALUE" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "Subscriptionssuspend400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH4" + } ] + }, + "SubscriptionReviseResponseAllOf2" : { + "properties" : { + "plan_overridden" : { + "type" : "boolean", + "description" : "Indicates whether the subscription has overridden any plan attributes.", + "readOnly" : true + }, + "links" : { + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + } + } + }, + "MISSINGREQUESTBODY2" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "MISSINGREQUESTBODY1" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "MISSINGREQUIREDPARAMETER" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "ThreeDSecureAuthenticationResponse" : { + "title" : "The 3D Secure Authentication Response", + "type" : "object", + "properties" : { + "authentication_status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ParesStatus" + } ], + "x-ballerina-name-ignore" : "authenticationStatus" + }, + "enrollment_status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Enrolled" + } ], + "x-ballerina-name-ignore" : "enrollmentStatus" + } + }, + "description" : "Results of 3D Secure Authentication" + }, + "403Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/PERMISSIONDENIED" + } ] + }, + "401Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDACCOUNTSTATUS" + } ] + }, + "INVALIDPRICINGTIERQUANTITY" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "PRICINGSCHEMEUPDATENOTALLOWED" : { + "title" : "PRICING_SCHEME_UPDATE_NOT_ALLOWED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PRICING_SCHEME_UPDATE_NOT_ALLOWED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Pricing scheme update is not allowed for the plan." ] + } + } + }, + "CURRENCYMISMATCH2" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the plan's currency code." ] + } + } + }, + "CURRENCYMISMATCH1" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the plan's currency code." ] + } + } + }, + "PatchRequest" : { + "title" : "Patch Request", + "type" : "array", + "description" : "An array of JSON patch objects to apply partial updates to resources", + "items" : { + "$ref" : "#/components/schemas/Patch" + } + }, + "CURRENCYMISMATCH5" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the subscription's currency code." ] + } + } + }, + "CURRENCYMISMATCH4" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the plan's currency code." ] + } + } + }, + "CURRENCYMISMATCH3" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The currency code is different from the subscription's currency code." ] + } + } + }, + "MISSINGREQUESTBODY3" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "InlineResponse4041" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error404" + }, { + "$ref" : "#/components/schemas/SubscriptionsRevise404" + } ] + }, + "Subscriptionscancel422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED8" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID2" + } ] + }, + "CardResponse" : { + "title" : "Card Response", + "type" : "object", + "properties" : { + "authentication_result" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AuthenticationResponse" + } ], + "x-ballerina-name-ignore" : "authenticationResult" + }, + "type" : { + "type" : "string", + "description" : "The payment card type", + "readOnly" : true, + "enum" : [ "CREDIT", "DEBIT", "PREPAID", "UNKNOWN" ] + }, + "last_digits" : { + "pattern" : "[0-9]{2,}", + "type" : "string", + "description" : "The last digits of the payment card", + "readOnly" : true, + "x-ballerina-name-ignore" : "lastDigits" + }, + "brand" : { + "$ref" : "#/components/schemas/CardBrand" + } + }, + "description" : "The payment card to use to fund a payment. Card can be a credit or debit card" + }, + "PlanRequestPOST" : { + "title" : "Create Plan Request", + "required" : [ "billing_cycles", "name", "payment_preferences", "product_id" ], + "type" : "object", + "properties" : { + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", + "default" : false, + "x-ballerina-name-ignore" : "quantitySupported" + }, + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferences" + } ], + "x-ballerina-name-ignore" : "paymentPreferences" + }, + "product_id" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string", + "description" : "The ID of the product created through Catalog Products API", + "x-ballerina-name-ignore" : "productId" + }, + "name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The plan name" + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", + "items" : { + "$ref" : "#/components/schemas/BillingCycle" + }, + "x-ballerina-name-ignore" : "billingCycles" + }, + "description" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The detailed description of the plan" + }, + "taxes" : { + "$ref" : "#/components/schemas/Taxes" + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The initial state of the plan. Allowed input values are CREATED and ACTIVE", + "default" : "ACTIVE", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] + } + }, + "description" : "The create plan request details" + }, + "INVALIDINTEGERMAXVALUE2" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "Patch" : { + "title" : "Patch", + "required" : [ "op" ], + "type" : "object", + "properties" : { + "op" : { + "type" : "string", + "description" : "The operation", + "enum" : [ "add", "remove", "replace", "move", "copy", "test" ] + }, + "path" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location at which to complete the operation" + }, + "from" : { + "type" : "string", + "description" : "The JSON Pointer to the target document location from which to move the value. Required for the move operation" + }, + "value" : { + "title" : "Patch Value", + "description" : "The value to apply. The remove operation does not require a value" + } + }, + "description" : "The JSON patch object to apply partial updates to resources" + }, + "INVALIDINTEGERMAXVALUE3" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "INVALIDINTEGERMAXVALUE1" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "SUBSCRIPTIONCANNOTHAVEQUANTITY" : { + "title" : "SUBSCRIPTION_CANNOT_HAVE_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_HAVE_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscription can't have quantity as the plan does not support quantity." ] + } + } + }, + "Subscriptionscancel400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH5" + } ] + }, + "INVALIDPARAMETERVALUE10" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "LinkDescription" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], + "type" : "object", + "properties" : { + "method" : { + "type" : "string", + "description" : "The HTTP method required to make the related call", + "enum" : [ "GET", "POST", "PUT", "DELETE", "HEAD", "CONNECT", "OPTIONS", "PATCH" ] + }, + "rel" : { + "type" : "string", + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" + }, + "href" : { + "type" : "string", + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" + } + }, + "description" : "The request-related [HATEOAS link](/docs/api/reference/api-responses/#hateoas-links) information" + }, + "SubscriptionsCreate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscreate400Details" + } + } + } + }, + "ShippingDetail" : { + "title" : "Shipping Details", + "type" : "object", + "properties" : { + "address" : { + "$ref" : "#/components/schemas/AddressPortable" + }, + "name" : { + "$ref" : "#/components/schemas/Name" + }, + "type" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The method by which the payer wants to get their items from the payee e.g shipping, in-person pickup. Either type or options but not both may be present", + "enum" : [ "SHIPPING", "PICKUP_IN_PERSON" ] + } + }, + "description" : "The shipping details" + }, + "INVALIDMETADATAINVOICEID" : { + "title" : "INVALID_METADATA_INVOICE_ID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_METADATA_INVOICE_ID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invoice id cannot exceed 127 characters." ] + } + } + }, + "INVALIDINTEGERMAXVALUE" : { + "title" : "INVALID_INTEGER_MAX_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MAX_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too large." ] + } + } + }, + "PLANSTATUSINVALID2" : { + "title" : "PLAN_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid plan status for subscription creation; plan status should be active." ] + } + } + }, + "Subscriptionscapture422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED10" + }, { + "$ref" : "#/components/schemas/SUBSCRIBERACCOUNTLOCKED" + }, { + "$ref" : "#/components/schemas/SUBSCRIBERACCOUNTCLOSED" + }, { + "$ref" : "#/components/schemas/SUBSCRIBERACCOUNTRESTRICTED" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID4" + }, { + "$ref" : "#/components/schemas/ZEROOUTSTANDINGBALANCE" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH5" + }, { + "$ref" : "#/components/schemas/AMOUNTGREATERTHANOUTSTANDINGBALANCE1" + } ] + }, + "PlansCreate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Planscreate400Details" + } + } + } + }, + "PLANSTATUSINVALID1" : { + "title" : "PLAN_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid plan status for deactivate action; plan status should be active." ] + } + } + }, + "LiabilityShift" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Liability shift indicator. The outcome of the issuer's authentication", + "enum" : [ "YES", "NO", "POSSIBLE", "UNKNOWN" ] + }, + "AmountWithBreakdown" : { + "title" : "Amount with Breakdown", + "required" : [ "gross_amount" ], + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "shippingAmount" + }, + "tax_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "taxAmount" + }, + "fee_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "feeAmount" + }, + "total_item_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "totalItemAmount" + }, + "gross_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "grossAmount" + }, + "net_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "netAmount" + } + }, + "description" : "The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts" + }, + "SUBSCRIBERACCOUNTLOCKED" : { + "title" : "SUBSCRIBER_ACCOUNT_LOCKED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIBER_ACCOUNT_LOCKED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscriber Account Locked." ] + } + } + }, + "Money" : { + "title" : "Money", + "required" : [ "currency_code", "value" ], + "type" : "object", + "properties" : { + "value" : { + "maxLength" : 32, + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "type" : "string", + "description" : "The value, which might be:
  • An integer for currencies like `JPY` that are not typically fractional.
  • A decimal fraction for currencies like `TND` that are subdivided into thousandths.
For the required number of decimal places for a currency code, see [Currency Codes](/docs/integration/direct/rest/currency-codes/)" + }, + "currency_code" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CurrencyCode" + } ], + "x-ballerina-name-ignore" : "currencyCode" + } + }, + "description" : "The currency and amount for a financial transaction, such as a balance or payment due" + }, + "UnprocessableEntity" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/422Details" + } + } + } + }, + "LastPaymentDetails" : { + "title" : "Last Payment Details", + "required" : [ "amount", "time" ], + "type" : "object", + "description" : "The details for the last payment", + "allOf" : [ { + "$ref" : "#/components/schemas/LastPaymentDetailsAllOf1" + } ] + }, + "Language" : { + "maxLength" : 10, + "minLength" : 2, + "pattern" : "^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$", + "type" : "string", + "description" : "The [language tag](https://tools.ietf.org/html/bcp47#section-2) for the language in which to localize the error-related strings, such as messages, issues, and suggested actions. The tag is made up of the [ISO 639-2 language code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the optional [ISO-15924 script tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166 alpha-2 country code](/docs/integration/direct/rest/country-codes/)", + "format" : "ppaas_common_language_v3" + }, + "SubscriptionActivateRequest" : { + "title" : "Activate Subscription Request", + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for activation of a subscription. Required to reactivate the subscription" + } + }, + "description" : "The activate subscription request details" + }, + "Subscriptionscapture400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY3" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE9" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH7" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER5" + } ] + }, + "Plansactivate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED2" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINVALID" + } ] + }, + "SubscriberRequestAllOf2" : { + "properties" : { + "shipping_address" : { + "$ref" : "#/components/schemas/ShippingDetail" + }, + "payment_source" : { + "$ref" : "#/components/schemas/PaymentSource" + } + } + }, + "SUBSCRIPTIONCANNOTBEACTIVATED2" : { + "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "This subscription should be activated by the merchant." ] + } + } + }, + "PricingTier" : { + "title" : "Pricing Tier", + "required" : [ "amount", "starting_quantity" ], + "type" : "object", + "properties" : { + "starting_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The starting quantity for the tier", + "x-ballerina-name-ignore" : "startingQuantity" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "ending_quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The ending quantity for the tier. Optional for the last tier", + "x-ballerina-name-ignore" : "endingQuantity" + } + }, + "description" : "The pricing tier details" + }, + "PayerBase" : { + "title" : "Payer Base", + "type" : "object", + "properties" : { + "email_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Email" + } ], + "x-ballerina-name-ignore" : "emailAddress" + }, + "payer_id" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AccountId" + } ], + "x-ballerina-name-ignore" : "payerId" + } + }, + "description" : "The customer who approves and pays for the order. The customer is also known as the payer" + }, + "InlineResponse40010" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCapture400" + } ] + }, + "INVALIDSTRINGMINLENGTH1" : { + "title" : "INVALID_STRING_MIN_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MIN_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too short." ] + } + } + }, + "INVALIDPRICINGSCHEME" : { + "title" : "INVALID_PRICING_SCHEME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_SCHEME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The new pricing scheme should be of the same type as that of the old one." ] + } + } + }, + "InlineResponse40011" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsTransactions400" + } ] + }, + "SUBSCRIPTIONCANNOTBEACTIVATED1" : { + "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "This subscription should be activated by the system." ] + } + } + }, + "INVALIDBILLINGTOTALCYCLES" : { + "title" : "INVALID_BILLING_TOTAL_CYCLES", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_TOTAL_CYCLES" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The total cycles cannot be less than the number of billing cycles completed." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for patch action; subscription status should be either active or suspended." ] + } + } + }, + "PLANSTATUSINVALID" : { + "title" : "PLAN_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid plan status for activate action; plan status should be either created or inactive." ] + } + } + }, + "INVALIDPRICINGTIERQUANTITY4" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "PlanCollection" : { + "title" : "Plan Collection", + "type" : "object", + "properties" : { + "plans" : { + "maxItems" : 32767, + "minItems" : 0, + "type" : "array", + "description" : "An array of plans", + "items" : { + "$ref" : "#/components/schemas/Plan" + } + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + }, + "total_pages" : { + "maximum" : 100000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of pages", + "x-ballerina-name-ignore" : "totalPages" + }, + "total_items" : { + "maximum" : 500000000, + "minimum" : 0, + "type" : "integer", + "description" : "The total number of items", + "x-ballerina-name-ignore" : "totalItems" + } + }, + "description" : "The list of plans with details" + }, + "ParesStatus" : { + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "Transactions status result identifier. The outcome of the issuer's authentication", + "enum" : [ "Y", "N", "U", "A", "C", "R", "D", "I" ] + }, + "SubscriptionsPatch422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionspatch422Details" + } + } + } + }, + "INVALIDPRICINGTIERQUANTITY1" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "INVALIDPRICINGTIERQUANTITY2" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "INVALIDPRICINGTIERQUANTITY3" : { + "title" : "INVALID_PRICING_TIER_QUANTITY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_TIER_QUANTITY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier starting quantity must be less than ending quantity." ] + } + } + }, + "Error503" : { + "title" : "Service Unavailable Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "SERVICE_UNAVAILABLE" ] + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Service Unavailable." ] + } + }, + "description" : "The server is temporarily unable to handle the request, for example, because of planned maintenance or downtime", + "example" : { + "name" : "SERVICE_UNAVAILABLE", + "message" : "Service Unavailable.", + "debug_id" : "90957fca61718", + "information_link" : "https://developer.paypal.com/docs/api/orders/v2/#error-SERVICE_UNAVAILABLE" + } + }, + "INVALIDPARAMETERSYNTAX" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "UNSUPPORTEDPATCHOPERATION1" : { + "title" : "UNSUPPORTED_PATCH_OPERATION", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "UNSUPPORTED_PATCH_OPERATION" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified patch operation not supported for this field." ] + } + } + }, + "PaymentSource" : { + "title" : "Payment Source", + "type" : "object", + "properties" : { + "card" : { + "$ref" : "#/components/schemas/Card" + } + }, + "description" : "The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (https://www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions" + }, + "CardBrand" : { + "title" : "Card Brand", + "maxLength" : 255, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The card network or brand. Applies to credit, debit, gift, and payment cards", + "enum" : [ "VISA", "MASTERCARD", "DISCOVER", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFIGOGA", "CONFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY" ] + }, + "NotFound" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/404Details" + } + } + } + }, + "Forbidden" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/403Details" + } + } + } + }, + "DateTime" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "description" : "The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.
Note: The regular expression provides guidance but does not reject all invalid dates.
", + "format" : "ppaas_date_time_v3" + }, + "Unauthorized" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/401Details" + } + } + } + }, + "BadRequest" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/400Details" + } + } + } + }, + "MISSINGPRICINGSCHEMETIERS4" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "TaxInfo" : { + "title" : "Tax Information", + "required" : [ "tax_id", "tax_id_type" ], + "type" : "object", + "properties" : { + "tax_id_type" : { + "type" : "string", + "description" : "The customer's tax ID type", + "enum" : [ "BR_CPF", "BR_CNPJ" ], + "x-ballerina-name-ignore" : "taxIdType" + }, + "tax_id" : { + "maxLength" : 14, + "type" : "string", + "description" : "The customer's tax ID value", + "x-ballerina-name-ignore" : "taxId" + } + }, + "description" : "The tax ID of the customer. The customer is also known as the payer. Both `tax_id` and `tax_id_type` are required" + }, + "MISSINGPRICINGSCHEMETIERS1" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "MISSINGPRICINGSCHEMETIERS3" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "INVALIDPARAMETERSYNTAX5" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "SubscriptionRequestPost" : { + "title" : "Create Subscription Request", + "required" : [ "plan_id" ], + "type" : "object", + "properties" : { + "shipping_amount" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Money" + } ], + "x-ballerina-name-ignore" : "shippingAmount" + }, + "start_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "startTime" + }, + "quantity" : { + "maxLength" : 32, + "minLength" : 1, + "pattern" : "^([0-9]+|([0-9]+)?[.][0-9]+)$", + "type" : "string", + "description" : "The quantity of the product in the subscription" + }, + "subscriber" : { + "$ref" : "#/components/schemas/SubscriberRequest" + }, + "custom_id" : { + "maxLength" : 127, + "minLength" : 1, + "pattern" : "^[\\x20-\\x7E]+", + "type" : "string", + "description" : "The custom id for the subscription. Can be invoice id", + "x-ballerina-name-ignore" : "customId" + }, + "application_context" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ApplicationContext" + } ], + "x-ballerina-name-ignore" : "applicationContext" + }, + "plan" : { + "$ref" : "#/components/schemas/PlanOverride" + }, + "plan_id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The ID of the plan", + "x-ballerina-name-ignore" : "planId" + }, + "auto_renewal" : { + "type" : "boolean", + "description" : "DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete", + "deprecated" : true, + "default" : false, + "x-ballerina-name-ignore" : "autoRenewal" + } + }, + "description" : "The create subscription request details" + }, + "MISSINGPRICINGSCHEMETIERS2" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "Subscription" : { + "title" : "Subscription", + "type" : "object", + "description" : "The subscription details", + "allOf" : [ { + "$ref" : "#/components/schemas/SubscriptionStatus" + }, { + "$ref" : "#/components/schemas/SubscriptionAllOf2" + } ] + }, + "Error500" : { + "title" : "Internal Server Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "INTERNAL_SERVER_ERROR" ] + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "An internal server error occurred." ] + } + }, + "description" : "This is either a system or application error, and generally indicates that although the client appeared to provide a correct request, something unexpected has gone wrong on the server", + "example" : { + "name" : "INTERNAL_SERVER_ERROR", + "message" : "An internal server error occurred.", + "debug_id" : "90957fca61718", + "links" : [ { + "href" : "https://developer.paypal.com/api/orders/v2/#error-INTERNAL_SERVER_ERROR", + "rel" : "information_link" + } ] + } + }, + "Subscriptionsactivate400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH6" + } ] + }, + "INVALIDINTEGERMINVALUE3" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "INVALIDINTEGERMINVALUE2" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "CURRENCYMISMATCH" : { + "title" : "CURRENCY_MISMATCH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "CURRENCY_MISMATCH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "All currency codes in the request should be of similar value." ] + } + } + }, + "INVALIDPARAMETERSYNTAX3" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDPARAMETERSYNTAX4" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDPARAMETERSYNTAX1" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDINTEGERMINVALUE1" : { + "title" : "INVALID_INTEGER_MIN_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_INTEGER_MIN_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The integer value of a field is too small." ] + } + } + }, + "INVALIDPARAMETERSYNTAX2" : { + "title" : "INVALID_PARAMETER_SYNTAX", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_SYNTAX" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field does not conform to the expected format." ] + } + } + }, + "INVALIDRESOURCEID" : { + "title" : "INVALID_RESOURCE_ID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_RESOURCE_ID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Specified resource ID does not exist. Please check the resource ID and try again." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED4" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "PLANPRODUCTNOTCOMPATIBLE" : { + "title" : "PLAN_PRODUCT_NOT_COMPATIBLE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_PRODUCT_NOT_COMPATIBLE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The old and the new plans should be for the same product." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED2" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "FIXEDPRICENOTSUPPORTED3" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "EmailAddress" : { + "maxLength" : 254, + "minLength" : 3, + "pattern" : "^.+@[^\"\\-].+$", + "type" : "string", + "description" : "The internationalized email address.
Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
", + "format" : "ppaas_common_email_address_v2" + }, + "FIXEDPRICENOTSUPPORTED1" : { + "title" : "FIXED_PRICE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "FIXED_PRICE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Fixed price is not supported for tiered pricing schemes." ] + } + } + }, + "Card" : { + "title" : "Card", + "required" : [ "expiry", "number" ], + "type" : "object", + "properties" : { + "number" : { + "maxLength" : 19, + "minLength" : 13, + "type" : "string", + "description" : "The primary account number (PAN) for the payment card" + }, + "security_code" : { + "pattern" : "[0-9]{3,4}", + "type" : "string", + "description" : "The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when `payment_initiator=MERCHANT`", + "x-ballerina-name-ignore" : "securityCode" + }, + "name" : { + "maxLength" : 300, + "type" : "string", + "description" : "The card holder's name as it appears on the card" + }, + "billing_address" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AddressPortable" + } ], + "x-ballerina-name-ignore" : "billingAddress" + }, + "id" : { + "type" : "string", + "description" : "The PayPal-generated ID for the card", + "readOnly" : true + }, + "expiry" : { + "$ref" : "#/components/schemas/DateYearMonth" + }, + "card_type" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CardBrand" + } ], + "x-ballerina-name-ignore" : "cardType" + }, + "last_digits" : { + "pattern" : "[0-9]{2,}", + "type" : "string", + "description" : "The last digits of the payment card", + "readOnly" : true, + "x-ballerina-name-ignore" : "lastDigits" + } + }, + "description" : "The payment card to use to fund a payment. Can be a credit or debit card" + }, + "InlineResponse4001" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/PlansCreate400" + } ] + }, + "InlineResponse4003" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/PlansUpdatePricingSchemes400" + } ] + }, + "InlineResponse4002" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/PlansPatch400" + } ] + }, + "InlineResponse4005" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsPatch400" + } ] + }, + "InlineResponse4004" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCreate400" + } ] + }, + "InlineResponse4007" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsSuspend400" + } ] + }, + "SubscriptionsPatch400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionspatch400Details" + } + } + } + }, + "InlineResponse4006" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsRevise400" + } ] + }, + "InlineResponse4009" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsActivate400" + } ] + }, + "InlineResponse4008" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/SubscriptionsCancel400" + } ] + }, + "Error404" : { + "title" : "Not found Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_NOT_FOUND" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The specified resource does not exist." ] + } + }, + "description" : "The server has not found anything matching the request URI. This either means that the URI is incorrect or the resource is not available" + }, + "MISSINGREQUIREDPARAMETER5" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "Error409" : { + "title" : "Resource Conflict Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "RESOURCE_CONFLICT" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The server has detected a conflict while processing this request." ] + } + }, + "description" : "The server has detected a conflict while processing this request" + }, + "AMOUNTGREATERTHANOUTSTANDINGBALANCE" : { + "title" : "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "AMOUNT_GREATER_THAN_OUTSTANDING_BALANCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The new outstanding balance cannot be greater than the current outstanding balance." ] + } + } + }, + "MISSINGREQUIREDPARAMETER4" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "Subscriptionsrevise422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED6" + }, { + "$ref" : "#/components/schemas/PLANPRODUCTNOTCOMPATIBLE" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGCYCLESEQUENCE4" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGSCHEME2" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT4" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS4" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS4" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL4" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED4" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY4" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH4" + } ] + }, + "SubscriptionsCancel400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel400Details" + } + } + } + }, + "MISSINGREQUIREDPARAMETER6" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "INVALIDMETADATACUSTOMNOTE" : { + "title" : "INVALID_METADATA_CUSTOM_NOTE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_METADATA_CUSTOM_NOTE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Merchant custom note cannot exceed 255 characters." ] + } + } + }, + "MISSINGREQUIREDPARAMETER1" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "MISSINGREQUIREDPARAMETER3" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "MISSINGREQUIREDPARAMETER2" : { + "title" : "MISSING_REQUIRED_PARAMETER", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUIRED_PARAMETER" ] + }, + "description" : { + "type" : "string", + "enum" : [ "A required field is missing." ] + } + } + }, + "Error400" : { + "title" : "Bad Request Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "INVALID_REQUEST" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Request is not well-formed, syntactically incorrect, or violates schema." ] + } + }, + "description" : "Request is not well-formed, syntactically incorrect, or violates schema" + }, + "Error401" : { + "title" : "Unauthorized Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "AUTHENTICATION_FAILURE" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Authentication failed due to missing authorization header, or invalid authentication credentials." ] + } + }, + "description" : "Authentication failed due to missing Authorization header, or invalid authentication credentials" + }, + "Error403" : { + "title" : "Not Authorized Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "NOT_AUTHORIZED" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "Authorization failed due to insufficient permissions." ] + } + }, + "description" : "The client is not authorized to access this resource, although it may have valid credentials. " + }, + "Error415" : { + "title" : "Unsupported Media Type Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "UNSUPPORTED_MEDIA_TYPE" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The server does not support the request payload's media type." ] + } + }, + "description" : "The server does not support the request payload's media type" + }, + "PLANSTATUSINACTIVE" : { + "title" : "PLAN_STATUS_INACTIVE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PLAN_STATUS_INACTIVE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Status update is the only patchable filed on an inactive plan." ] + } + } + }, + "Percentage" : { + "pattern" : "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", + "type" : "string", + "description" : "The percentage, as a fixed-point, signed decimal number. For example, define a 19.99% interest rate as `19.99`", + "format" : "ppaas_common_percentage_v2" + }, + "Planspatch400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/UNSUPPORTEDPATCHOPERATION" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH" + }, { + "$ref" : "#/components/schemas/INVALIDPATCHPATH1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE2" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE3" + } ] + }, + "Plan" : { + "title" : "Plan", + "type" : "object", + "properties" : { + "quantity_supported" : { + "type" : "boolean", + "description" : "Indicates whether you can subscribe to this plan by providing a quantity for the goods or service", + "default" : false, + "x-ballerina-name-ignore" : "quantitySupported" + }, + "update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "updateTime" + }, + "create_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "createTime" + }, + "payment_preferences" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentPreferences" + } ], + "x-ballerina-name-ignore" : "paymentPreferences" + }, + "product_id" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string", + "description" : "The ID for the product", + "x-ballerina-name-ignore" : "productId" + }, + "name" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The plan name" + }, + "billing_cycles" : { + "maxItems" : 12, + "minItems" : 1, + "type" : "array", + "description" : "An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle", + "items" : { + "$ref" : "#/components/schemas/BillingCycle" + }, + "x-ballerina-name-ignore" : "billingCycles" + }, + "description" : { + "maxLength" : 127, + "minLength" : 1, + "type" : "string", + "description" : "The detailed description of the plan" + }, + "taxes" : { + "$ref" : "#/components/schemas/Taxes" + }, + "links" : { + "maxItems" : 10, + "minItems" : 1, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links)", + "readOnly" : true, + "items" : { + "$ref" : "#/components/schemas/LinkDescription" + } + }, + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The unique PayPal-generated ID for the plan", + "readOnly" : true + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The plan status", + "enum" : [ "CREATED", "INACTIVE", "ACTIVE" ] + } + }, + "description" : "The plan details" + }, + "AuthenticationResponse" : { + "title" : "Authentication Response", + "type" : "object", + "properties" : { + "liability_shift" : { + "allOf" : [ { + "$ref" : "#/components/schemas/LiabilityShift" + } ], + "x-ballerina-name-ignore" : "liabilityShift" + }, + "three_d_secure" : { + "allOf" : [ { + "$ref" : "#/components/schemas/ThreeDSecureAuthenticationResponse" + } ], + "x-ballerina-name-ignore" : "threeDSecure" + } + }, + "description" : "Results of Authentication such as 3D Secure" + }, + "USERACCOUNTCLOSED7" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED6" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID4" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for capture action; subscription status should be active or suspended or expired." ] + } + } + }, + "USERACCOUNTCLOSED9" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED8" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID1" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for suspend action; subscription status should be active." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID3" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for activate action; subscription status should be suspended." ] + } + } + }, + "SUBSCRIPTIONSTATUSINVALID2" : { + "title" : "SUBSCRIPTION_STATUS_INVALID", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_STATUS_INVALID" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Invalid subscription status for cancel action; subscription status should be active or suspended." ] + } + } + }, + "USERACCOUNTCLOSED1" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "ZEROOUTSTANDINGBALANCE" : { + "title" : "ZERO_OUTSTANDING_BALANCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "ZERO_OUTSTANDING_BALANCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Current outstanding balance should be greater than zero." ] + } + } + }, + "USERACCOUNTCLOSED3" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED2" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "3DSCARDSNOTSUPPORTED1" : { + "title" : "3DS_CARDS_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "3DS_CARDS_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Cards that require 3DS authentication not supported." ] + } + } + }, + "USERACCOUNTCLOSED" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED5" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "USERACCOUNTCLOSED4" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "SubscriptionReviseResponse" : { + "title" : "Update Product Quantity in Subscription Response", + "type" : "object", + "description" : "The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer's consent", + "allOf" : [ { + "$ref" : "#/components/schemas/SubscriptionReviseRequest" + }, { + "$ref" : "#/components/schemas/SubscriptionReviseResponseAllOf2" + } ] + }, + "SubscriptionsCancel422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscancel422Details" + } + } + } + }, + "InlineResponse422" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/UnprocessableEntity" + } ] + }, + "INVALIDPATCHPATH1" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Multiple operations on the same field are not allowed." ] + } + } + }, + "INVALIDPATCHPATH2" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified field cannot be patched." ] + } + } + }, + "INVALIDPATCHPATH3" : { + "title" : "INVALID_PATCH_PATH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PATCH_PATH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Multiple operations on the same field are not allowed." ] + } + } + }, + "SubscriptionsCapture400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture400Details" + } + } + } + }, + "TransactionAllOf2" : { + "properties" : { + "id" : { + "maxLength" : 50, + "minLength" : 3, + "type" : "string", + "description" : "The PayPal-generated transaction ID.", + "readOnly" : true + }, + "amount_with_breakdown" : { + "$ref" : "#/components/schemas/AmountWithBreakdown" + }, + "payer_name" : { + "$ref" : "#/components/schemas/Name" + }, + "payer_email" : { + "$ref" : "#/components/schemas/EmailAddress" + }, + "time" : { + "$ref" : "#/components/schemas/DateTime" + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "3DSCARDSNOTSUPPORTED" : { + "title" : "3DS_CARDS_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "3DS_CARDS_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Cards that require 3DS authentication not supported." ] + } + } + }, + "CaptureStatusDetails" : { + "title" : "Capture Status Details", + "type" : "object", + "properties" : { + "reason" : { + "type" : "string", + "description" : "The reason why the captured payment status is `PENDING` or `DENIED`", + "enum" : [ "BUYER_COMPLAINT", "CHARGEBACK", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "OTHER", "PENDING_REVIEW", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "REFUNDED", "TRANSACTION_APPROVED_AWAITING_FUNDING", "UNILATERAL", "VERIFICATION_REQUIRED" ] + } + }, + "description" : "The details of the captured payment status" + }, + "ErrorDefault" : { + "description" : "The default error response", + "oneOf" : [ { + "$ref" : "#/components/schemas/Error400" + }, { + "$ref" : "#/components/schemas/Error401" + }, { + "$ref" : "#/components/schemas/Error403" + }, { + "$ref" : "#/components/schemas/Error404" + }, { + "$ref" : "#/components/schemas/Error409" + }, { + "$ref" : "#/components/schemas/Error415" + }, { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/Error500" + }, { + "$ref" : "#/components/schemas/Error503" + } ] + }, + "MISSINGPRICINGSCHEMETIERS" : { + "title" : "MISSING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Tier(s) are missing for some quantities." ] + } + } + }, + "DateYearMonth" : { + "maxLength" : 7, + "minLength" : 7, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])$", + "type" : "string", + "description" : "The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6)" + }, + "Error422" : { + "title" : "Unprocessable Entity Error", + "type" : "object", + "properties" : { + "debug_id" : { + "type" : "string", + "description" : "The PayPal internal ID. Used for correlation purposes", + "x-ballerina-name-ignore" : "debugId" + }, + "name" : { + "type" : "string", + "enum" : [ "UNPROCESSABLE_ENTITY" ] + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetails" + } + }, + "links" : { + "maxItems" : 10000, + "minItems" : 0, + "type" : "array", + "description" : "An array of request-related [HATEOAS links](https://en.wikipedia.org/wiki/HATEOAS)", + "items" : { + "$ref" : "#/components/schemas/ErrorLinkDescription" + } + }, + "message" : { + "type" : "string", + "enum" : [ "The requested action could not be performed, semantically incorrect, or failed business validation." ] + } + }, + "description" : "The requested action cannot be performed and may require interaction with APIs or processes outside of the current request. This is distinct from a 500 response in that there are no systemic problems limiting the API from performing the request" + }, + "MISSINGREQUESTBODY" : { + "title" : "MISSING_REQUEST_BODY", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MISSING_REQUEST_BODY" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Request body is missing." ] + } + } + }, + "Subscriptionspatch422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED5" + }, { + "$ref" : "#/components/schemas/SUBSCRIPTIONSTATUSINVALID" + }, { + "$ref" : "#/components/schemas/CARDSUBSCRIPTIONSNOTENABLED1" + }, { + "$ref" : "#/components/schemas/3DSCARDSNOTSUPPORTED1" + }, { + "$ref" : "#/components/schemas/BILLINGCYCLEEXECUTIONCOMPLETED" + }, { + "$ref" : "#/components/schemas/AMOUNTGREATERTHANOUTSTANDINGBALANCE" + }, { + "$ref" : "#/components/schemas/INVALIDBILLINGTOTALCYCLES" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERAMOUNT3" + }, { + "$ref" : "#/components/schemas/MISSINGPRICINGSCHEMETIERS3" + }, { + "$ref" : "#/components/schemas/OVERLAPPINGPRICINGSCHEMETIERS3" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGMODEL3" + }, { + "$ref" : "#/components/schemas/FIXEDPRICENOTSUPPORTED3" + }, { + "$ref" : "#/components/schemas/INVALIDPRICINGTIERQUANTITY3" + }, { + "$ref" : "#/components/schemas/INVALIDSTARTTIME" + }, { + "$ref" : "#/components/schemas/CURRENCYMISMATCH3" + } ] + }, + "Payer" : { + "title" : "Customer", + "type" : "object", + "description" : "The customer who approves and pays for the order. The customer is also known as the payer", + "format" : "payer_v1", + "allOf" : [ { + "$ref" : "#/components/schemas/PayerBase" + }, { + "$ref" : "#/components/schemas/PayerAllOf2" + } ] + }, + "PlansActivate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Plansactivate422Details" + } + } + } + }, + "USERACCOUNTCLOSED10" : { + "title" : "USER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "USER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "User account locked or closed." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH1" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PlansDeactivate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Plansdeactivate422Details" + } + } + } + }, + "Subscriptionscreate400Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/INVALIDPARAMETERSYNTAX2" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE5" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMINVALUE1" + }, { + "$ref" : "#/components/schemas/INVALIDINTEGERMAXVALUE1" + }, { + "$ref" : "#/components/schemas/INVALIDPARAMETERVALUE6" + }, { + "$ref" : "#/components/schemas/MISSINGREQUESTBODY" + }, { + "$ref" : "#/components/schemas/MISSINGREQUIREDPARAMETER2" + }, { + "$ref" : "#/components/schemas/INVALIDSTRINGMAXLENGTH2" + } ] + }, + "PlansUpdatePricingSchemes400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PlansupdatePricingSchemes400Details" + } + } + } + }, + "SUBSCRIPTIONCANNOTBEACTIVATED" : { + "title" : "SUBSCRIPTION_CANNOT_BE_ACTIVATED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIPTION_CANNOT_BE_ACTIVATED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscription cannot be activated after payment failure threshold has reached." ] + } + } + }, + "SubscriptionSuspendRequest" : { + "title" : "Suspend Subscription", + "required" : [ "reason" ], + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason for suspenson of the subscription" + } + }, + "description" : "The suspend subscription request details" + }, + "AddressPortable" : { + "title" : "Portable Postal Address (Medium-Grained)", + "required" : [ "country_code" ], + "type" : "object", + "properties" : { + "country_code" : { + "allOf" : [ { + "$ref" : "#/components/schemas/CountryCode" + } ], + "x-ballerina-name-ignore" : "countryCode" + }, + "admin_area_1" : { + "maxLength" : 300, + "type" : "string", + "description" : "The highest level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision. Format for postal delivery. For example, `CA` and not `California`. Value, by country, is:
  • UK. A county.
  • US. A state.
  • Canada. A province.
  • Japan. A prefecture.
  • Switzerland. A kanton.
", + "x-ballerina-name-ignore" : "adminArea1" + }, + "address_line_1" : { + "maxLength" : 300, + "type" : "string", + "description" : "The first line of the address. For example, number or street. For example, `173 Drury Lane`. Required for data entry and compliance and risk checks. Must contain the full address", + "x-ballerina-name-ignore" : "addressLine1" + }, + "admin_area_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "A sub-locality, suburb, neighborhood, or district. Smaller than `admin_area_level_2`. Value is:
  • Brazil. Suburb, bairro, or neighborhood.
  • India. Sub-locality or district. Street name information is not always available but a sub-locality or district can be a very small area.
", + "x-ballerina-name-ignore" : "adminArea3" + }, + "address_details" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AddressDetails" + } ], + "x-ballerina-name-ignore" : "addressDetails" + }, + "admin_area_2" : { + "maxLength" : 120, + "type" : "string", + "description" : "A city, town, or village. Smaller than `admin_area_level_1`", + "x-ballerina-name-ignore" : "adminArea2" + }, + "address_line_3" : { + "maxLength" : 100, + "type" : "string", + "description" : "The third line of the address, if needed. For example, a street complement for Brazil, direction text, such as `next to Walmart`, or a landmark in an Indian address", + "x-ballerina-name-ignore" : "addressLine3" + }, + "address_line_2" : { + "maxLength" : 300, + "type" : "string", + "description" : "The second line of the address. For example, suite or apartment number", + "x-ballerina-name-ignore" : "addressLine2" + }, + "admin_area_4" : { + "maxLength" : 100, + "type" : "string", + "description" : "The neighborhood, ward, or district. Smaller than `admin_area_level_3` or `sub_locality`. Value is:
  • The postal sorting code for Guernsey and many French territories, such as French Guiana.
  • The fine-grained administrative levels in China.
", + "x-ballerina-name-ignore" : "adminArea4" + }, + "postal_code" : { + "maxLength" : 60, + "type" : "string", + "description" : "The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code)", + "x-ballerina-name-ignore" : "postalCode" + } + }, + "description" : "The portable international postal address. Maps to [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)" + }, + "INVALIDPRICINGMODEL" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "INVALIDPARAMETERVALUE" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "SubscriptionsSuspend422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionssuspend422Details" + } + } + } + }, + "SubscriptionsRevise404" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsrevise404Details" + } + } + } + }, + "SubscriptionsActivate400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsactivate400Details" + } + } + } + }, + "PhoneType" : { + "title" : "Phone Type", + "type" : "string", + "description" : "The phone type", + "enum" : [ "FAX", "HOME", "MOBILE", "OTHER", "PAGER" ] + }, + "Taxes" : { + "title" : "Taxes", + "required" : [ "percentage" ], + "type" : "object", + "properties" : { + "inclusive" : { + "type" : "boolean", + "description" : "Indicates whether the tax was already included in the billing amount", + "default" : true + }, + "percentage" : { + "$ref" : "#/components/schemas/Percentage" + } + }, + "description" : "The tax details" + }, + "Transaction" : { + "title" : "Transaction Details", + "required" : [ "amount_with_breakdown", "id", "time" ], + "type" : "object", + "description" : "The transaction details", + "allOf" : [ { + "$ref" : "#/components/schemas/CaptureStatus" + }, { + "$ref" : "#/components/schemas/TransactionAllOf2" + } ] + }, + "INVALIDSTRINGMAXLENGTH7" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PaymentMethod" : { + "title" : "Payment Method", + "type" : "object", + "properties" : { + "payer_selected" : { + "minLength" : 1, + "pattern" : "^[0-9A-Z_]+$", + "type" : "string", + "description" : "The customer-selected payment method on the merchant site", + "default" : "PAYPAL", + "x-ballerina-name-ignore" : "payerSelected" + }, + "payee_preferred" : { + "allOf" : [ { + "$ref" : "#/components/schemas/PayeePaymentMethodPreference" + } ], + "x-ballerina-name-ignore" : "payeePreferred" + }, + "standard_entry_class_code" : { + "maxLength" : 255, + "minLength" : 3, + "type" : "string", + "description" : "NACHA (the regulatory body governing the ACH network) requires that API callers (merchants, partners) obtain the consumer’s explicit authorization before initiating a transaction. To stay compliant, you’ll need to make sure that you retain a compliant authorization for each transaction that you originate to the ACH Network using this API. ACH transactions are categorized (using SEC codes) by how you capture authorization from the Receiver (the person whose bank account is being debited or credited). PayPal supports the following SEC codes", + "default" : "WEB", + "enum" : [ "TEL", "WEB", "CCD", "PPD" ], + "x-ballerina-name-ignore" : "standardEntryClassCode" + } + }, + "description" : "The customer and merchant payment preferences" + }, + "INVALIDSTRINGMAXLENGTH6" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH3" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH2" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "SubscriptionsRevise400" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsrevise400Details" + } + } + } + }, + "INVALIDSTRINGMAXLENGTH5" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "INVALIDSTRINGMAXLENGTH4" : { + "title" : "INVALID_STRING_MAX_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MAX_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too long." ] + } + } + }, + "PERMISSIONDENIED" : { + "title" : "PERMISSION_DENIED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "PERMISSION_DENIED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "You do not have permission to access or perform operations on this resource." ] + } + } + }, + "INVALIDPRICINGSCHEME1" : { + "title" : "INVALID_PRICING_SCHEME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_SCHEME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The override plan pricing scheme should be of the same type as that of the original plan." ] + } + } + }, + "ErrorLinkDescription" : { + "title" : "Link Description", + "required" : [ "href", "rel" ], + "type" : "object", + "properties" : { + "method" : { + "maxLength" : 6, + "minLength" : 3, + "pattern" : "^[A-Z]*$", + "type" : "string", + "description" : "The HTTP method required to make the related call", + "enum" : [ "GET", "POST", "PUT", "DELETE", "PATCH" ] + }, + "rel" : { + "maxLength" : 100, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml)" + }, + "href" : { + "maxLength" : 20000, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string", + "description" : "The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call" + } + }, + "description" : "The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information" + }, + "OVERLAPPINGPRICINGSCHEMETIERS3" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "INVALIDPRICINGSCHEME2" : { + "title" : "INVALID_PRICING_SCHEME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_SCHEME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The override plan pricing scheme should be of the same type as that of the original plan." ] + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS4" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS1" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "OVERLAPPINGPRICINGSCHEMETIERS2" : { + "title" : "OVERLAPPING_PRICING_SCHEME_TIERS", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "OVERLAPPING_PRICING_SCHEME_TIERS" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified quantity overlaps with multiple pricing tiers." ] + } + } + }, + "Plansdeactivate422Details" : { + "anyOf" : [ { + "$ref" : "#/components/schemas/USERACCOUNTCLOSED3" + }, { + "$ref" : "#/components/schemas/PLANSTATUSINVALID1" + } ] + }, + "SubscriptionsCapture422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionscapture422Details" + } + } + } + }, + "TaxesOverride" : { + "title" : "Taxes Override", + "type" : "object", + "properties" : { + "inclusive" : { + "type" : "boolean", + "description" : "Indicates whether the tax was already included in the billing amount" + }, + "percentage" : { + "$ref" : "#/components/schemas/Percentage" + } + }, + "description" : "The tax details" + }, + "INVALIDPARAMETERVALUE2" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE1" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDBILLINGCYCLESEQUENCE" : { + "title" : "INVALID_BILLING_CYCLE_SEQUENCE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_BILLING_CYCLE_SEQUENCE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Billing cycle sequence should start with `1` and be consecutive." ] + } + } + }, + "INVALIDPARAMETERVALUE6" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Start time must be a valid future date and time." ] + } + } + }, + "INVALIDPARAMETERVALUE5" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "Phone" : { + "title" : "Phone", + "required" : [ "country_code", "national_number" ], + "type" : "object", + "properties" : { + "country_code" : { + "maxLength" : 3, + "minLength" : 1, + "pattern" : "^[0-9]{1,3}?$", + "type" : "string", + "description" : "The country calling code (CC), in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", + "x-ballerina-name-ignore" : "countryCode" + }, + "extension_number" : { + "maxLength" : 15, + "minLength" : 1, + "pattern" : "^[0-9]{1,15}?$", + "type" : "string", + "description" : "The extension number", + "x-ballerina-name-ignore" : "extensionNumber" + }, + "national_number" : { + "maxLength" : 14, + "minLength" : 1, + "pattern" : "^[0-9]{1,14}?$", + "type" : "string", + "description" : "The national number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en). The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN)", + "x-ballerina-name-ignore" : "nationalNumber" + } + }, + "description" : "The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en)" + }, + "INVALIDPARAMETERVALUE4" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE3" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The field is not eligible for '$value' patch operation." ] + } + } + }, + "INVALIDPARAMETERVALUE9" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE8" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "INVALIDPARAMETERVALUE7" : { + "title" : "INVALID_PARAMETER_VALUE", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PARAMETER_VALUE" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is invalid." ] + } + } + }, + "CountryCode" : { + "maxLength" : 2, + "minLength" : 2, + "pattern" : "^([A-Z]{2}|C2)$", + "type" : "string", + "description" : "The [two-character ISO 3166-1 code](/docs/integration/direct/rest/country-codes/) that identifies the country or region.
Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the `C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.
", + "format" : "ppaas_common_country_code_v2" + }, + "UNSUPPORTEDPATCHOPERATION" : { + "title" : "UNSUPPORTED_PATCH_OPERATION", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "UNSUPPORTED_PATCH_OPERATION" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified patch operation not supported for this field." ] + } + } + }, + "INVALIDPRICINGMODEL2" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "INVALIDPRICINGMODEL3" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "INVALIDPRICINGMODEL4" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "MORETHANTWOTRIALBILLINGCYCLENOTSUPPORTED" : { + "title" : "MORE_THAN_TWO_TRIAL_BILLING_CYCLE_NOT_SUPPORTED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "MORE_THAN_TWO_TRIAL_BILLING_CYCLE_NOT_SUPPORTED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Only two trial billing cycles are allowed." ] + } + } + }, + "INVALIDPRICINGMODEL1" : { + "title" : "INVALID_PRICING_MODEL", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_PRICING_MODEL" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The specified pricing model is not supported for trial billing cycle." ] + } + } + }, + "SubscriptionCaptureRequest" : { + "title" : "Charge Amount from Subscriber", + "required" : [ "amount", "capture_type", "note" ], + "type" : "object", + "properties" : { + "note" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason or note for the subscription charge" + }, + "amount" : { + "$ref" : "#/components/schemas/Money" + }, + "capture_type" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The type of capture", + "enum" : [ "OUTSTANDING_BALANCE" ], + "x-ballerina-name-ignore" : "captureType" + } + }, + "description" : "The charge amount from the subscriber" + }, + "CardResponseWithBillingAddressAllOf2" : { + "properties" : { + "name" : { + "maxLength" : 300, + "minLength" : 2, + "type" : "string", + "description" : "The card holder's name as it appears on the card." + }, + "billing_address" : { + "$ref" : "#/components/schemas/AddressPortable" + }, + "expiry" : { + "$ref" : "#/components/schemas/DateYearMonth" + }, + "currency_code" : { + "$ref" : "#/components/schemas/CurrencyCode" + } + } + }, + "SUBSCRIBERACCOUNTCLOSED" : { + "title" : "SUBSCRIBER_ACCOUNT_CLOSED", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "SUBSCRIBER_ACCOUNT_CLOSED" ] + }, + "description" : { + "type" : "string", + "enum" : [ "Subscriber Account Closed." ] + } + } + }, + "SubscriptionsActivate422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsactivate422Details" + } + } + } + }, + "INVALIDSTARTTIME" : { + "title" : "INVALID_START_TIME", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_START_TIME" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The start time cannot be updated for a subscription that has been activated." ] + } + } + }, + "SubscriptionStatus" : { + "title" : "Subscription Status", + "type" : "object", + "properties" : { + "status_change_note" : { + "maxLength" : 128, + "minLength" : 1, + "type" : "string", + "description" : "The reason or notes for the status of the subscription", + "x-ballerina-name-ignore" : "statusChangeNote" + }, + "status" : { + "maxLength" : 24, + "minLength" : 1, + "pattern" : "^[A-Z_]+$", + "type" : "string", + "description" : "The status of the subscription", + "enum" : [ "APPROVAL_PENDING", "APPROVED", "ACTIVE", "SUSPENDED", "CANCELLED", "EXPIRED" ] + }, + "status_update_time" : { + "allOf" : [ { + "$ref" : "#/components/schemas/DateTime" + } ], + "x-ballerina-name-ignore" : "statusUpdateTime" + } + }, + "description" : "The subscription status details" + }, + "InlineResponse4221" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansPatch422" + } ] + }, + "INVALIDSTRINGMINLENGTH" : { + "title" : "INVALID_STRING_MIN_LENGTH", + "properties" : { + "issue" : { + "type" : "string", + "enum" : [ "INVALID_STRING_MIN_LENGTH" ] + }, + "description" : { + "type" : "string", + "enum" : [ "The value of a field is too short." ] + } + } + }, + "InlineResponse4224" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansUpdatePricingSchemes422" + } ] + }, + "InlineResponse4225" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsCreate422" + } ] + }, + "InlineResponse4222" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansActivate422" + } ] + }, + "InlineResponse4223" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/PlansDeactivate422" + } ] + }, + "InlineResponse4228" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsSuspend422" + } ] + }, + "SubscriptionsRevise422" : { + "properties" : { + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Subscriptionsrevise422Details" + } + } + } + }, + "InlineResponse4229" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsCancel422" + } ] + }, + "InlineResponse4226" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsPatch422" + } ] + }, + "InlineResponse4227" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Error422" + }, { + "$ref" : "#/components/schemas/SubscriptionsRevise422" + } ] + } + }, + "responses" : { + "default" : { + "description" : "The default response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorDefault" + } + } + } + } + }, + "parameters" : { + "prefer" : { + "name" : "Prefer", + "in" : "header", + "description" : "The preferred server response upon successful completion of the request. Value is:
  • return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.
  • return=representation. The server returns a complete resource representation, including the current state of the resource.
", + "required" : false, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string", + "default" : "return=minimal" + }, + "x-ballerina-name-ignore" : "prefer" + }, + "paypal_request_id" : { + "name" : "PayPal-Request-Id", + "in" : "header", + "description" : "The server stores keys for 72 hours", + "required" : false, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + }, + "x-ballerina-name-ignore" : "payPalRequestId" + }, + "product_id" : { + "name" : "product_id", + "in" : "query", + "description" : "Filters the response by a Product ID", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 50, + "minLength" : 6, + "type" : "string" + }, + "x-ballerina-name-ignore" : "productId" + }, + "plan_ids" : { + "name" : "plan_ids", + "in" : "query", + "description" : "Filters the response by list of plan IDs. Filter supports upto 10 plan IDs", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maximum" : 270, + "minimum" : 3, + "type" : "string" + }, + "x-ballerina-name-ignore" : "planIds" + }, + "page_size" : { + "name" : "page_size", + "in" : "query", + "description" : "The number of items to return in the response", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maximum" : 20, + "minimum" : 1, + "type" : "integer", + "default" : 10 + }, + "x-ballerina-name-ignore" : "pageSize" + }, + "page" : { + "name" : "page", + "in" : "query", + "description" : "A non-zero integer which is the start index of the entire list of items to return in the response. The combination of `page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maximum" : 100000, + "minimum" : 1, + "type" : "integer", + "default" : 1 + } + }, + "total_required" : { + "name" : "total_required", + "in" : "query", + "description" : "Indicates whether to show the total count in the response", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "boolean", + "default" : false + }, + "x-ballerina-name-ignore" : "totalRequired" + }, + "id" : { + "name" : "id", + "in" : "path", + "description" : "The ID of the subscription", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, + "fields" : { + "name" : "fields", + "in" : "query", + "description" : "List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 100, + "minLength" : 1, + "type" : "string" + } + }, + "start_time" : { + "name" : "start_time", + "in" : "query", + "description" : "The start time of the range of transactions to list", + "required" : true, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "format" : "ppaas_date_time_v3" + }, + "x-ballerina-name-ignore" : "startTime" + }, + "end_time" : { + "name" : "end_time", + "in" : "query", + "description" : "The end time of the range of transactions to list", + "required" : true, + "style" : "form", + "explode" : true, + "schema" : { + "maxLength" : 64, + "minLength" : 20, + "pattern" : "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$", + "type" : "string", + "format" : "ppaas_date_time_v3" + }, + "x-ballerina-name-ignore" : "endTime" + } + }, + "requestBodies" : { + "patch_request" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PatchRequest" + } + } + } + } + }, + "securitySchemes" : { + "Oauth2" : { + "type" : "oauth2", + "description" : "Oauth 2.0 authentication", + "flows" : { + "clientCredentials" : { + "tokenUrl" : "https://api-m.sandbox.paypal.com/v1/oauth2/token", + "scopes" : { + "https://uri.paypal.com/services/subscriptions" : "Manage plan & subscription" + } + } + } + } + } + } +} diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index a2776b9..14713c4 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -1,24 +1,204 @@ -_Author_: \ -_Created_: \ -_Updated_: \ +_Author_: @RNViththagan \ +_Created_: 13 June 2025 \ +_Updated_: 26 June 2025 \ _Edition_: Swan Lake -# Sanitation for OpenAPI specification +# Sanitations for the OpenAPI specification -This document records the sanitation done on top of the official OpenAPI specification from Paypal Subscriptions. -The OpenAPI specification is obtained from (TODO: Add source link). -These changes are done in order to improve the overall usability, and as workarounds for some known language limitations. +This document outlines the manual sanitizations applied to the PayPal Subscriptions OpenAPI specification. The official specification is initially retrieved from [PayPal's official GitHub repository](https://github.com/paypal/paypal-rest-api-specifications/blob/main/openapi/billing_subscriptions_v1.json). After being flattened and aligned by the Ballerina OpenAPI tool, these manual modifications are implemented to improve the developer experience and to circumvent certain language and tool limitations. -[//]: # (TODO: Add sanitation details) -1. -2. -3. +## 1. Update OAuth2 token URL to relative URL -## OpenAPI cli command +**Location**: `components.securitySchemes.Oauth2.flows.clientCredentials.tokenUrl` + +**Original**: `"tokenUrl": "/v1/oauth2/token"` + +**Sanitized**: `"tokenUrl": "https://api-m.sandbox.paypal.com/v1/oauth2/token"` + +```diff +- "tokenUrl": "/v1/oauth2/token" ++ "tokenUrl": "https://api-m.sandbox.paypal.com/v1/oauth2/token" +``` + +**Reason**: The relative path does not resolve correctly against the OAuth2 endpoint. + +## 2. Fix invalid generated schema names with apostrophe + +**Original**: + +```json +"Schema'400": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/400Details" + } + } + } +}, +"Schema'401": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/401Details" + } + } + } +} +``` + +```json +"InlineResponse400": { + "allOf": [ + { + "$ref": "#/components/schemas/Error400" + }, + { + "$ref": "#/components/schemas/Schema'400" + } + ] +}, +"InlineResponse401": { + "allOf": [ + { + "$ref": "#/components/schemas/Error401" + }, + { + "$ref": "#/components/schemas/Schema'401" + } + ] +} +``` + +**Sanitized**: + +```json +"BadRequest": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/400Details" + } + } + } +}, +"Unauthorized": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/401Details" + } + } + } +} +``` + +```json +"InlineResponse400": { + "allOf": [ + { + "$ref": "#/components/schemas/Error400" + }, + { + "$ref": "#/components/schemas/BadRequest" + } + ] +}, +"InlineResponse401": { + "allOf": [ + { + "$ref": "#/components/schemas/Error401" + }, + { + "$ref": "#/components/schemas/Unauthorized" + } + ] +} +``` + +```diff +- "Schema'400": { ++ "BadRequest": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/400Details" + } + } + } +}, +- "Schema'401": { ++ "Unauthorized": { + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/401Details" + } + } + } +} +``` + +```diff +"InlineResponse400": { + "allOf": [ + { + "$ref": "#/components/schemas/Error400" + }, + { +- "$ref": "#/components/schemas/Schema'400" ++ "$ref": "#/components/schemas/BadRequest" + } + ] +}, +"InlineResponse401": { + "allOf": [ + { + "$ref": "#/components/schemas/Error401" + }, + { +- "$ref": "#/components/schemas/Schema'401" ++ "$ref": "#/components/schemas/Unauthorized" + } + ] +} +``` + +**Reason**: Apostrophes in schema names generate invalid JSON Schema; plain identifiers prevent generator errors. + +**Reason**: JSON keys with apostrophes (e.g., `Schema'404`) are invalid and break schema parsing; using plain, descriptive identifiers (e.g., `NotFound`) ensures valid JSON Schema and prevents generator errors. See GitHub issue [#8011](https://github.com/ballerina-platform/ballerina-library/issues/8011) for details. + +## 3. Avoid property name sanitisation to avoid data-binding error which is caused by a language limitation + +**Original**: + +```json +"x-ballerina-name": "billingCycleSequence" +``` + +**Sanitized**: + +```json +"x-ballerina-name-ignore": "billingCycleSequence" +``` + +```diff +- "x-ballerina-name": "billingCycleSequence" ++ "x-ballerina-name-ignore": "billingCycleSequence" +``` + +**Reason**: Due to issue [#38535](https://github.com/ballerina-platform/ballerina-lang/issues/38535); the data binding fails for the fields which have JSON data name annotations. Above change will avoid adding this annotations to the fields. + +## OpenAPI CLI command The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory. ```bash -# TODO: Add OpenAPI CLI command used to generate the client +bal openapi -i docs/spec/openapi.json --mode client --license docs/license.txt -o ballerina ``` -Note: The license year is hardcoded to 2024, change if necessary. diff --git a/gradle.properties b/gradle.properties index e0fa520..31465cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ group=io.ballerina.lib version=1.0.0-SNAPSHOT releasePluginVersion=2.8.0 -ballerinaGradlePluginVersion=2.2.4 +ballerinaGradlePluginVersion=2.3.0 ballerinaLangVersion=2201.12.0