bkeating / python-payflowpro

A simple Python client for PayPal's Payflow Pro API (HTTPS Interface).
https://www.paypal.com/us/webapps/mpp/payflow-payment-gateway
Apache License 2.0
47 stars 22 forks source link

Payflow Gateway Reports "Invalid tender" on Reference Transaction #5

Open JoeJasinski opened 12 years ago

JoeJasinski commented 12 years ago

Thank you for all the hard work on this API.

I noticed a slight issue when using the reference_transaction() method. The Payflow gateway would report back to me that I had submitted "Invalid Tender" and the transaction fails.

The payflow docs describe: "Invalid tender type. Your merchant bank account does not support the following credit card type that was submitted."

When I looked at the query parameters that python-payflow-pro was sending to the gateway, I noticed that what it was sending was different from what the docs suggested.

What python-payflow-pro sent to the gateway:

AMT[1]=4&CURRENCY[3]=USD&ORIGID[12]=*******&PARTNER[6]=PayPal&PWD[13]=********&TRXTYPE[1]=S&USER[12]=******&VENDOR[12]=*****

What the PayFlow Pro docs say should be sent:

TRXTYPE=A&TENDER=C&PWD=x1y2z3&PARTNER=PayPal&VENDOR=SuperMerchant&USER=SuperMerchant&ACCT=5555555555554444&EXPDATE=0308&AMT=100.00&INVNUM=123456789&STREET=5199 MAPLE&ZIP=94588

If you notice, the TENDER="C" parameter is missing from the python payflow-pro generated request.

I was able to force this parameter into the request using a Tender class with a "data" property. However, this feels a bit kludgy. Maybe I'm doing something wrong or using reference transactions incorrectly?

....

class Tender(): 
        """
        Force the tender into the parmas list sent to paypal
        """
        def __init__(self, *args, **kwargs):
            self.data =  {'TENDER':"C"}

        def __len__(self):
            return len(self.data)

 client.reference_transaction(
            transaction_type=transaction_type, original_pnref=original_pnref,
            amount=Amount(amt=amount, currency="USD"), extras=[Tender()])

Anyway, just bringing this up here in case it is an API issue. Thanks for reading, Joe

bkeating commented 12 years ago

Thanks for the report! I'll take a look into this over the coming week or so and report back.

bkeating commented 10 years ago

Not sure what to do here. Suggestions? I'll have to take a closer look but wanted to respond here since it's been awhile!