{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/v2/paymentMethods","auth":"required","method":"post","examples":{"codes":[{"code":"{\n\t\"plaidProcessorToken\": \"processor-sandbox-0asd1-a92nc\",\n\t\"paymentMethodType\": \"LOCAL_TRANSFER\",\n\t\"country\": \"US\"\n}","language":"json"},{"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","language":"python"}]},"results":{"codes":[{"status":200,"language":"json","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}","name":""}]},"settings":"","params":[{"name":"plaidProcessorToken","type":"string","default":"","desc":"plaidProcessorToken","required":true,"in":"body","ref":"","_id":"5bf5bb0f5d31d801394c453e"},{"name":"paymentMethodType","type":"string","default":"","desc":"`LOCAL_TRANSFER` is the required value for `paymentMethodType`","required":true,"in":"body","ref":"","_id":"5bf5bb0f5d31d801394c453d"},{"name":"country","type":"string","default":"","desc":"`US` is the only supported country for this paymentMethodType","required":true,"in":"body","ref":"","_id":"5bf5bb0f5d31d801394c453c"}]},"next":{"description":"","pages":[]},"title":"ACH - Create Payment Method (Processor Token Model)","type":"endpoint","slug":"ach-create-payment-method-processor-token-model","excerpt":"Create an ACH Payment Method","body":"[block:api-header]\n{\n \"title\": \"Plaid + Wyre Integration\"\n}\n[/block]\nThis integration enables end users on Wyre's platform to verify their account quickly through Plaid’s front-end module. Wyre partners will then generate Plaid Processor Tokens on behalf of their end users. This token will allow Wyre to immediately retrieve a user's bank details in order to deposit or withdraw funds on the Wyre platform.\n\nThis integration requires [Plaid API keys](https://dashboard.plaid.com/signin?redirect=%2Fteam%2Fkeys).\n[block:api-header]\n{\n \"title\": \"Create a Plaid Processor Token\"\n}\n[/block]\nA Plaid processor token is used to enable Plaid integrations with partners. Please refer to the [Plaid Processor Token](https://plaid.com/docs/api/processors/#processortokencreate) page for creating a token.\n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/1a7ea3e-Screen_Shot_2021-01-25_at_3.02.38_PM.png\",\n \"Screen Shot 2021-01-25 at 3.02.38 PM.png\",\n 1030,\n 896,\n \"#333\"\n ]\n }\n ]\n}\n[/block]\nPlaid Link & Processor Token Flow:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"<html>\\n<head>\\n<script src=\\\"https://code.jquery.com/jquery-3.5.1.min.js\\\"></script>\\n<script src=\\\"https://cdn.plaid.com/link/v2/stable/link-initialize.js\\\"></script>\\n<script type=\\\"text/javascript\\\">\\n// https://docs.sendwyre.com/docs/ach-create-payment-method-processor-token-model\\nvar createPaymentMethod = function(processorToken) {\\n\\t\\t$.ajax({\\n\\t url: 'https://api.testwyre.com/v2/paymentMethods',\\n\\t dataType: 'json',\\n\\t type: 'POST',\\n\\t beforeSend: function (xhr) {\\n\\t\\t xhr.setRequestHeader('Authorization', 'Bearer __YOUR_BEARER_TOKEN__'); // please refer to https://docs.sendwyre.com/docs/authentication for all available authentication method\\n\\t\\t},\\n\\t contentType:\\\"application/json; charset=utf-8\\\",\\n\\t data: JSON.stringify({\\n\\t\\t \\t\\\"plaidProcessorToken\\\": processorToken,\\t\\t \\t\\n\\t\\t \\t\\\"paymentMethodType\\\": \\\"LOCAL_TRANSFER\\\",\\n\\t\\t \\t\\\"country\\\": \\\"US\\\"\\n\\t\\t }),\\n\\t processData: false,\\n\\t success: function(data, textStatus, jQxhr) {\\n\\t \\t// alert(JSON.stringify(data));\\n\\t \\tdocument.getElementById(\\\"result\\\").innerHTML = \\\"<pre>\\\"+JSON.stringify(data, undefined, 2) +\\\"</pre>\\\"\\t \\t\\n\\t },\\n\\t error: function( jqXhr, textStatus, errorThrown ) {\\n\\t console.log( errorThrown );\\n\\t }\\n\\t});\\t\\n}\\nvar createProcessorTokenCb = function(data, textStatus, jQxhr) {\\n\\tcreatePaymentMethod(data.processorToken);\\t\\n}\\n// https://plaid.com/docs/api/processors/#processortokencreate\\nvar createProcessorToken = function(accessToken, accountId) {\\n\\t$.ajax({\\n\\t url: 'https://yourapp.com/plaid/createProcessorToken', // partner has to implement this using a node js backend or with other backend language (Java, python)\\n\\t dataType: 'json',\\n\\t type: 'POST',\\n\\t contentType:\\\"application/json; charset=utf-8\\\",\\n\\t data: JSON.stringify({\\n\\t\\t \\t\\\"accessToken\\\": accessToken,\\t\\t \\t\\n\\t\\t \\t\\\"accountId\\\": accountId,\\n\\t\\t \\t\\\"processor\\\": \\\"wyre\\\"\\n\\t\\t }),\\n\\t processData: false,\\n\\t success: function(data, textStatus, jQxhr) {\\n\\t \\tconsole.log(data);\\n\\t \\tcreateProcessorTokenCb(data, textStatus, jQxhr);\\n\\t },\\n\\t error: function( jqXhr, textStatus, errorThrown ) {\\n\\t console.log( errorThrown );\\n\\t }\\n\\t});\\t\\n}\\n// https://plaid.com/docs/api/tokens/#itempublic_tokenexchange\\nvar exchangeAccessToken = function(publicToken, accountId) {\\n\\t$.ajax({\\n\\t url: 'https://yourapp.com/plaid/exchangeAccessToken', // partner has to implement this using a node js backend or with other backend language (Java, python)\\n\\t dataType: 'json',\\n\\t type: 'POST',\\n\\t contentType:\\\"application/json; charset=utf-8\\\",\\n\\t data: JSON.stringify({\\n\\t\\t \\t\\\"publicToken\\\": publicToken\\n\\t\\t }),\\n\\t processData: false,\\n\\t success: function(data, textStatus, jQxhr) {\\n\\t \\tconsole.log(data);\\n\\t \\tcreateProcessorToken(data.accessToken, accountId);\\n\\t },\\n\\t error: function( jqXhr, textStatus, errorThrown ) {\\n\\t console.log( errorThrown );\\n\\t }\\n\\t});\\t\\n}\\nvar linkTokenCb = function(data, textStatus, jQxhr) {\\n \\tconsole.log(data);\\n\\t\\tconst handler = Plaid.create({\\n\\t\\t token: data.linkToken,\\n\\t\\t selectAccount: true,\\n\\t\\t isWebview: true,\\n\\t\\t onSuccess: (public_token, metadata) => {\\n\\t\\t \\texchangeAccessToken(public_token, metadata.account_id);\\n\\t\\t },\\n\\t\\t onLoad: () => {\\n\\t\\t },\\n\\t\\t onExit: (err, metadata) => {\\n\\t\\t },\\n\\t\\t onEvent: (eventName, metadata) => {\\n\\t\\t }\\n\\t\\t});\\n\\t\\thandler.open();\\t\\n}\\n// https://plaid.com/docs/link/web/#create\\n$.ajax({\\n url: 'https://yourapp.com/plaid/createLinkToken', // partner has to implement this using a node js backend or with other backend language (Java, python)\\n dataType: 'json',\\n type: 'POST',\\n contentType:\\\"application/json; charset=utf-8\\\",\\n data: JSON.stringify({\\n\\t \\t\\\"user\\\": {\\n\\t \\t\\t\\\"clientUserId\\\": \\\"AC_2ZUM812345\\\"\\n\\t \\t},\\n\\t \\t\\\"products\\\": [\\\"auth\\\"\\n\\t \\t// , \\\"identity\\\"\\n\\t \\t],\\n\\t \\t\\\"countryCodes\\\": [\\\"US\\\"],\\n\\t \\t\\\"language\\\": \\\"en\\\"\\n\\t }),\\n processData: false,\\n success: linkTokenCb,\\n error: function( jqXhr, textStatus, errorThrown ) {\\n console.log( errorThrown );\\n }\\n});\\n</script>\\n<div id=\\\"result\\\">\\n</div>\\n</head>\\t\\n</html>\",\n \"language\": \"javascript\",\n \"name\": \"Javascript Plaid Processor Flow\"\n }\n ]\n}\n[/block]\nPlease 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]","updates":[],"order":3,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"600f12c77dbb3f002b7b48dc","createdAt":"2021-01-25T18:49:43.593Z","user":"5a568b873f58350012e0d314","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Payment Methods","slug":"payment-methods","order":10,"from_sync":false,"reference":true,"_id":"5bc633b08c4b0b000d6a7eaa","project":"550f74bb6fc8130d0038aad3","version":"550f75de61d9d30d00af9e01","createdAt":"2018-10-16T18:53:36.184Z","__v":0},"version":{"version":"3","version_clean":"3.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["550f75de61d9d30d00af9e02","551027e38579861900a86698","551029e08579861900a8669a","551029e7498062190006328a","5bc633a722d682005c9ad9e4","5bc633b08c4b0b000d6a7eaa","5bc633b48f3ff600626e3e18","5bc63538e5a6ba000d22ee6d","5bc63587a18a6b000decd295","5bc635c0937fcb0056223d9c","5bc6360f42f41800319aeaa6","5be5d13ff1d319002baca9ce","5be5d2287cd14d00291fbfdb","5be8b3b09f7cb70023c56a39","5be8b3cbb910100044e20206","5c1d769a4f6aed001fe527f0","5c402942010f0d001496dded","5e8127d61c906800374eeb1c","5f2768c98622b8005106544a","5f2768d05702ca0011f7655e","5f276e5348d2b600321aef9b","5f276fd300e519001139200a","5f9a2cb79dafe500259281a7","5fd92bf362bb7301b00e48ba"],"_id":"550f75de61d9d30d00af9e01","__v":24,"releaseDate":"2015-03-23T02:09:34.221Z","project":"550f74bb6fc8130d0038aad3","createdAt":"2015-03-23T02:09:34.221Z","forked_from":"550f74bb6fc8130d0038aad6"},"project":"550f74bb6fc8130d0038aad3","__v":16,"parentDoc":null}
postACH - Create Payment Method (Processor Token Model)
Create an ACH Payment Method
Definition
{{ api_url }}{{ page_api_url }}
Parameters
Body Params
plaidProcessorToken:
required
string
plaidProcessorToken
paymentMethodType:
required
string
`LOCAL_TRANSFER` is the required value for `paymentMethodType`
country:
required
string
`US` is the only supported country for this paymentMethodType