mollie / mollie-api-php

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

Giftcard payment details don't include remainderMethod details #452

Closed SanderVanLeeuwen closed 4 years ago

SanderVanLeeuwen commented 4 years ago

When a payment is partially paid with giftcards, the remainderMethod specifies the payment method used to pay the remaining amount. However, I can't fetch any additional details about the used method. For example in case of a PayPal transaction, the PayPal reference which is normally accessible through details.paypalReference.

The Mollie dashboard does show some of this information (reference, consumer name / email, etc.) so it must be available somewhere. Could this be provided through the API?

Some background info; for accounting purposes we match the paypalReference in Mollie settlements to the same reference supplied by PayPal in an outpayment. This works fine for normal PayPal transactions, but in this particular case it does not because of the missing details.

sandervanhooft commented 4 years ago

@MollieRick ?

willemstuursma commented 4 years ago

We could add an include to get the remainderDetails in the same way as from the normal API.

It would be something like v2/payments/tr_xxxxx?include=details.remainderDetails.

MollieRick commented 4 years ago

Nice one, I'll put it on our backlog.

MollieRick commented 4 years ago

I added an include to the Get payment endpoint. You will get the details when you add details.remainderDetailsas value for the include query parameter.

@sandervanhooft Do you need to change something in the client for this?

sandervanhooft commented 4 years ago

I’ll check tomorrow :)

willemstuursma commented 4 years ago

@MollieRick It's missing the remainderDetails under the gift card specific details.

MollieRick commented 4 years ago

@willemstuursma In my opinion not necessary since its not there by default. The QR-code is also not there for iDEAL, Bancontact, and Bank transfer.

willemstuursma commented 4 years ago

Hmm I think it would be an improvement - I'll open an issue with the documentation so we can pick it up later.

sandervanhooft commented 4 years ago

It seems the client doesn't need modification. I've tested this and it doesn't trow an error:

mollie()->payments->get("tr_UJcqgAjsNc", [
  'include' => 'details.remainderDetails',
]);

Note:

  1. I don't have a gift card payment available to test against.
  2. In the params array, the key must be known, otherwise an error is triggered (i.e. xinclude). The value however does not trigger an error if inexistent/misspelled (i.e. details.remainderDetailsXYZ). Not sure if this is by design?
willemstuursma commented 4 years ago

@sandervanhooft you can create gift card payments in test mode!

sandervanhooft commented 4 years ago

@willemstuursma Are you sure? I've enabled a few in the Dashboard, but to no avail.

image image
MollieRick commented 4 years ago

I'll close this issue. The initial issue is solved :)

sandervanhooft commented 4 years ago

👍 Also, the test-gift-cards-issue is not really high priority (not to me anyway).

willemstuursma commented 4 years ago

@sandervanhooft maybe you didn't save the page. It works just fine now.

SanderVanLeeuwen commented 4 years ago

Thanks for the addition. Is it by any chance possible to include those details directly when calling settlements/*settlementId*/payments? I'm now performing multiple calls (1. fetch settlement, 2. then settlement payments and then 3. individual payments when the remainderDetails are required) where the third call could be eliminated by including the remainderDetails directly.

I'm already happy with the current changes though, so 'no' is a good enough answer here ;)