Closed Gilduuw closed 4 years ago
I'm sorry that this is not documented better. We only have a unit test describing the correct pattern at: https://github.com/mollie/mollie-api-python/blob/master/tests/test_customer_subscriptions.py#L102
Basically, the correct pattern is add the customer contextually:
payload = {
'amount': {
'currency': 'EUR',
'value': '0.01'
},
'interval': '1 month',
'description': 'Recurring Timeless subscription',
'startDate': '2020-09-30',
'webhookUrl': webhook_url,
}
mollie_client.customer_subscriptions.with_parent_id(mollie_customer_id).create(payload)
# or
mollie_customer = client.customers.get(mollie_customer_id)
mollie_client.customer_subscriptions.on(mollie_customer).create(payload)
@Gilduuw does this solve your problem?
That solved it, thanks :) Will check out unit tests first in the future!
Hi - more a question than an issue, I'm sorry for that.
I'm trying to create a subscription for a specific customer.
In the API docs (https://docs.mollie.com/reference/v2/subscriptions-api/create-subscription), there is no Python example available.
I experimented with the following:
Error returned:
Non-existent body parameter "customerId" for this API call. Did you mean: "times"?
I've tried other setups (first retrieving the Customer object):
customer.subscriptions.create()
customer.create_subscription()
But with similar results (non-existent API methods).
So what would be the correct way to approach this via the python client?
I could ofcourse create a custom POST request, but I prefer to use the built-in client when possible.
Thanks!