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
  • Using The LOCAL_TRANSFER Payment Method as a Transfer source
  • Create ACH Payment Method
  • Examples

Was this helpful?

  1. Payment Methods
  2. API Calls

Creating a Payment Method- ACH

ACH is only used for off-ramping. On-ramping with ACH is not available anymore.

When you create a Payment Method using this API it will return with a status of PENDING. The Payment Method must be approved before it can be used. Once approved, the Payment Method will transition from PENDING to ACTIVE

Using The LOCAL_TRANSFER Payment Method as a Transfer source

When using the Payment Method as the source of a Transfer you will need to use the SRN with the suffix :ach. This will tell our system to route the transaction to the ACH network.

For example, to use the above payment method you would make a request that looks like: POST /v3/transfers

{
  "source": "paymentmethod:PA-W7YN28ABCHT:ach",
  "dest": "account:AC-XX38VYXUA84",
  "sourceCurrency":"USD",
  "destCurrency":"USD",
  "sourceAmount": "100"
}

Create ACH Payment Method

POST https://api.sendwyre.com/v2/paymentMethods

Request Body

Name
Type
Description

publicToken

string

Public token

paymentMethodType

string

LOCAL_TRANSFER is the required value for paymentMethodType

country

string

US is the only supported country for this paymentMethodType

{
    "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" ],
    "chargeFeeSchedule": null,
    "depositFeeSchedule": null,
    "minCharge": null,
    "maxCharge": null,
    "minDeposit": null,
    "maxDeposit": null,
    "documents": [],
    "srn": "paymentmethod:PA-W7YN28ABCHT"
}

Examples

{
  "publicToken": "public-sandbox-c78b1564-44c9-426a-9ea3-3fdadcba2e10|AGdQ3KZwl9tdaedkMZAduw8vJD5GvyU1N48Zj",
  "paymentMethodType": "LOCAL_TRANSFER",
  "country": "US"
}
'''
This is a Python 3.7 Module that creates a payment method 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_CREATE_PAYMENT = "/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 createPaymentACH(self, post_data):
        '''
            Create a user payment ACH 
            POST https://api.sendwyre.com/v2/paymentMethods
            params: publicToken, PaymentMethodType, Country=US
        '''
        if not post_data:
            print("Need to send payment object with public Token")
            return

        params = {
            "timestamp": self.calcTimeStamp()
        }
        url = WyreApi.API_URL + WyreApi.API_VER2 + WyreApi.API_CREATE_PAYMENT + "?" + \
            urllib.parse.urlencode(params, encoding="utf-8")

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

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


if __name__ == "__main__":

    # initialize a Wyre Object
    wyre = WyreApi()

    paymentOjb = {
        # SRN https://docs.sendwyre.com/docs/srns
        "account": "account:AC_XXXXXXXXX",
        "publicToken": "ENTER YOUR PUBLIC TOKEN ACQUIRE FROM https://docs.sendwyre.com/docs/create-ach-payment-method",
        "paymentMethodType": "LOCAL_TRANSFER",
        "country": "US"
    }

    payment = wyre.createPaymentACH(paymentOjb)
    if payment:
        print(payment)

PreviousAPI CallsNextList Payment Methods

Last updated 4 years ago

Was this helpful?