from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username = CHEDDAR_USERNAME, password = CHEDDAR_PASSWORD, product_code = CHEDDAR_PRODUCT, ) # Create the customer customer = product.create_customer( code = 'cust-id-1', # An unique identifier for the customer first_name = 'Philip', last_name = 'Fry', email = '*****@*****.**', plan_code = 'FREE_MONTHLY', # The code for plan to subscribe the customer to )
from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username = CHEDDAR_USERNAME, password = CHEDDAR_PASSWORD, product_code = CHEDDAR_PRODUCT, ) # Get the customer from Cheddar Getter customer = product.get_customer(code='1BDI')
from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username=CHEDDAR_USERNAME, password=CHEDDAR_PASSWORD, product_code=CHEDDAR_PRODUCT, ) # Create the customer customer = product.create_customer( code='cust-id-2', first_name='Turanga', last_name='Leela', email='*****@*****.**', plan_code='PAID_MONTHLY', cc_number='4111111111111111', cc_expiration='03/3012', cc_card_code='123', cc_first_name='Hubert', cc_last_name='Farnsworth', cc_address='1 πth Ave.', cc_city='New New York', cc_state='New York', cc_zip='10001', )
from sharpy.product import CheddarProduct from sharpy import exceptions # Get a product instance to work with product = CheddarProduct( username=CHEDDAR_USERNAME, password=CHEDDAR_PASSWORD, product_code=CHEDDAR_PRODUCT, ) try: # Get the customer from Cheddar Getter customer = product.get_customer(code='1BDI') except exceptions.NotFound, err: print 'You do not appear to be a customer yet' else: # Test if the customer's subscription is canceled if customer.subscription.canceled: if customer.subscription.cancel_type == 'paypal-pending': print 'Waiting for Paypal authorization' else: print 'Your subscription appears to have been cancelled' else: print 'Your subscription appears to be active'
from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username = CHEDDAR_USERNAME, password = CHEDDAR_PASSWORD, product_code = CHEDDAR_PRODUCT, ) # Create the customer customer = product.create_customer( code = 'cust-id-2', first_name = 'Turanga', last_name = 'Leela', email = '*****@*****.**', plan_code = 'PAID_MONTHLY', cc_number = '4111111111111111', cc_expiration = '03/3012', cc_card_code = '123', cc_first_name = 'Hubert', cc_last_name = 'Farnsworth', cc_address = '1 πth Ave.', cc_city = 'New New York', cc_state = 'New York', cc_zip = '10001', )
from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username = CHEDDAR_USERNAME, password = CHEDDAR_PASSWORD, product_code = CHEDDAR_PRODUCT, ) # Create the customer customer = product.create_customer( code = 'cust-id-2', first_name = 'Turanga', last_name = 'Leela', email = '*****@*****.**', plan_code = 'PAID_MONTHLY', method = 'paypal', cc_first_name = 'Hubert', cc_last_name = 'Farnsworth', return_url = 'https://www.planetexpress.com/thanks/cust-id-2/', cancel_url = 'https://www.planetexpress.com/sorry/cust-id-2/', ) # redirect the user to the Paypal site to authorize the subscription redirect( customer.subscriptions[0].redirect_url, )
from datetime import datetime, timedelta from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username = CHEDDAR_USERNAME, password = CHEDDAR_PASSWORD, product_code = CHEDDAR_PRODUCT, ) # Set a intitial bill date in the future to provide a free trial bill_date = datetime.now() + timedelta(days=60) # Create the customer customer = product.create_customer( # Required fields code = 'cust-id-3', first_name = 'Hermes', last_name = 'Conrad', email = '*****@*****.**', plan_code = 'PAID_MONTHLY', cc_number = '4111111111111111', cc_expiration = '03/3012', cc_card_code = '123', cc_first_name = 'Hubert', cc_last_name = 'Farnsworth', cc_address = '1 πth Ave.', cc_city = 'New New York', cc_state = 'New York', cc_zip = '10001',
from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username = CHEDDAR_USERNAME, password = CHEDDAR_PASSWORD, product_code = CHEDDAR_PRODUCT, ) # Get the customer from Cheddar Getter customers = product.get_customers()
from sharpy.product import CheddarProduct # Get a product instance to work with product = CheddarProduct( username=CHEDDAR_USERNAME, password=CHEDDAR_PASSWORD, product_code=CHEDDAR_PRODUCT, ) # Create the customer customer = product.create_customer( code='cust-id-2', first_name='Turanga', last_name='Leela', email='*****@*****.**', plan_code='PAID_MONTHLY', method='paypal', cc_first_name='Hubert', cc_last_name='Farnsworth', return_url='https://www.planetexpress.com/thanks/cust-id-2/', cancel_url='https://www.planetexpress.com/sorry/cust-id-2/', ) # redirect the user to the Paypal site to authorize the subscription redirect(customer.subscriptions[0].redirect_url, )
def get_product(self): ''' Helper method for getting product. ''' product = CheddarProduct(**self.client_defaults) return product