Permalink
32036b5 Jul 4, 2014
1 contributor

Users who have contributed to this file

83 lines (79 sloc) 2.19 KB
from paypalrestsdk import BillingPlan
import logging
logging.basicConfig(level=logging.INFO)
billing_plan = BillingPlan({
"description": "Create Plan for Regular",
"merchant_preferences": {
"auto_bill_amount": "yes",
"cancel_url": "http://www.cancel.com",
"initial_fail_amount_action": "continue",
"max_fail_attempts": "1",
"return_url": "http://www.success.com",
"setup_fee": {
"currency": "USD",
"value": "25"
}
},
"name": "Testing1-Regular1",
"payment_definitions": [
{
"amount": {
"currency": "USD",
"value": "100"
},
"charge_models": [
{
"amount": {
"currency": "USD",
"value": "10.60"
},
"type": "SHIPPING"
},
{
"amount": {
"currency": "USD",
"value": "20"
},
"type": "TAX"
}
],
"cycles": "0",
"frequency": "MONTH",
"frequency_interval": "1",
"name": "Regular 1",
"type": "REGULAR"
},
{
"amount": {
"currency": "USD",
"value": "20"
},
"charge_models": [
{
"amount": {
"currency": "USD",
"value": "10.60"
},
"type": "SHIPPING"
},
{
"amount": {
"currency": "USD",
"value": "20"
},
"type": "TAX"
}
],
"cycles": "4",
"frequency": "MONTH",
"frequency_interval": "1",
"name": "Trial 1",
"type": "TRIAL"
}
],
"type": "INFINITE"
})
if billing_plan.create():
print("Billing Plan [%s] created successfully" % (billing_plan.id))
else:
print(billing_plan.error)