Get subscription¶
GET
https://api.mollie.com/v2/customers/*customerId*/subscriptions/*id*
Retrieve a subscription by its ID and its customer’s ID.
Parameters¶
Replace customerId
in the endpoint URL by the customer’s ID, and replace id
by the subscription’s ID. For
example /v2/customers/cst_8wmqcHMN4U/subscriptions/sub_rVKGtNd6s3
.
Access token parameters¶
If you are using organization access tokens or are creating an
OAuth app, you can enable test mode through the testmode
query string parameter.
true
to retrieve a test mode subscription.Response¶
200
application/hal+json
resource
stringsubscription
for this endpoint.id
stringsub_rVKGtNd6s3
.mode
stringThe mode used to create this subscription. Mode determines whether the subscription’s payments are real or test payments.
Possible values: live
test
createdAt
datetimestatus
stringThe subscription’s current status, depends on whether the customer has a pending, valid or invalid mandate.
Possible values: pending
active
canceled
suspended
completed
amount
amount objectThe constant amount that is charged with each subscription payment, e.g. {"currency":"EUR", "value":"10.00"}
for
a €10.00 subscription.
currency
stringvalue
stringtimes
integertimesRemaining
integerinterval
stringInterval to wait between charges, for example 1 month
or 14 days
.
Possible values: ... months
... weeks
... days
startDate
dateYYYY-MM-DD
format.nextPaymentDate
dateoptionalYYYY-MM-DD
format. When there will be no next payment, for example when
the subscription has ended, this parameter will not be returned.description
stringmethod
stringThe payment method used for this subscription, either forced on creation or null
if any of the customer’s valid
mandates may be used.
Possible values: creditcard
directdebit
paypal
null
mandateId
stringoptionalcanceledAt
datetimewebhookUrl
stringmetadata
mixedapplicationFee
objectoptionalThe application fee, if the subscription was created with one. This will be applied on each payment created for the subscription.
amount
decimaldescription
string_links
objectAn object with several URL objects relevant to the subscription. Every URL object will contain an href
and a
type
field.
self
URL objectcustomer
URL objectprofile
URL objectoptionalpayments
URL objectoptionaldocumentation
URL objectExample¶
1 2 | curl -X GET https://api.mollie.com/v2/customers/cst_stTC2WHAuS/subscriptions/sub_rVKGtNd6s3 \ -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" |
1 2 3 4 5 6 | <?php $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"); $customer = $mollie->customers->get("cst_stTC2WHAuS"); $subscription = $customer->getSubscription("sub_rVKGtNd6s3"); |
1 2 3 4 5 6 7 | from mollie.api.client import Client mollie_client = Client() mollie_client.set_api_key("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM") customer = mollie_client.customers.get("cst_stTC2WHAuS") subscription = customer.subscriptions.get("sub_rVKGtNd6s3") |
1 2 3 4 5 6 7 8 9 10 | require 'mollie-api-ruby' Mollie::Client.configure do |config| config.api_key = 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' end subscription = Mollie::Customer::Subscription.get( 'sub_rVKGtNd6s3', customer_id: 'cst_stTC2WHAuS' ) |
1 2 3 4 | const { createMollieClient } = require('@mollie/api-client'); const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' }); const subscriptions = mollieClient.customerSubscriptions.iterate({ customerId: 'cst_8wmqcHMN4U' }); |
Response¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | HTTP/1.1 200 OK Content-Type: application/hal+json { "resource": "subscription", "id": "sub_rVKGtNd6s3", "mode": "live", "createdAt": "2016-06-01T12:23:34+00:00", "status": "active", "amount": { "value": "25.00", "currency": "EUR" }, "times": 4, "timesRemaining": 4, "interval": "3 months", "startDate": "2016-06-01", "nextPaymentDate": "2016-09-01", "description": "Quarterly payment", "method": null, "mandateId": "mdt_38HS4fsS", "webhookUrl": "https://webshop.example.org/payments/webhook", "metadata": { "plan": "small" }, "_links": { "self": { "href": "https://api.mollie.com/v2/customers/cst_stTC2WHAuS/subscriptions/sub_rVKGtNd6s3", "type": "application/hal+json" }, "customer": { "href": "https://api.mollie.com/v2/customers/cst_stTC2WHAuS", "type": "application/hal+json" }, "profile": { "href": "https://api.mollie.com/v2/profiles/pfl_URR55HPMGx", "type": "application/hal+json" }, "payments": { "href": "https://api.mollie.com/v2/customers/cst_stTC2WHAuS/subscriptions/sub_rVKGtNd6s3/payments", "type": "application/hal+json" }, "documentation": { "href": "https://docs.mollie.com/reference/v2/subscriptions-api/get-subscription", "type": "text/html" } } } |