A list of all methods in the Subscriptions
service. Click on the method name to view detailed information about that method.
Methods | Description |
---|---|
list_subscriptions | |
create_subscription_handler | |
get_subscription_handler | |
patch_subscription |
- HTTP Method:
GET
- Endpoint:
/subscriptions
Parameters
Name | Type | Required | Description |
---|---|---|---|
$createdAtGte | string | ❌ | Get events after this created time |
$createdAtLte | string | ❌ | Get events created before this time |
$pageSize | int | ❌ | Page size default is 10 max is 100 |
$pageNumber | int | ❌ | Page number default is 0 |
$customerId | string | ❌ | Filter by customer id |
$status | Models\SubscriptionStatus | ❌ | Filter by status |
Return Type
Models\GetSubscriptionsListResponse
Example Usage Code Snippet
<?php
use Dodopayments\Client;
$sdk = new Client(accessToken: 'YOUR_TOKEN');
$status = Models\SubscriptionStatus::Pending;
$response = $sdk->subscriptions->listSubscriptions(
createdAtGte: "created_at_gte",
createdAtLte: "created_at_lte",
pageSize: 1,
pageNumber: 4,
customerId: "customer_id",
status: $status
);
print_r($response);
- HTTP Method:
POST
- Endpoint:
/subscriptions
Parameters
Name | Type | Required | Description |
---|---|---|---|
input | Models\CreateSubscriptionRequest | ✅ |
Return Type
Models\CreateSubscriptionResponse
Example Usage Code Snippet
<?php
use Dodopayments\Client;
use Dodopayments\Models\BillingAddress;
use Dodopayments\Models\CustomerRequest;
use Dodopayments\Models\CreateSubscriptionRequest;
$sdk = new Client(accessToken: 'YOUR_TOKEN');
$countryCodeAlpha2 = Models\CountryCodeAlpha2::Af;
$billingAddress = new Models\BillingAddress(
city: "city",
country: $countryCodeAlpha2,
state: "state",
street: "street",
zipcode: "zipcode"
);
COMPLEX_MODEL_NOT_IMPLEMENTED
$input = new Models\CreateSubscriptionRequest(
billing: $billingAddress,
customer: $customerRequest,
metadata: [],
paymentLink: true,
productId: "product_id",
quantity: 9,
returnUrl: "return_url",
trialPeriodDays: 1
);
$response = $sdk->subscriptions->createSubscriptionHandler(
input: $input
);
print_r($response);
- HTTP Method:
GET
- Endpoint:
/subscriptions/{subscription_id}
Parameters
Name | Type | Required | Description |
---|---|---|---|
$subscriptionId | string | ✅ | Subscription Id |
Return Type
Models\SubscriptionResponse
Example Usage Code Snippet
<?php
use Dodopayments\Client;
$sdk = new Client(accessToken: 'YOUR_TOKEN');
$response = $sdk->subscriptions->getSubscriptionHandler(
subscriptionId: "subscription_id"
);
print_r($response);
- HTTP Method:
PATCH
- Endpoint:
/subscriptions/{subscription_id}
Parameters
Name | Type | Required | Description |
---|---|---|---|
input | Models\PatchSubscriptionRequest | ✅ | |
$subscriptionId | string | ✅ | Subscription Id |
Return Type
Models\SubscriptionResponse
Example Usage Code Snippet
<?php
use Dodopayments\Client;
use Dodopayments\Models\SubscriptionStatus;
use Dodopayments\Models\PatchSubscriptionRequest;
$sdk = new Client(accessToken: 'YOUR_TOKEN');
$input = new Models\PatchSubscriptionRequest(
metadata: [],
status: $subscriptionStatus
);
$response = $sdk->subscriptions->patchSubscription(
input: $input,
subscriptionId: "subscription_id"
);
print_r($response);