Use the /subscriptions resource to create, update, retrieve, and cancel subscriptions and their associated plans.
SubscriptionsController subscriptionsController = client.getSubscriptionsController();SubscriptionsController
- Create Billing Plan
- List Billing Plans
- Get Billing Plan
- Patch Billing Plan
- Activate Billing Plan
- Deactivate Billing Plan
- Update Billing Plan Pricing Schemes
- Create Subscription
- List Subscriptions
- Get Subscription
- Patch Subscription
- Revise Subscription
- Suspend Subscription
- Cancel Subscription
- Activate Subscription
- Capture Subscription
- List Subscription Transactions
Creates a plan that defines pricing and billing cycle details for subscriptions.
CompletableFuture<ApiResponse<BillingPlan>> createBillingPlanAsync(
final CreateBillingPlanInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
CreateBillingPlanInput |
Required | Input structure for the method CreateBillingPlanAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows billing plan details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type BillingPlan.
CreateBillingPlanInput createBillingPlanInput = new CreateBillingPlanInput.Builder(
null
)
.prefer("return=minimal")
.body(new PlanRequest.Builder(
"product_id2",
"name6",
Arrays.asList(
new SubscriptionBillingCycle.Builder(
new Frequency.Builder(
IntervalUnit.DAY
)
.intervalCount(1)
.build(),
TenureType.REGULAR,
8
)
.totalCycles(1)
.build()
),
new PaymentPreferences.Builder()
.autoBillOutstanding(true)
.setupFeeFailureAction(SetupFeeFailureAction.CANCEL)
.paymentFailureThreshold(0)
.build()
)
.status(PlanRequestStatus.ACTIVE)
.quantitySupported(false)
.build())
.build();
subscriptionsController.createBillingPlanAsync(createBillingPlanInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Lists billing plans.
CompletableFuture<ApiResponse<PlanCollection>> listBillingPlansAsync(
final ListBillingPlansInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
ListBillingPlansInput |
Required | Input structure for the method ListBillingPlansAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that lists billing plans.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type PlanCollection.
ListBillingPlansInput listBillingPlansInput = new ListBillingPlansInput.Builder()
.prefer("return=minimal")
.pageSize(10)
.page(1)
.totalRequired(false)
.build();
subscriptionsController.listBillingPlansAsync(listBillingPlansInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Shows details for a plan, by ID.
CompletableFuture<ApiResponse<BillingPlan>> getBillingPlanAsync(
final String id)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
id |
String |
Template, Required | The ID of the plan. |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows plan details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type BillingPlan.
String id = "id0";
subscriptionsController.getBillingPlanAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
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 object Operations description replace payment_preferences.auto_bill_outstanding replace taxes.percentage replace payment_preferences.payment_failure_threshold replace payment_preferences.setup_fee replace payment_preferences.setup_fee_failure_action replace name replace
CompletableFuture<ApiResponse<Void>> patchBillingPlanAsync(
final PatchBillingPlanInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
PatchBillingPlanInput |
Required | Input structure for the method PatchBillingPlanAsync |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
PatchBillingPlanInput patchBillingPlanInput = new PatchBillingPlanInput.Builder(
"id0",
null
)
.body(Arrays.asList(
new Patch.Builder(
PatchOp.ADD
)
.build()
))
.build();
subscriptionsController.patchBillingPlanAsync(patchBillingPlanInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Activates a plan, by ID.
CompletableFuture<ApiResponse<Void>> activateBillingPlanAsync(
final String id)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
id |
String |
Template, Required | The ID of the plan. |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
String id = "id0";
subscriptionsController.activateBillingPlanAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Deactivates a plan, by ID.
CompletableFuture<ApiResponse<Void>> deactivateBillingPlanAsync(
final String id)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
id |
String |
Template, Required | The ID of the plan. |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
String id = "id0";
subscriptionsController.deactivateBillingPlanAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Updates pricing for a plan. For example, you can update a regular billing cycle from $5 per month to $7 per month.
CompletableFuture<ApiResponse<Void>> updateBillingPlanPricingSchemesAsync(
final UpdateBillingPlanPricingSchemesInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
UpdateBillingPlanPricingSchemesInput |
Required | Input structure for the method UpdateBillingPlanPricingSchemesAsync |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
UpdateBillingPlanPricingSchemesInput updateBillingPlanPricingSchemesInput = new UpdateBillingPlanPricingSchemesInput.Builder(
"id0",
null
)
.body(new UpdatePricingSchemesRequest.Builder(
Arrays.asList(
new UpdatePricingScheme.Builder(
34,
new SubscriptionPricingScheme.Builder()
.build()
)
.build()
)
)
.build())
.build();
subscriptionsController.updateBillingPlanPricingSchemesAsync(updateBillingPlanPricingSchemesInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Creates a subscription.
CompletableFuture<ApiResponse<Subscription>> createSubscriptionAsync(
final CreateSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
CreateSubscriptionInput |
Required | Input structure for the method CreateSubscriptionAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows subscription details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type Subscription.
CreateSubscriptionInput createSubscriptionInput = new CreateSubscriptionInput.Builder(
null
)
.prefer("return=minimal")
.body(new CreateSubscriptionRequest.Builder(
"plan_id8"
)
.autoRenewal(false)
.build())
.build();
subscriptionsController.createSubscriptionAsync(createSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
List all subscriptions for merchant account.
CompletableFuture<ApiResponse<SubscriptionCollection>> listSubscriptionsAsync(
final ListSubscriptionsInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
ListSubscriptionsInput |
Required | Input structure for the method ListSubscriptionsAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that lists the subscriptions.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type SubscriptionCollection.
ListSubscriptionsInput listSubscriptionsInput = new ListSubscriptionsInput.Builder()
.pageSize(10)
.page(1)
.build();
subscriptionsController.listSubscriptionsAsync(listSubscriptionsInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Shows details for a subscription, by ID.
CompletableFuture<ApiResponse<Subscription>> getSubscriptionAsync(
final GetSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
GetSubscriptionInput |
Required | Input structure for the method GetSubscriptionAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows subscription details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type Subscription.
GetSubscriptionInput getSubscriptionInput = new GetSubscriptionInput.Builder(
"id0"
)
.build();
subscriptionsController.getSubscriptionAsync(getSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
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 object Operations billing_info.outstanding_balance replace custom_id add,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.inclusive add,replace plan.taxes.percentage add,replace shipping_amount add,replace start_time replace subscriber.shipping_address add,replace subscriber.payment_source (for subscriptions funded by card payments) replace
CompletableFuture<ApiResponse<Void>> patchSubscriptionAsync(
final PatchSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
PatchSubscriptionInput |
Required | Input structure for the method PatchSubscriptionAsync |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
PatchSubscriptionInput patchSubscriptionInput = new PatchSubscriptionInput.Builder(
"id0",
null
)
.body(Arrays.asList(
new Patch.Builder(
PatchOp.ADD
)
.build()
))
.build();
subscriptionsController.patchSubscriptionAsync(patchSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
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.
CompletableFuture<ApiResponse<ModifySubscriptionResponse>> reviseSubscriptionAsync(
final ReviseSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
ReviseSubscriptionInput |
Required | Input structure for the method ReviseSubscriptionAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows subscription details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type ModifySubscriptionResponse.
ReviseSubscriptionInput reviseSubscriptionInput = new ReviseSubscriptionInput.Builder(
"id0",
null
)
.build();
subscriptionsController.reviseSubscriptionAsync(reviseSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Suspends the subscription.
CompletableFuture<ApiResponse<Void>> suspendSubscriptionAsync(
final SuspendSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
SuspendSubscriptionInput |
Required | Input structure for the method SuspendSubscriptionAsync |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
SuspendSubscriptionInput suspendSubscriptionInput = new SuspendSubscriptionInput.Builder(
"id0",
null
)
.build();
subscriptionsController.suspendSubscriptionAsync(suspendSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Cancels the subscription.
CompletableFuture<ApiResponse<Void>> cancelSubscriptionAsync(
final CancelSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
CancelSubscriptionInput |
Required | Input structure for the method CancelSubscriptionAsync |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
CancelSubscriptionInput cancelSubscriptionInput = new CancelSubscriptionInput.Builder(
"id0",
null
)
.build();
subscriptionsController.cancelSubscriptionAsync(cancelSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Activates the subscription.
CompletableFuture<ApiResponse<Void>> activateSubscriptionAsync(
final ActivateSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
ActivateSubscriptionInput |
Required | Input structure for the method ActivateSubscriptionAsync |
204: A successful request returns the HTTP 204 No Content status code with no JSON response body.
void
ActivateSubscriptionInput activateSubscriptionInput = new ActivateSubscriptionInput.Builder(
"id0",
null
)
.build();
subscriptionsController.activateSubscriptionAsync(activateSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Captures an authorized payment from the subscriber on the subscription.
CompletableFuture<ApiResponse<SubscriptionTransactionDetails>> captureSubscriptionAsync(
final CaptureSubscriptionInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
CaptureSubscriptionInput |
Required | Input structure for the method CaptureSubscriptionAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows subscription details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type SubscriptionTransactionDetails.
CaptureSubscriptionInput captureSubscriptionInput = new CaptureSubscriptionInput.Builder(
"id0",
null
)
.build();
subscriptionsController.captureSubscriptionAsync(captureSubscriptionInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 422 | The requested action could not be performed, semantically incorrect, or failed business validation. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |
Lists transactions for a subscription.
CompletableFuture<ApiResponse<TransactionsList>> listSubscriptionTransactionsAsync(
final ListSubscriptionTransactionsInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
ListSubscriptionTransactionsInput |
Required | Input structure for the method ListSubscriptionTransactionsAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows subscription details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type TransactionsList.
ListSubscriptionTransactionsInput listSubscriptionTransactionsInput = new ListSubscriptionTransactionsInput.Builder(
"id0",
"start_time6",
"end_time2"
)
.build();
subscriptionsController.listSubscriptionTransactionsAsync(listSubscriptionTransactionsInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof SubscriptionErrorException) {
SubscriptionErrorException subscriptionErrorException = (SubscriptionErrorException) cause;
subscriptionErrorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | Bad Request. Request is not well-formed, syntactically incorrect, or violates schema. | SubscriptionErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | SubscriptionErrorException |
| 403 | Authorization failed due to insufficient permissions. | SubscriptionErrorException |
| 404 | The specified resource does not exist. | SubscriptionErrorException |
| 500 | An internal server error has occurred. | SubscriptionErrorException |
| Default | The error response. | SubscriptionErrorException |