{"_id":"5bf5bb0f5d31d801394c453b","project":"550f74bb6fc8130d0038aad3","version":{"_id":"550f75de61d9d30d00af9e01","__v":17,"project":"550f74bb6fc8130d0038aad3","forked_from":"550f74bb6fc8130d0038aad6","createdAt":"2015-03-23T02:09:34.221Z","releaseDate":"2015-03-23T02:09:34.221Z","categories":["550f75de61d9d30d00af9e02","551027e38579861900a86698","551029e08579861900a8669a","551029e7498062190006328a","5bc633a722d682005c9ad9e4","5bc633b08c4b0b000d6a7eaa","5bc633b48f3ff600626e3e18","5bc63538e5a6ba000d22ee6d","5bc63587a18a6b000decd295","5bc635c0937fcb0056223d9c","5bc6360f42f41800319aeaa6","5be5d13ff1d319002baca9ce","5be5d2287cd14d00291fbfdb","5be8b3b09f7cb70023c56a39","5be8b3cbb910100044e20206","5c1d769a4f6aed001fe527f0","5c402942010f0d001496dded"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3"},"category":{"_id":"5bc633b08c4b0b000d6a7eaa","project":"550f74bb6fc8130d0038aad3","version":"550f75de61d9d30d00af9e01","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2018-10-16T18:53:36.184Z","from_sync":false,"order":7,"slug":"payment-methods","title":"Payment Methods"},"user":"56ddd4424acab82000ae9d30","__v":16,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-11-21T20:07:43.082Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"method":"post","examples":{"codes":[{"language":"json","code":"{\n\t\"publicToken\": \"public-sandbox-c78b1564-44c9-426a-9ea3-3fdadcba2e10|AGdQ3KZwl9tdaedkMZAduw8vJD5GvyU1N48Zj\",\n\t\"paymentMethodType\": \"LOCAL_TRANSFER\",\n\t\"country\": \"US\"\n}"},{"language":"python","code":"'''\nThis is a Python 3.7 Module that creates a payment method in\nthe test env\n'''\nimport requests\nimport time\nimport os\nimport urllib.parse\nimport hashlib\nimport hmac\nimport json\n\n\nclass WyreApi:\n    API_KEY = os.getenv(\"WYRE_APIKEY\")\n    SEC_KEY = os.getenv(\"WYRE_TOKEN\")\n    API_URL = \"https://api.testwyre.com\"\n    API_VER2 = \"/v2\"\n    API_CREATE_PAYMENT = \"/paymentMethods\"\n\n    def calc_auth_sig_hash(self, url_body):\n        '''\n          calculates a signature per Wyre API:\n          https://docs.sendwyre.com/docs/authentication#secret-key-signature-auth\n        '''  \n        message, secret = bytes(\n            url_body, 'utf-8'), bytes(WyreApi.SEC_KEY, 'utf-8')\n        newhash = hmac.new(secret, message, hashlib.sha256)\n        return newhash.hexdigest()\n\n    def calcTimeStamp(self):\n      \t'''\n        \tcreates a timestamp to the millisecond\n        '''\n        return str(round(time.time() * 1000))\n\n      \n      \n    def createPaymentACH(self, post_data):\n        '''\n            Create a user payment ACH \n            POST https://api.sendwyre.com/v2/paymentMethods\n            params: publicToken, PaymentMethodType, Country=US\n        '''\n        if not post_data:\n            print(\"Need to send payment object with public Token\")\n            return\n\n        params = {\n            \"timestamp\": self.calcTimeStamp()\n        }\n        url = WyreApi.API_URL + WyreApi.API_VER2 + WyreApi.API_CREATE_PAYMENT + \"?\" + \\\n            urllib.parse.urlencode(params, encoding=\"utf-8\")\n\n        headers = {\n            \"X-API-Key\": WyreApi.API_KEY,\n            \"X-API-Signature\": self.calc_auth_sig_hash(url + json.dumps(post_data))\n        }\n\n        response = requests.post(url, headers=headers, json=post_data)\n        if response.status_code == 200:\n            return json.loads(response.text)\n        else:\n            print(response.text)\n\n\nif __name__ == \"__main__\":\n\n    # initialize a Wyre Object\n    wyre = WyreApi()\n\n    paymentOjb = {\n        # SRN https://docs.sendwyre.com/docs/srns\n        \"account\": \"account:AC_XXXXXXXXX\",\n        \"publicToken\": \"ENTER YOUR PUBLIC TOKEN ACQUIRE FROM https://docs.sendwyre.com/docs/create-ach-payment-method\",\n        \"paymentMethodType\": \"LOCAL_TRANSFER\",\n        \"country\": \"US\"\n    }\n\n    payment = wyre.createPaymentACH(paymentOjb)\n    if payment:\n        print(payment)\n"}]},"results":{"codes":[{"name":"","code":"{\n    \"id\": \"PA-W7YN28ABCHT\",\n    \"owner\": \"account:AC-XX38VYXUA84\",\n    \"createdAt\": 1542771684392,\n    \"name\": \"Plaid Checking 0000\",\n    \"defaultCurrency\": \"USD\",\n    \"status\": \"PENDING\",\n    \"statusMessage\": null,\n    \"waitingPrompts\": [],\n    \"linkType\": \"LOCAL_TRANSFER\",\n    \"beneficiaryType\": \"UNKNOWN\",\n    \"supportsDeposit\": true,\n    \"nameOnMethod\": null,\n    \"last4Digits\": \"0000\",\n    \"brand\": null,\n    \"expirationDisplay\": null,\n    \"countryCode\": \"US\",\n    \"nickname\": null,\n    \"rejectionMessage\": null,\n    \"disabled\": false,\n    \"supportsPayment\": true,\n    \"chargeableCurrencies\": [ \"USD\" ],\n    \"depositableCurrencies\": [ \"USD\" ],\n    \"chargeFeeSchedule\": null,\n    \"depositFeeSchedule\": null,\n    \"minCharge\": null,\n    \"maxCharge\": null,\n    \"minDeposit\": null,\n    \"maxDeposit\": null,\n    \"documents\": [],\n    \"srn\": \"paymentmethod:PA-W7YN28ABCHT\"\n}","language":"json","status":200}]},"settings":"","apiSetting":"5c50b085aae6150014b3e80e","auth":"required","params":[{"_id":"5bf5bb0f5d31d801394c453e","ref":"","in":"body","required":true,"desc":"publicToken","default":"","type":"string","name":"publicToken"},{"_id":"5bf5bb0f5d31d801394c453d","ref":"","in":"body","required":true,"desc":"`LOCAL_TRANSFER` is the required value for `paymentMethodType`","default":"","type":"string","name":"paymentMethodType"},{"_id":"5bf5bb0f5d31d801394c453c","ref":"","in":"body","required":true,"desc":"`US` is the only supported country for this paymentMethodType","default":"","type":"string","name":"country"}],"url":"/v2/paymentMethods"},"isReference":true,"order":3,"body":"Please refer to the [Payment Method Resources](doc:payment-method-overview) page for more information on payment methods.\n\nWhen 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`\n[block:api-header]\n{\n  \"title\": \"Using The LOCAL_TRANSFER Payment Method as a Transfer source\"\n}\n[/block]\nWhen using the Payment Method as the source of a [Transfer](doc:create-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.\n\nFor example, to use the above payment method you would make a request that looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"source\\\": \\\"paymentmethod:PA-W7YN28ABCHT:ach\\\",\\n  \\\"dest\\\": \\\"account:AC-XX38VYXUA84\\\",\\n  \\\"sourceCurrency\\\":\\\"USD\\\",\\n  \\\"destCurrency\\\":\\\"USD\\\",\\n  \\\"sourceAmount\\\": \\\"100\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"POST /v3/transfers\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"local_transfer-ach-create-payment-method","type":"endpoint","title":"ACH - Create Payment Method"}

postACH - Create Payment Method


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

publicToken:
required
string
publicToken
paymentMethodType:
required
string
`LOCAL_TRANSFER` is the required value for `paymentMethodType`
country:
required
string
`US` is the only supported country for this paymentMethodType

Examples


Result Format


Documentation

Please refer to the [Payment Method Resources](doc:payment-method-overview) page for more information on payment methods. 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` [block:api-header] { "title": "Using The LOCAL_TRANSFER Payment Method as a Transfer source" } [/block] When using the Payment Method as the source of a [Transfer](doc:create-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: [block:code] { "codes": [ { "code": "{\n \"source\": \"paymentmethod:PA-W7YN28ABCHT:ach\",\n \"dest\": \"account:AC-XX38VYXUA84\",\n \"sourceCurrency\":\"USD\",\n \"destCurrency\":\"USD\",\n \"sourceAmount\": \"100\"\n}", "language": "json", "name": "POST /v3/transfers" } ] } [/block]