#Help on the subscriptions API

1 messages ยท Page 1 of 1 (latest)

digital nacelle
#

Hi everyone.
I'm using the subscriptions API for recurring payments and i need to send an email to users who are in "trial" mode, couple of days before their first payment. I set the start date 1 month later and i track if a user is in "trial" mode by checking the startDate.

This will be checked in a cron job daily, so i will need to grab the startDate from mollie subscription API.

The way I see it I have 2 ways of going around this.

  1. Call the mollie api daily, get all customer's subscriptions, and check the startDate.
  2. Store the subscriptions info in my db but then I'll have to keep that in sync with the subscriptions info from mollie and i don't see any good way of doing that.

I'm worried what would be the best scenario here. Would i get a rate limited from mollie if i go with the first way and call the api daily to get the info?

#

Help on the subscriptions API

dense crest
#

Hi Johnny! Welcome to the community! ๐Ÿ‘‹

I do not think the Subscriptions API is meant for this. The whole management (and business rules) you are building on top of it should be done at your own system and database. The Subscriptions API is nothing more than a cron at our system for initiating recurring payments.

In your scenario, I would even recommend to build the business logic and crons yourself and create the payment the moment you want to charge it via the Recurring API: https://docs.mollie.com/docs/recurring-payments#charging-immediately-on-demand

digital nacelle
#

@dense crest Hi Rick, thanks a lot for the answer and for the suggestion. I will keep it as a last resort(since it will require updating existing logic in our codebase as well ) in case i have no other way.

I was trying to get around this by using webhooks. I pass the webhookUrl when i create the subscription and as i understand it will be called each time a transacation/payment happens for this subscription.

Mollie doesn't call the webhook when the payment is in pending status and that's fine but my payment can't get through the pending status. Is there any way i can simulate that and get it to paid status in testing mode?

dense crest
#

Yes you can! ๐Ÿ˜„

If you do a call to the GET Payment API, you will see a changePaymentState url. If you go to there, then you can select the next state of the payment and so simulate a bank signal ๐Ÿ™‚

digital nacelle
dense crest
#

Sure thing! ๐Ÿ˜„

digital nacelle
#

@dense crest Is changing the state manually the only way for this? Can i make the transition from pending -> paid in any other way?

Because that would be an issue for me in this case since i would rely on that webhook to get the latest data in testing.

dense crest
#

Unfortunatly not. Normally it happens with a signal from the bank. This URL is a workaround to be able to test it.