PayPal payment method "card" not shown

42 Views Asked by At

I am using Paypal API V2 with the Javascript SDK. I would also say that I am using PHP 7.4 and Angular 9, but this bears no significance.

At the moment I am in PayPal Sandbox mode, so perhaps the issue I see is not relevant if I go LIVE.

Anyway, my front end will render these two PayPal buttons, provided by the PayPal SDK plugin (i.e. I did not code those buttons, I just used the the Paypal Buttons plugin), and there are two because the plugin senses that those are the only options available given the location, the environment, etc, which is fine:

My front end, cool innit

Regardless of which option has been chosen, my backend will make a call to the Capture Payment for Order PayPal endpoint.

I'd like to know which option the user has chosen by looking at the response of that call, so I can display a proper icon in the user's transaction list (e.g. "Paid using PayPal" or "Paid using Card details")

If the user has chosen the first option, the response would look something like this:

{
    ...
    "status": "COMPLETED",
    "payment_source": {
        "paypal": {
            ...
            "account_status": "VERIFIED",
            "name": {
                ...
            }     
            ...  
        }
    },  
    ...           
} 

Because I see paypal in the payment_source collection, I should infer that the first option was chosen.

However, if the user choses the second option, the response of the endpoint would look something like this.

{
    ...
    "status": "COMPLETED",
    "payment_source": {
        "paypal": {
            ...
            "account_status": "UNVERIFIED",
            "name": {
                ...
            }     
            ...
        }
    },
    ...
}

I was expecting to see card in the payment_source property, but again I see paypal, which should also lead me to infer that the first option was chosen, when in fact it was the second.

The only way of telling them apart is by checking the account_status property, but that strikes me as an unreliable hack. It is my understanding that you can still use the first PayPal button having an unverified account, and that account verification is only needed when you receive money, not when you are sending it.

In any case, all of this is a bit confusing, and after a thorough Google investigation I have no conclusive answers.

ChatGPT also gives me different answers depending on how do I frame the same question. The reason as to why I am not surprised about this is beyond me.

I guess I need the answer to these three burning questions:

  1. Am I correct in expecting card as payment_source if the user chose the Debit or Credit card button powered by PayPal (ergo the issue that I'm describing is only specific to the Sandbox environment)?
  2. Is account_status a reliable way of determine which button has been used?
  3. Is there any other way to ascertain which button has been used in a deterministic way, by only looking at the response payload?
1

There are 1 best solutions below

2
Preston PHX On

payment_source:card is only applicable to advanced integrations, not the standard integration Debit or Credit Card button in your question. Standard payments are payment_source:paypal payments in the transaction record.

What you can do is collect information on which button was clicked, which is a separate piece of information. Log the first parameter passed to the createOrder callback function, particularly its paymentSource key.