#Trying to grasp the API flow for recurring payments

1 messages · Page 1 of 1 (latest)

fathom verge
#

Hi all,

I've just implemented the Mollie.Api packaged into a .net blazor application.
I've tested the entire onboarding procedure for recurring payments with creating a first payment, retrieving mandates and creating a subscription.
But I was wondering what happens then, and what I still need to do:

  1. Do I need to do something to trigger the monthly or yearly payment again?
  2. What happens when at the time of the next payment there isn't enough funds on the mandate's bank account?

I hope someone can shed some light on this.

Thanks a lot
Tino

reef gate
#

The monthly payment will be triggered by Mollie platform, according to the interval which you passed when creating the subscription. If the customer doesn't have enough money in the account, eventually we'll cancel the subscription. You can find more info on this here: https://docs.mollie.com/docs/recurring-payments#charging-periodically-with-subscriptions

Mollie Documentation

Recurring payments can be used to charge customers on a regular basis or to offer automatic top-ups with credits-based services. Since the amount for a recurring payment is variable, other innovative use-cases are possible as well. Like doing a partial prepayment and later a final recurring payment,…

fathom verge
#

@reef gate ,

I've followed the documentation, and set up a subscription flow.

However I'm a bit confused as to which webhook to use.

I can see a clear example under the normal webhooks, if I understand correctly:

  1. I should pass a webhook url when creating the first payment.
  2. My webhookcontroller will then be called when that payment has been changed.
  3. My controller will then further handle the flow by fetching the mandate and then create a subscription.
  4. With the subscription creation I should then pass another webhook.
  5. Every change to a payment under that subscription will be sent to that webhook.

In regards to validation I saw that the next-gen webhooks create a rotating secret in the dashboard. But I don't see the possibility to subscribe to the subscription or payments events. I only see the payment link, sales invoice or balance transaction.

Under Webhooks- Best practices I can see an example of how to manually verify the X-Mollie-Signature and then use a Shared Secret.
Where do I get the Shared Secret from?
Or where do I set this?

I'm pretty new to this, so my apologies if for my questions.

Regards,
Tino

reef gate
#

Hey Tino, no worries! The Next Gen webhooks are not yet available for subscriptions and payments, that's why you can't find anything from these realms to subscribe to.

For subscriptions, you set a webhookUrl when creating the subscription. This URL will also be used for any subsequent payment generated. It follows the "old style" webhooks, which just call your controller posting id=tr_deadbeef so you need to pull the details for yourself.

One common pattern I see is to encode your internal subscription ID in the webhookUrl you add to the subscription (like https://yourawesomestore.invalid/webhook/subscription/9e1699ce-f1d8-444b-bc08-e124ca6c4b4b, so you know immediately in your controller which subscription the new payment is for. Otherwise you'd grab the payment and then match for the subscriptionId.

fathom verge
#

Hi @reef gate ,

I have an additional question in regards to webhooks in recurring payments.

Your documentation states:

*With normal payments you know the payment ID, because you’ve received this when creating the payment. With subscriptions you do not know the payment ID in advance. You will receive a webhook call with a payment ID that you have likely never seen before.

The payment object will, however, contain a subscriptionId field that contains the subscription ID you received when the subscription was created. This allows you to recognize where the payment belongs to.*

However when I look at the get payment using the payments API it doesn't state a field with SubscriptionId.

Am I missing something here?

Regards,
Tino