mollie / mollie-api-php

Mollie API client for PHP
http://www.mollie.com
BSD 2-Clause "Simplified" License
550 stars 189 forks source link

No mandate created on Belfius 'first' recurring payment #66

Closed dveldhoen closed 7 years ago

dveldhoen commented 7 years ago

Dear Mollie,

As the title says. There is no valid mandate generated after a 'first' recurring payment with Belfius. It would be great if you guys could fix this.

If needed please contact me for extra details on info@factuursimpel.nl.

Kind regards, Danny

willemstuursma commented 7 years ago

Hi @Factuursimpel. Thanks for bringing this up, it's probably because of a limitation in the Belfius payment method. Regardless, we should not let this leak through our abstractions. I'll pass it to the Payments team and we'll keep this issue updated.

In the mean time, you'll find that a valid mandate will be generated a working day after the Belfius payment has been paid.

dveldhoen commented 7 years ago

Any update on this? This issue has been open for a while now and for me quite important.

Daanvm commented 7 years ago

Hi Danny,

When you create a payment with recurring type first, we immediately create the mandate for that payment. It is returned in the payment object in the mandateId:

{
  "resource": "payment",
  "id": "tr_45SUFPaTuD",
  "mode": "live",
  "createdDatetime": "2017-05-18T12:27:59.0Z",
  "status": "open",
  "expiryPeriod": "PT1H",
  "amount": "1.02",
  "description": "My Belfius payment",
  "method": "belfius",
  "metadata": null,
  "details": null,
  "profileId": "pfl_FJNVBh3Pbx",
  "customerId": "cst_P6P4aeTCA8",
  "mandateId": "mdt_RPy3gr7wKV",
  "recurringType": "first",
  "links": {
    "paymentUrl": "https://www.mollie.com/paymentscreen/belfius/redirect/401b5b68c984dcc9f73ae30444471077",
    "redirectUrl": "https://www.example.org"
  }
}

You can use this mandate ID to get the mandate from our API:

{
  "resource": "mandate",
  "id": "mdt_RPy3gr7wKV",
  "status": "pending",
  "method": "directdebit",
  "details": {
    "consumerName": null,
    "consumerAccount": null,
    "consumerBic": null
  },
  "customerId": "cst_P6P4aeTCA8",
  "signatureDate": null,
  "createdDatetime": "2017-05-18T12:27:59.0Z"
}

For most payment methods, like iDEAL, Bancontact (MisterCash) and KBC we immediately receive the IBAN and we can finalise the mandate, making the status valid. However, for Belfius we receive the IBAN only the following morning.

Your best option would be to check the mandate status before using the mandate. If the mandate is still pending, you should try it again later.

Hope this helps. Daan