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

Support for creating a recurring payment profile using a Billing Agreement instead of a CreditCard #17

Closed sorter closed 8 years ago

sorter commented 8 years ago

I have added some functionality to create recurring billing profiles using the baid paramater as described here under the code example Adding a New Profile for a PayPal Account. To obtain the baid I use the workflow described in this document under the section entitled "Obtaining the BAID Without Express Checkout Purchase"

Here is some sample code of these functions in action

# creating a token to obtain user authorization via Paypal
pclient = PayflowProClient(**kwargs)
zeroamt = Amount(amt=0.00, currency="USD")
btype = BillingType(billingtype='MerchantInitiatedBilling')
extras = [btype]
r=pclient.baid_set_checkout(setpaypal, zeroamt,extras=extras)
token = r[0][1].data['token']
# use the authorized token to retrieve a baid
pclient = PayflowProClient(**kwargs)
baid_response = pclient.get_baid(token)
# create a recurring billing profile using the baid
args =  { "profilename": profilename, "start": start.strftime("%m%d%Y"), 
              "term": 0,"payperiod": 'MONT', 'baid': baid }
amount = Amount(amt=amt,currency="USD")
p = Profile(**args)
resp = pclient.profile_baid_add(p, amount)
bkeating commented 8 years ago

Thank you so much for these contributions! I am personally no longer associated with any projects calling for this package, so I've lost the ability to review and develop on it.

I will do my best to review your pull request and try to pull it in.

Does any of this work affect recurring billing and/or methods unrelated to what you've built on? Have you been able to test these methods?

Thanks again and sorry for the delayed response!