Skip to main content

Use this Python library to manage Ping Payments API regarding merchants, payment orders, payments and payouts

Project description

Ping Payments Python SDK

Tests PyPI version License: MIT

The Ping Payments Python SDK manages the Ping Payments API and Ping Payment Links API.

Table of contents

Requirements

The Ping Payments Python SDK supports the following versions of Python:

  • Python 3, versions 3.7 and later

Installation

Install the latest Ping Payments Python SDK using pip:

pip install ping-sdk

Documentation

The Ping Payments Python SDK documentation contains complete information to be able to work with the SDK. Go to Python SDK documentation for the full documentation.

Ping Payments API

The Ping Payments API is implemented as the PaymentsApi class contains a number of endpoints.

Ping Payments API Endpoints

Ping Payment Links API

The Ping Payments API is implemented as the PaymentLinksApi contains a number of endpoints.

Ping Payment Links API Endpoints

Usage

Get a tenant ID

Ping Payments provides you with a tenant ID and are used for resource permissions.

Important: Make sure you store and access the tenant ID securely.

Instructions

  1. Import the PaymentsApi class from the Ping module:
from ping.payments_api import PaymentsApi
  1. Instantiate a PaymentsApi object and initialize it with the tenant ID and the environment that you want to use.

Initialize the PaymentsApi in production mode:

payments_api = PaymentsApi(
		tenant_id = '55555555-5555-5555-5555-555555555555'
)

Initialize the PaymentsApi in sandbox mode, for testing:

payments_api = PaymentsApi(
		tenant_id = '55555555-5555-5555-5555-555555555555',
		environment = 'sandbox'
)

Make calls

Work with the API by by choosing a Endpoint and calling it´s methods. For example, you can choose the endpoint merchants and call the method list() to a list of all merchants connected to a tenant:

result = payments_api.merchant.list()

Handle the response

Calls to the Ping Payments API endpoint methods returns an ApiResponse object. Properties of the ApiResponse object contains information regarding request (headers and request) and the response (status_code, reason_phrase, text, errors, body, and cursor).

Using the response:

Check whether the response succeeded or failed. Two helper methods is_success()and is_error() in the ApiResponse object determine the success or failure of a call:

if result.is_success():
	# Display the successful response as text
	print(result.text)
elif result.is_error():
	# Display the error response
	print(f"Errors: {result.errors}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ping-sdk-4.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ping_sdk-4.1.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file ping-sdk-4.1.0.tar.gz.

File metadata

  • Download URL: ping-sdk-4.1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for ping-sdk-4.1.0.tar.gz
Algorithm Hash digest
SHA256 d64f6615badf00e07c29d4c986133161cf74a6e5aec133d54bace0f93adfa329
MD5 4c1b280e77f07b4846629a85ef164ad3
BLAKE2b-256 c35f47e8a8537d3d8e05e5dfb207d161b9c67752e65d06c2efe6f2bf8b2580bd

See more details on using hashes here.

File details

Details for the file ping_sdk-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: ping_sdk-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for ping_sdk-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33d4179fd1623f3dfae7defb2cec7344dbc263d4452bb3bf42b855f6008206c5
MD5 9ee28b07b5b2007d460c8050fd0ad773
BLAKE2b-256 18cd0dd59c152adf07c8a11c72b6c87ea474db5168e31787456c292d1d893a78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page