-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathcard_example.py
More file actions
61 lines (53 loc) · 1.47 KB
/
card_example.py
File metadata and controls
61 lines (53 loc) · 1.47 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
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
import sys
import datetime
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'
customer = openpay.Customer.retrieve('amce5ycvwycfzyarjf8l')
print "customer stored cards -------------> ", customer.cards.all().count
card = customer.cards.create(
card_number="4111111111111111",
holder_name="Juan Perez",
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 "customer card ----------------->"
print card
print "customer stored cards -------------> ", customer.cards.all().count
print "deleting card -------------> ", card.id
card.delete()
print "customer stored cards -------------> ", customer.cards.all().count
print "Creating merchant card: "
card = openpay.Card.create(
card_number="4111111111111111",
holder_name="Juan Perez",
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 "merchant card: ", card