{"_id":"5c0588378f19e601cec8a8c4","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":4,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-12-03T19:47:03.379Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"true","language":"json","status":200}]},"settings":"","examples":{"codes":[{"language":"python","code":"'''\nThis is a Python 3.7 Module that deletes a payment methods 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_DELETE_PAYMENT = \"/paymentMethod\"\n\n    def calc_auth_sig_hash(self, url_body):\n        # calculates a signature per Wyre API:\n        # https://docs.sendwyre.com/docs/authentication#secret-key-signature-auth\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        # creates a timestamp to the millisecond\n        return str(round(time.time() * 1000))\n\n    def deletePaymentMethod(self, payment_id):\n        '''\n            Delete a payment method\n            DELETE https://api.testwyre.com/v2/paymentMethods\n        '''\n        if not payment_id:\n            print(\"Need to add a payment id\")\n            return\n\n        params = {\n            \"timestamp\": self.calcTimeStamp()\n        }\n        url = WyreApi.API_URL + WyreApi.API_VER2 + WyreApi.API_DELETE_PAYMENT \\\n            + \"/\" + payment_id + \"?\" + \\\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)\n        }\n\n        response = requests.delete(url, headers=headers)\n        if response.status_code == 200:\n            print(response)\n            return json.loads(response.text)\n        else:\n            print(response)\n            print(response.text)\n\n\nif __name__ == \"__main__\":\n\n    # initialize a Wyre Object\n    wyre = WyreApi()\n    payment_id = \"PA_GBU9DDFFDD4\"\n    # Get all payment methods\n    payments = wyre.deletePaymentMethod(payment_id)\n    if payments:\n        print(payments)\n"}]},"method":"delete","apiSetting":"5c50b085aae6150014b3e80e","auth":"required","params":[{"_id":"5c0589aea94f0f0209b6fb31","ref":"","in":"path","required":true,"desc":"ID of the payment method to be removed","default":"","type":"string","name":"paymentMethodId"}],"url":"/v2/paymentMethod/:paymentMethodId"},"isReference":true,"order":8,"body":"","excerpt":"","slug":"delete-payment-method","type":"endpoint","title":"Delete Payment Method"}