javascriptpayment-request-api

Adding custom card information to Payment Request


I want to implement payment request api to my website.

Payment request popup lists users saved cards associated with mobile phone and Google&Apple accounts.

I also want to put custom credit cards into that popup because we have already implemented save credit cards feature and it is been working for a while. I couldn't find any support for it reading documentations. Is it possible?

Expected to have a support like

var supportedInstruments = [{
 supportedMethods: 'basic-card',
 data: {
   supportedNetworks: ['visa', 'mastercard'],
   supportedTypes: ['credit', 'debit']
 },
  customCards: [{ //Custom credit cards
    number: '000000000000000',
    owner: 'John Doe'
  }]
}];

var details = {
  total: {label: 'Donation', amount: {currency: 'USD', value: '65.00'}},
  displayItems: [
    {
      label: 'Original donation amount',
      amount: {currency: 'USD', value: '65.00'}
    }
  ],
  shippingOptions: [
    {
      id: 'standard',
      label: 'Standard shipping',
      amount: {currency: 'USD', value: '0.00'},
      selected: true
    }
  ]
};
var request = new PaymentRequest(supportedInstruments, details);

Solution

  • There's no such feature nor proposal as far as I know, though I have heard similar requests in the past.

    One work around would be to implement a merchant specific payment method using the Payment Handler API. This API allows you to provide your own payment method. You can consume it by yourself and allow third parties to do so.