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

BAID Not Supported #16

Open sorter opened 8 years ago

sorter commented 8 years ago

There seems to be no way to create a recurring billing profile to charge a PayPal account. For this we would need to provide a BAID parameter.

Moreover, would it make sense to include support in this library for obtaining such a BAID?

sorter commented 8 years ago

To add some more info, I'm trying to achieve the process known as "Obtaining the BAID Without Express Checkout Purchase" as described in Express Checkout for PayFlow Document Number: 200042.en_US-201306

Adding the following method to the client appears to work

def baid_set_checkout(self, setpaypal, amount, extras=[]):
    params = dict(trxtype = "A", action = "S")
    for item in [setpaypal, amount] + extras:
        params.update(item.data)
    return self._do_request(None, params)

And I use it like this:

setpaypal = SetPaypal(returnurl='https:/domain.org/paypal/baid/return',cancelurl='https://domain.org/paypal/baid/cancel')
zeroamt = Amount(amt=0.00, currency="USD")
btype = BillingType(billingtype='MerchantInitiatedBilling')
extras = [btype]
r=pclient.baid_set_checkout(setpaypal, zeroamt,extras=extras)

I wonder if I could have achieved this result without modifying the source.