Search code examples
webhookspaymill

Webhook for Paymill cancelled subscription


Context: We allow users to subscribe to our content by using Paymill subscriptions (monthly or yearly). The user can cancel the subscription at any time, which will remove any future transactions under their client account, but not the current transaction (ex current month or year). We do this by using subscription.setCancelAtPeriodEnd(true); when the users cancels their subscription. Also, as you can see, we are using the Java paymill-java library.

Question: The only missing bit is to actually cancel their content in our app when the current period ends. So, is there a webhook for EventType.SUBSCRIPTION_CANCELLED which will be called at the actual period end ? I see there is a EventType.SUBSCRIPTION_DELETED webhook, but I presume this won't work as we don't actually delete the subscription. I know there are probably other solutions to this matter, like managing the cancelled period end in our app, but this would be much more cumbersome than just using a webhook. At least IMHO.


Solution

  • there are some new webhooks with the subscription v2.1 coming out last week. For example * subscription.expiring: returns a subscription-object * subscription.deactivated: returns a subscription-object * subscription.activated: returns a subscription-object * subscription.canceled: returns a subscription-object

    Have a look at https://www.paymill.com/de-de/dokumentation/referenz/api-referenz/#events

    Think yours is the subscription canceled one but you need to make the subscription creation with the api v2.1.