def create_cc(userid, type, cc, month, year, cvv, firstname, lastname): credit_card = CreditCard({ # ###CreditCard # A resource representing a credit card that can be # used to fund a payment. "payer_id": userid, "type": type, "number": cc, "expire_month": month, "expire_year": year, "cvv2": cvv, "first_name": firstname, "last_name": lastname}) # Creates the credit card as a resource # in the PayPal vault. if credit_card.create(): logging.info("CreditCard[%s] created successfully"%(credit_card.id)) # TODO: Save id in user account else: logging.error("Error while creating CreditCard:") logging.error(credit_card.error)
# A resource representing a credit card that can be # used to fund a payment. "type": "visa", "number": "4924897140074588", "expire_month": "04", "expire_year": "2022", "cvv2": "969", "first_name": "Joe", "last_name": "Shopper", # Address # Base Address object used as shipping or billing # address in a payment. [Optional] "billing_address": { "line1": "52 N Main ST", "city": "Johnstown", "state": "OH", "postal_code": "43210", "country_code": "US" } }) # Make API call & get response status # Save # Creates the credit card as a resource # in the PayPal vault. if credit_card.create(): print("CreditCard[%s] created successfully" % (credit_card.id)) else: print("Error while creating CreditCard:") print(credit_card.error)
# CreditCard # A resource representing a credit card that can be # used to fund a payment. "type": "visa", "number": "4417119669820331", "expire_month": "11", "expire_year": "2018", "cvv2": "874", "first_name": "Joe", "last_name": "Shopper", # Address # Base Address object used as shipping or billing # address in a payment. [Optional] "billing_address": { "line1": "52 N Main ST", "city": "Johnstown", "state": "OH", "postal_code": "43210", "country_code": "US"}}) # Make API call & get response status # Save # Creates the credit card as a resource # in the PayPal vault. if credit_card.create(): print("CreditCard[%s] created successfully" % (credit_card.id)) else: print("Error while creating CreditCard:") print(credit_card.error)
def createCard(card): credit_Card = CreditCard(card) credit_Card.create()