-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathplans_example.py
More file actions
51 lines (46 loc) · 1.54 KB
/
plans_example.py
File metadata and controls
51 lines (46 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
import sys
from os import path, pardir
PROJECT_ROOT = path.dirname(path.abspath(__file__))
sys.path.append(path.join(PROJECT_ROOT, pardir))
import openpay
openpay.api_key = "sk_10d37cc4da8e4ffd902cdf62e37abd1b"
openpay.verify_ssl_certs = False
openpay.merchant_id = "mynvbjhtzxdyfewlzmdo"
openpay.public_ip = '138.84.62.226'
# Creating a plan
#plan = openpay.Plan.create(amount=150.00, status_after_retry="cancelled", retry_times=2,
# name="Curso de Ingles", repeat_unit="month", trial_days=30, repeat_every=1)
#print plan
# print "Updating plan with ID: pbkliysxavp8bvvp8f0k"
# plan = openpay.Plan.retrieve('pbkliysxavp8bvvp8f0k')
# plan.name="Curso de Ingles II"
# plan.save()
# print "All Plans"
# plans = openpay.Plan.all()
# print plans
print("Getting customer")
customer = openpay.Customer.retrieve('ancgmuvdtcvppcsfi3j4')
# print customer.cards.create(
# card_number="4111111111111111",
# holder_name="Juan Perez Ramirez",
# expiration_year="29",
# expiration_month="12",
# cvv2="110",
# address={
# "city":"Querétaro",
# "country_code":"MX",
# "postal_code":"76900",
# "line1":"Av 5 de Febrero",
# "line2":"Roble 207",
# "line3":"col carrillo",
# "state":"Queretaro"
# })
print "Adding plan to user {0}".format(customer.name)
print('Getting subscription')
subscription = customer.subscriptions.retrieve("stxqkgt48ttknauk0xjx")
subscription.trial_end_date = "2019-01-11"
subscription.card = None
subscription.source_id = "kmfgttah2vdiyhow5x7r"
print('Updating subscription')
subscription.save()