Wyre Documentation
  • 📡Wyre Documentation
  • Home
  • 👥Account Onboarding
    • Account Overview
    • Use Cases
    • Pricing
    • API Calls
      • Create Account
      • Get Account
      • Update Account
      • Upload Document
  • 🔗Wallets
    • Use Cases
    • Managing Wallets
      • Creating a Wallet
      • Create Mulitple Wallets
      • Lookup Wallet
      • Edit Wallet
      • List Wallets
      • Delete Wallet
    • Wallet Callbacks
  • 💳Payments
    • Limits + Coverage
    • Pricing
    • Chargeback + Risk
    • Accepted Payment Methods
    • Global Card Processing
      • Hosted Redirect Operation
      • Browser Dialog (Popup) Operation
      • Understanding Transaction Statuses
        • Wallet Order Errors and Exceptions (Failure Reasons)
      • Additional Widget Functionality and Features
        • Checking Limits
        • Tracking Orders
      • Widget FAQs
      • ⚠️ Wallet Order Reservations | Required! ⚠️
      • API Calls To Help Monitor Transactions
        • Track Widget Order
        • Check A User's Transaction Limits
        • Check Supported Countries
      • Client-Side Encryption 👻
  • 🌏Global Payouts
    • Use Cases
    • Limits + Coverage
    • Pricing
    • Supported Countries
    • Country Requirements
    • 🔥Blockchain + Banks
    • 🔥Instant Payouts to Debit Card
  • 💱Foreign Exchange
    • Exchange Rates
  • Methodologies
  • Payment Methods
    • API Calls
      • Creating a Payment Method- ACH
      • List Payment Methods
      • Create a Payment Method- Wire Transfer
      • Get Payment Method
      • Attach Blockchain to Payment Method
  • Transfers
    • API Calls
      • Creating a Transfer
      • Confirm a Transfer
      • Get Transfer
      • Transfer History
  • Data Subscriptions
    • Subscribe Webhook
    • Get Subscriptions
    • Delete Webhook
  • Resources
  • ✅Going Live
  • Testing Enviornment
  • Understanding API Errors
  • System Resource Name
  • Rate Limiting
  • Authentication & Key Management
    • Authorization Tokens
    • Create an API Key
    • Delete an API Key
    • Authentication Code Examples
  • Wyre Brand Assets
    • 🎨Color Palette And Wyre Logos
  • Links
    • 🧪Test Wyre Dashboard
    • 🗣️ Wyre's Discord
Powered by GitBook
On this page
  • List Payment Methods
  • Examples

Was this helpful?

  1. Payment Methods
  2. API Calls

List Payment Methods

Use this to retrieve all payment methods owned by the current account

List Payment Methods

GET https://api.sendwyre.com/v2/paymentMethod

{
  "data": [{
    "id": "PA-W7YN28ABCHT",
    "owner": "account:AC-XX38VYXUA84",
    "createdAt": 1542771684392,
    "name": "Plaid Checking 0000",
    "defaultCurrency": "USD",
    "status": "PENDING",
    "statusMessage": null,
    "waitingPrompts": [],
    "linkType": "LOCAL_TRANSFER",
    "beneficiaryType": "UNKNOWN",
    "supportsDeposit": true,
    "nameOnMethod": null,
    "last4Digits": "0000",
    "brand": null,
    "expirationDisplay": null,
    "countryCode": "US",
    "nickname": null,
    "rejectionMessage": null,
    "disabled": false,
    "supportsPayment": true,
    "chargeableCurrencies": [ "USD" ],
    "depositableCurrencies": [ "USD" ],
    "srn": "paymentmethod:PA-W7YN28ABCHT",
    "chargeFeeSchedule": null,
    "depositFeeSchedule": null,
    "minCharge": null,
    "maxCharge": null,
    "minDeposit": null,
    "maxDeposit": null,
    "documents": [],
    "blockchains": {},
    "liquidationBalances": {},
  }],
  "recordsTotal": 1,
  "position": 0
}

Examples

'''
This is a Python 3.7 Module that lists all the payment methods in
the test env
'''
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)

PreviousCreating a Payment Method- ACHNextCreate a Payment Method- Wire Transfer

Last updated 4 years ago

Was this helpful?