braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
546 stars 224 forks source link

Apple Pay last4 #275

Closed bensebborn closed 4 years ago

bensebborn commented 4 years ago

Issue description

When receiving details for an Apple Pay card, we want to know the last 4 digits that correspond to the user's real card, not the virtual card number held on the phone

With Google Pay we can just grab it like so:

$transactionObj->androidPayCard['sourceCardLast4']

However on Apple Pay, we have to strip it out of the card description

  $desc = $transactionObj->applePayCardDetails->sourceDescription;

   if($desc) {
                                $cardDetailParts = explode(' ', $desc);
                                $cardDigits = $cardDetailParts[1];
                                $cardType = $cardDetailParts[0];

                                if(!is_numeric($cardDigits)){
                                    //Something is wrong, could be text
                                    $cardDigits = $transactionObj->applePayCardDetails->last4;
                                }
   }

This is error prone, For example, on simulator, the last4 digits dont get included in the sourceDescription

Would be much better if we could access this uniformly across all cards, in the last4 field. Then any logic is done on Braintree's end to provide the correct info

hollabaq86 commented 4 years ago

👋 @bensebborn thanks for reaching out- Apple only returns virtual cards, which means we don't have the ability to provide actual last4.

Going to close this issue for now. If we ever do get the ability to add actual last4 we can always re-open and revisit the feature request!

bensebborn commented 4 years ago

Hi Holly

The actual last 4 is included in the description. So the data is there it’s just a pain to strip it out

So can the SDK not strip it out and pop into the correct fields to make it inform?

On Thu, 7 May 2020 at 17:54, Holly Stotelmyer notifications@github.com wrote:

Closed #275 https://github.com/braintree/braintree_php/issues/275.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/braintree/braintree_php/issues/275#event-3313788733, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABHJXB4NZVDODII2VO7RITRQLRTLANCNFSM4M3LTQWQ .

-- Ben Sebborn CTO/Cofounder Skiddle

Sent from Gmail Mobile

--

This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient you are hereby notified that any use, dissemination, distribution, disclosure or reproduction of this message is strictly prohibited. If you receive this message in error please notify Skiddle Ltd immediately. Whilst Skiddle Ltd operates antivirus software it does not accept responsibility for any damage whatsoever or howsoever that is caused by viruses or infections being passed on. Any views expressed within this message are solely those of the sender and do not necessarily reflect the views of Skiddle Ltd.

bensebborn commented 4 years ago

Refer to field

paymentInstrumentName

In your docs: https://developers.braintreepayments.com/reference/response/apple-pay-card/php

hollabaq86 commented 4 years ago

Hey @bensebborn, can you contact Support and reference this issue? They'll check in with the engineering team that owns this part of our API's behavior for feedback.