Пример #1
0
def find_cc(ccid):
    # retrieve a previously saved
    # Credit Card using the 'vault' API.
    # API used: GET /v1/vault/credit-card/{id}
    try:
        # Retrieve the CreditCard  by calling the
        # static `find` method on the CreditCard class,
        # and pass CreditCard ID
        credit_card = CreditCard.find(ccid)
        return credit_card

    except ResourceNotFound as error:
        logging.error("CreditCard Not Found")
Пример #2
0
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)
Пример #3
0
# GetCreditCard Sample
# This sample code demonstrates how you
# retrieve a previously saved
# Credit Card using the 'vault' API.
# API used: GET /v1/vault/credit-cards/{id}
from paypalrestsdk import CreditCard, ResourceNotFound
import logging
logging.basicConfig(level=logging.INFO)

try:
    # Retrieve the CreditCard  by calling the
    # static `find` method on the CreditCard class,
    # and pass CreditCard ID
    credit_card = CreditCard.find("CARD-5BT058015C739554AKE2GCEI")
    print(("Got CreditCard[%s]" % (credit_card.id)))

except ResourceNotFound as error:
    print("CreditCard Not Found")
Пример #4
0
from paypalrestsdk import CreditCard, ResourceNotFound
import logging

logging.basicConfig(level=logging.INFO)

try:
    credit_card = CreditCard.find("CARD-5U686097RY597093SKPL7UNI")
    print("Got CreditCard[%s]" % (credit_card.id))

    credit_card_update_attributes = [{
        "op": "replace",
        "path": "/first_name",
        "value": "Billy"
    }]

    if credit_card.replace(credit_card_update_attributes):
        print("Card [%s] first name changed to %s" % (credit_card.id, credit_card.first_name))
    else:
        print(credit_card.error)

except ResourceNotFound as error:
    print("Billing Plan Not Found")
Пример #5
0
    "AX2Di4-q9p1qKXaWrCyebInnmHsU9rrE36cJr2f1kIcIEzQAga9DEXQO5iTYfMv8U5d0kDs3_iq5dU0-",
    "client_secret":
    "EOut2Ke5Vk7UP9rFyB-KIMHKzdY1X1dRGpjtiJIOMqAXDar86Dd6MMO6F5rcmsI1ymTi44fEcPnU7Lpk"
})
credit_card = CreditCard({
    # CreditCard
    # 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
Пример #6
0
from paypalrestsdk import CreditCard
import logging
logging.basicConfig(level=logging.INFO)

credit_card = CreditCard.find("CARD-7LT50814996943336KESEVWA")

if credit_card.delete():
    print("CreditCard deleted")
else:
    print(credit_card.error)
Пример #7
0
from paypalrestsdk import CreditCard, ResourceNotFound
import logging

logging.basicConfig(level=logging.INFO)

try:
    credit_card = CreditCard.find("CARD-5U686097RY597093SKPL7UNI")
    print(("Got CreditCard[%s]" % (credit_card.id)))

    credit_card_update_attributes = [{
        "op": "replace",
        "path": "/first_name",
        "value": "Billy"
    }]

    if credit_card.replace(credit_card_update_attributes):
        print(("Card [%s] first name changed to %s" %
               (credit_card.id, credit_card.first_name)))
    else:
        print((credit_card.error))

except ResourceNotFound as error:
    print("Billing Plan Not Found")
Пример #8
0
# API used: POST /v1/vault/credit-card
from paypalrestsdk import CreditCard
import logging
logging.basicConfig(level=logging.INFO)

credit_card = CreditCard({
    # 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.
Пример #9
0
# #GetCreditCard Sample
# This sample code demonstrates how you
# retrieve a previously saved
# Credit Card using the 'vault' API.
# API used: GET /v1/vault/credit-card/{id}
from paypalrestsdk import CreditCard, ResourceNotFound
import logging
logging.basicConfig(level=logging.INFO)

try:
  # Retrieve the CreditCard  by calling the
  # static `find` method on the CreditCard class,
  # and pass CreditCard ID
  credit_card = CreditCard.find("CARD-5BT058015C739554AKE2GCEI")
  print("Got CreditCard[%s]"%(credit_card.id))

except ResourceNotFound as error:
  print("CreditCard Not Found")
 def createCard(card):
     credit_Card = CreditCard(card)
     credit_Card.create()
Пример #11
0
from paypalrestsdk import CreditCard
import logging
logging.basicConfig(level=logging.INFO)

credit_card = CreditCard.find("CARD-7LT50814996943336KESEVWA")

if credit_card.delete():
  print("CreditCard deleted")
else:
  print(credit_card.error)