def sample_invoice_template(): return InvoiceTemplate({ "name": "Hours Template_".join([random.choice(string.letters) for i in range(10)]), "default": True, "unit_of_measure": "HOURS", "template_data": { "items": [{ "name": "Nutri Bullet", "quantity": 1, "unit_price": { "currency": "USD", "value": "50.00" } } ], "merchant_info": { "email": "*****@*****.**" }, "tax_calculated_after_discount": False, "tax_inclusive": False, "note": "Thank you for your business.", "logo_url": "https://pics.paypal.com/v1/images/redDot.jpeg" }, "settings": [ { "field_name": "items.date", "display_preference": { "hidden": True } }, { "field_name": "custom", "display_preference": { "hidden": True } } ] })
from paypalrestsdk import InvoiceTemplate from util import sample_invoice_template import logging logging.basicConfig(level=logging.INFO) for i in range(2): invoice_template = sample_invoice_template() invoice_template.create() history = InvoiceTemplate.all() print("List Invoice Templates:") for invoice_template in history.templates: print(" -> Invoice Template[%s]" % (invoice_template.template_id))
from paypalrestsdk import InvoiceTemplate from create import sample_invoice_template import logging logging.basicConfig(level=logging.INFO) invoice_template = sample_invoice_template() if invoice_template.create(): found_invoice_template = InvoiceTemplate.find(invoice_template.template_id) print("Found Invoice Template[%s]" % found_invoice_template.template_id) else: print(invoice_template.error)