Skip to content

Latest commit

 

History

History
 
 

README.md

openapi-client

These APIs are designed as RPC style stateless web services where each API endpoint represents an operation to be performed. All request and response payloads are sent in the JSON (JavaScript Object Notation) data-interchange format. Each endpoint in the API specifies the HTTP Method used to access it. All strings in request and response objects are to be UTF-8 encoded. Each API URI includes the major and minor version of API that it conforms to. This will allow multiple concurrent versions of the API to be deployed simultaneously.

Authentication

Mastercard uses OAuth 1.0a with body hash extension for authenticating the API clients. This requires every request that you send to Mastercard to be signed with an RSA private key. A private-public RSA key pair must be generated consisting of:

  1. A private key for the OAuth signature for API requests. It is recommended to keep the private key in a password-protected or hardware keystore.

2. A public key is shared with Mastercard during the project setup process through either a certificate signing request (CSR) or the API Key Generator. Mastercard will use the public key to verify the OAuth signature that is provided on every API call.

An OAUTH1.0a signer library is available on GitHub

Encryption

All communications between Issuer web service and the Mastercard gateway is encrypted using TLS.

Additional Encryption of Sensitive Data

In addition to the OAuth authentication, when using MDES Digital Enablement Service, any PCI sensitive and all account holder Personally Identifiable Information (PII) data must be encrypted. This requirement applies to the API fields containing encryptedData. Sensitive data is encrypted using a symmetric session (one-time-use) key. The symmetric session key is then wrapped with an RSA Public Key supplied by Mastercard during API setup phase (the Customer Encryption Key).

Java Client Encryption Library available on GitHub

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.3.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import openapi_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import openapi_client

Getting Started

Please follow the installation procedure and then run the following:

import time
import openapi_client
from pprint import pprint
from openapi_client.api import delete_api
from openapi_client.model.delete_request_schema import DeleteRequestSchema
from openapi_client.model.delete_response_schema import DeleteResponseSchema
from openapi_client.model.errors_response import ErrorsResponse
from openapi_client.model.gateway_errors_response import GatewayErrorsResponse
# Defining the host is optional and defaults to https://api.mastercard.com/mdes
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
    host = "https://api.mastercard.com/mdes"
)



# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = delete_api.DeleteApi(api_client)
    delete_request_schema = DeleteRequestSchema(
        response_host="site2.payment-app-provider.com",
        request_id="123456",
        payment_app_instance_id="123456789",
        token_unique_references=[
            "DWSPMC000000000132d72d4fcb2f4136a0532d3093ff1a45",
        ],
        caused_by="CARDHOLDER",
        reason="Lost/stolen device",
        reason_code="SUSPECTED_FRAUD",
    ) # DeleteRequestSchema | Contains the details of the request message.  (optional)

    try:
        # Used to delete one or more Tokens. The API is limited to 10 Tokens per request.
        api_response = api_instance.delete_digitization(delete_request_schema=delete_request_schema)
        pprint(api_response)
    except openapi_client.ApiException as e:
        print("Exception when calling DeleteApi->delete_digitization: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.mastercard.com/mdes

Class Method HTTP request Description
DeleteApi delete_digitization POST /digitization/static/1/0/delete Used to delete one or more Tokens. The API is limited to 10 Tokens per request.
GetAssetApi get_asset GET /assets/static/1/0/asset/{AssetId} Used to retrieve static Assets from the MDES repository.
GetTaskStatusApi get_task_status POST /digitization/static/1/0/getTaskStatus Used to check the status of any asynchronous task that was previously requested.
GetTokenApi get_token POST /digitization/static/1/0/getToken Used to get the status and details of a single given Token.
SearchTokensApi search_tokens POST /digitization/static/1/0/searchTokens Used to get basic token information for all tokens on a specified device, or all tokens mapped to the given Account PAN.
SuspendApi create_suspend POST /digitization/static/1/0/suspend Used to temporarily suspend one or more Tokens.
TokenizeApi create_tokenize POST /digitization/static/1/0/tokenize
TransactApi create_transact POST /remotetransaction/static/1/0/transact Used by the Token Requestor to create a Digital Secure Remote Payment ("DSRP") transaction cryptogram using the credentials stored within MDES in order to perform a DSRP transaction.
UnsuspendApi create_unsuspend POST /digitization/static/1/0/unsuspend Used to unsuspend one or more previously suspended Tokens. The API is limited to 10 Tokens per request.
NotifyTokenUpdatedApi notify_token_update__for_token_state_change POST /digitization/static/1/0/notifyTokenUpdated Outbound API used by MDES to notify the Token Requestor of significant Token updates, such as when the Token is activated, suspended, unsuspended or deleted; or when information about the Token or its product configuration has changed.

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in openapi_client.apis and openapi_client.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from openapi_client.api.default_api import DefaultApi
  • from openapi_client.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import openapi_client
from openapi_client.apis import *
from openapi_client.models import *