Exemple #1
0
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
)
Exemple #2
0
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',
)
Exemple #3
0
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',
)
Exemple #4
0
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,
)
Exemple #5
0
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',

    # Optional Fields
    initial_bill_date = bill_date,
    referer = 'http://www.momsfriendlyrobots.com/',
)
Exemple #6
0
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, )