Giter Site home page Giter Site logo

divyazingh / cybersource-rest-samples-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cybersource/cybersource-rest-samples-python

0.0 0.0 0.0 127 KB

Sample code to demonstrate using the CyberSource REST APIs with the Python client library.

License: MIT License

Python 100.00%

cybersource-rest-samples-python's Introduction

Python Sample Code for the CyberSource SDK

This repository contains working code samples which demonstrate python integration with the CyberSource REST APIs through the CyberSource Python SDK.

NOTE: THIS REPO OF CODE SAMPLES HAS BEEN MADE PUBLIC FOR SDK TESTING AND SHOULD NOT BE USED FOR PRODUCTION - YET. PLEASE RAISE AN ISSUE ON THIS REPO IF YOU HAVE FURTHER QUESTIONS AND CHECK BACK SOON FOR GENERAL AVAILABILITY

The samples are organized into categories and common usage examples.

The samples are organized into categories and common usage examples, just like our API Reference Guide. Our API Reference Guide is an interactive reference for the CyberSource API. It explains the request and response parameters for each API method and has embedded code windows to allow you to send actual requests right within the API Reference Guide.

Using the Sample Code

The samples are all completely independent and self-contained. You can analyze them to get an understanding of how a particular method works, or you can use the snippets as a starting point for your own project.

You can also run each sample directly from the command line.

Requirements

Python 3.3 or greater

Running the Samples From the Command Line

  • Clone this repository:
    $ git clone https://github.com/CyberSource/cybersource-rest-samples-python.git
  • Install the CyberSource Python SDK:
    $ pip install cybersource-rest-client-python
  • Run the individual samples by name. For example:
    $ python samples\payments\coreservices\[CodeSampleName]

e.g.

    $ python samples\payments\coreservices\process_payment.py

To set your API credentials for an API request,Configure the following information in data/configuration.py file:

  • Http
        self.authentication_type = "http_signature"
        self.merchantid = "Your Merchant ID"
        self.run_environment = "CyberSource.Environment.SANDBOX"
        self.request_json_path = os.getcwd()+"\\resources\\request.json"
        self.key_alias = "your key alias"
        self.key_pass = "your key password"
        self.key_file_name = "your key filename"
        self.keys_directory = os.getcwd()+"\\resources\\"
        self.merchant_keyid = "your key id"
        self.merchant_secretkey = "your secret key"
        self.enable_log = False
        self.timeout = 1000
        self.log_file_name = "cybs"
        self.log_maximum_size = 10487560
        self.log_directory = "../../../../cybersource-rest-samples-python/Logs/"
        self.proxy_address = "proxy.com"
        self.proxy_port = ""

Switching between the sandbox environment and the production environment

CyberSource maintains a complete sandbox environment for testing and development purposes. This sandbox environment is an exact duplicate of our production environment with the transaction authorization and settlement process simulated. By default, this SDK is configured to communicate with the sandbox environment. To switch to the production environment, set the appropriate environment constant in data/Configuration.py file. For example:

// For PRODUCTION use
  self.run_environment = "CyberSource.Environment.PRODUCTION"

The API Reference Guide provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.

License

This repository is distributed under a proprietary license.

cybersource-rest-samples-python's People

Contributors

brianmc avatar chsriniv9 avatar gnongsie avatar kikmak42 avatar londhegaurav avatar sankalpsai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.