Apple Pay on the web - W3C Payment Request API - get credit card number

Using the tutorial on https://webkit.org/blog/8182/introducing-the-payment-request-api-for-apple-pay/

I successfully implemented apple pay on a website.

Now I am trying to get the first 6 digits of the customers credit card number for calculating OPC fees.

So I debugged and did some logging on the response object at code level (referrring to the tutorial above):


const response = await request.show();

  var jStr = JSON.stringify({
    methodName: response.methodName,
    details: response.details,
  }, undefined, 2);

  console.log(jStr);


When debugging, I got infos like customer name, card brand , card type and the last 4 digits of the card number.


Is there any way to get the first 6 digits of the credit card number ?

Is there any apple pay endpoint for this purpose (server to server communication), similar like when getting the payment session (https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/requesting_an_apple_pay_payment_session) ?


I already contacted the apple support via phone, but they could not help me (they had no technical knowledge).


Thanks and kind regards

shahir

Getting the first 6 digits of the card is not something that is currently supported. As mentioned, only the last 4 digits are available. Calculating the OPC information/fees would currently be an enhancement request as there is not an API for this.


Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Thank you for the response.

I just decrypted the payment data from inside the PaymentToken using this method: https://developer.apple.com/library/archive/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html


Now I have all the information like device-specific account number (applicationPrimaryAccountNumber) and card expiration date in plaintext.

Can I use any of the infromation inside the PaymentToken to find the issuing bank of this card ?


Referring to the apple link above:

7.Use the decrypted payment data to process the payment.


I have made it up to step 7, now how exctly can I process the payment ? What is the next step. I am missing a manual or some sort of detailed instruction, could not find any on the apple pay docs.


By the way: I don't use any third party payment processor.


Thank you and best regards

Shahir

I would recommend engaging with a payment processor for instructions on how to actually process the payment and for further information on the card type.


| I have made it up to step 7, now how exctly can I process the payment ? What is the next

| step. I am missing a manual or some sort of detailed instruction, could not find any on

| the apple pay docs.

|

| By the way: I don't use any third party payment processor.


To see a list of payment service providers to integrate with, check out the payment platforms page for your specific country here.

Select the Payment Service Providers tab.


Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Apple Pay on the web - W3C Payment Request API - get credit card number
 
 
Q