These docs are for v3. Click to read the latest docs for v4.

List Payment Methods

Retrieve all payment methods owned by the current account

This is a paginated endpoint, pagination parameters are defined as follows:

  • position: current page.
  • recordsTotal: amount of total records (for all pages).
  • recordsFiltered: records on this page.

The limit and offset are query string parameters that can be used to navigate in the pages.

curl --request GET \
     --url https://api.testwyre.com/v2/paymentMethods \
     --header 'Accept: application/json'
'''
This is a Python 3.7 Module that lists all the payment methods in
the test environment
'''
import requests
import time
import os
import urllib.parse
import hashlib
import hmac
import json


class WyreApi:
    API_KEY = os.getenv("WYRE_APIKEY")
    SEC_KEY = os.getenv("WYRE_TOKEN")
    API_URL = "https://api.testwyre.com"
    API_VER2 = "/v2"
    API_GET_ALL_PAYMENT_METHODS = "/paymentMethods"

    def calc_auth_sig_hash(self, url_body):
        # calculates a signature per Wyre API:
        # https://docs.sendwyre.com/docs/authentication#secret-key-signature-auth
        message, secret = bytes(
            url_body, 'utf-8'), bytes(WyreApi.SEC_KEY, 'utf-8')
        newhash = hmac.new(secret, message, hashlib.sha256)
        return newhash.hexdigest()

    def calcTimeStamp(self):
        # creates a timestamp to the millisecond
        return str(round(time.time() * 1000))

    def getAllPaymentMethods(self):
        '''
            Get a payment method
            GET https://api.testwyre.com/v2/paymentMethods
        '''
        params = {
            "timestamp": self.calcTimeStamp()
        }
        url = WyreApi.API_URL + WyreApi.API_VER2 + WyreApi.API_GET_ALL_PAYMENT_METHODS \
        + "?" + urllib.parse.urlencode(params, encoding="utf-8")

        headers = {
            "X-API-Key": WyreApi.API_KEY,
            "X-API-Signature": self.calc_auth_sig_hash(url)
        }

        response = requests.get(url, headers=headers)
        if response.status_code == 200:
            return json.loads(response.text)
        else:
            print(response)
            print(response.text)


if __name__ == "__main__":

    # initialize a Wyre Object
    wyre = WyreApi()

    # Get all payment methods
    payments = wyre.getAllPaymentMethods()
    if payments:
        print(payments)
Query Params
string

The amount of entries to be skipped

string

The maximum amount of items to retrieve

boolean

If true, returns the status of all payment methods without any PII (personally identifiable information)

Response

Language
Credentials
Bearer
URL
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json