> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://beta-docs.payabli.com/developer-guides/tokenization-add/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://beta-docs.payabli.com/_mcp/server. # Save a payment method This guide explains how to save a payment method for reuse via tokenization with the Payabli API. This call exchanges sensitive payment information for a token that you can use to process future transactions. ## PCI information Because improperly handling customer card data can result in fines and impact your ability to process transactions, you must understand and fulfill PCI security requirements. When using the direct-access APIs, you must make sure that your systems and practices meet PCI requirements. If you have any questions about how to maintain PCI compliance, reach out to the Payabli team. > **Note** > > For a built in PCI-compliant experience, consider using Payabli's embedded components instead of the direct-access API. You can use the [PayMethod UI](developer-guides/embedded-components-paymethodui) or [EmbeddedMethod UI](developer-guides/embedded-components-embeddedmethodui) to save a payment method. ## Build the request Send a POST request to `/api/TokenStorage/add` to save a payment method. For complete information, see the [API reference](/api-reference/tokenstorage/save-a-payment-method-tokenize) for this endpoint. This endpoint accepts several optional parameters that you can use to customize the request. **`temporary`** `boolean` — default: false Creates a temporary, one-time-use token for the payment method that expires in 12 hours. --- **`achValidation`** `boolean` — default: false When `true`, enables real-time validation of ACH account. This is an add-on feature. Contact Payabli for more information. --- **`forceCustomerCreation`** `boolean` — default: false When set to `true`, a new customer record will be created even if an existing customer record is found. Possible values: `true` or `false`. Default is `false`. --- **`createAnonymous`** `boolean` — default: false When `true`, the request doesn't require you to pass the `customerData` object, and creates the token with no customer information attached. When the token is used to make a payment for the first time, it will be associated to the customer making the payment. --- The response returns a `ReferenceId`, which is both the `storedMethodId` to use with transactions, and the `methodId` used to manage the payment method. ## Examples These examples show how to save various payment methods using the API. #### Tokenize a card This example shows how to save a card payment method. The request includes the `customerData` object with an existing customer's ID `4440`. ### Request POST [https://api-sandbox.payabli.com/api/TokenStorage/add](https://api-sandbox.payabli.com/api/TokenStorage/add) **`TokenizeCard`** ```curl TokenizeCard curl -X POST https://api-sandbox.payabli.com/api/TokenStorage/add \ -H "requestToken: " \ -H "Content-Type: application/json" \ -d '{ "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "fallbackAuth": true, "paymentMethod": { "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" } }' ``` **`TokenizeCard`** ```python TokenizeCard import requests url = "https://api-sandbox.payabli.com/api/TokenStorage/add" payload = { "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "fallbackAuth": True, "paymentMethod": { "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" } } headers = { "requestToken": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` **`TokenizeCard`** ```javascript TokenizeCard const url = 'https://api-sandbox.payabli.com/api/TokenStorage/add'; const options = { method: 'POST', headers: {requestToken: '', 'Content-Type': 'application/json'}, body: '{"customerData":{"customerId":4440},"entryPoint":"f743aed24a","fallbackAuth":true,"paymentMethod":{"cardcvv":"123","cardexp":"02/25","cardHolder":"John Doe","cardnumber":"4111111111111111","cardzip":"12345","method":"card"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` **`TokenizeCard`** ```go TokenizeCard package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/TokenStorage/add" payload := strings.NewReader("{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("requestToken", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` **`TokenizeCard`** ```ruby TokenizeCard require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/TokenStorage/add") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}" response = http.request(request) puts response.read_body ``` **`TokenizeCard`** ```java TokenizeCard import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/TokenStorage/add") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}") .asString(); ``` **`TokenizeCard`** ```php TokenizeCard request('POST', 'https://api-sandbox.payabli.com/api/TokenStorage/add', [ 'body' => '{ "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "fallbackAuth": true, "paymentMethod": { "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" } }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` **`TokenizeCard`** ```csharp TokenizeCard using RestSharp; var client = new RestClient("https://api-sandbox.payabli.com/api/TokenStorage/add"); var request = new RestRequest(Method.POST); request.AddHeader("requestToken", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` **`TokenizeCard`** ```swift TokenizeCard import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "customerData": ["customerId": 4440], "entryPoint": "f743aed24a", "fallbackAuth": true, "paymentMethod": [ "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/TokenStorage/add")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` Returns a response like this: ### Response (200) ```json { "isSuccess": true, "responseData": { "CustomerId": 4400, "methodReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ResultCode": 1, "ResultText": "Approved" }, "responseText": "Success" } ``` #### Create anonymous Token This example uses the `createAnonymous` parameter to create a token without customer information. The token is associated with the customer when it is used for the first time. ### Request POST [https://api-sandbox.payabli.com/api/TokenStorage/add](https://api-sandbox.payabli.com/api/TokenStorage/add) **`TokenizeCardAnonymous`** ```curl TokenizeCardAnonymous curl -X POST "https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true" \ -H "requestToken: " \ -H "Content-Type: application/json" \ -d '{ "entryPoint": "f743aed24a", "fallbackAuth": true, "paymentMethod": { "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" } }' ``` **`TokenizeCardAnonymous`** ```python TokenizeCardAnonymous import requests url = "https://api-sandbox.payabli.com/api/TokenStorage/add" querystring = {"createAnonymous":"true"} payload = { "entryPoint": "f743aed24a", "fallbackAuth": True, "paymentMethod": { "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" } } headers = { "requestToken": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers, params=querystring) print(response.json()) ``` **`TokenizeCardAnonymous`** ```javascript TokenizeCardAnonymous const url = 'https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true'; const options = { method: 'POST', headers: {requestToken: '', 'Content-Type': 'application/json'}, body: '{"entryPoint":"f743aed24a","fallbackAuth":true,"paymentMethod":{"cardcvv":"123","cardexp":"02/25","cardHolder":"John Doe","cardnumber":"4111111111111111","cardzip":"12345","method":"card"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` **`TokenizeCardAnonymous`** ```go TokenizeCardAnonymous package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true" payload := strings.NewReader("{\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("requestToken", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` **`TokenizeCardAnonymous`** ```ruby TokenizeCardAnonymous require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}" response = http.request(request) puts response.read_body ``` **`TokenizeCardAnonymous`** ```java TokenizeCardAnonymous import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}") .asString(); ``` **`TokenizeCardAnonymous`** ```php TokenizeCardAnonymous request('POST', 'https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true', [ 'body' => '{ "entryPoint": "f743aed24a", "fallbackAuth": true, "paymentMethod": { "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" } }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` **`TokenizeCardAnonymous`** ```csharp TokenizeCardAnonymous using RestSharp; var client = new RestClient("https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true"); var request = new RestRequest(Method.POST); request.AddHeader("requestToken", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"paymentMethod\": {\n \"cardcvv\": \"123\",\n \"cardexp\": \"02/25\",\n \"cardHolder\": \"John Doe\",\n \"cardnumber\": \"4111111111111111\",\n \"cardzip\": \"12345\",\n \"method\": \"card\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` **`TokenizeCardAnonymous`** ```swift TokenizeCardAnonymous import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "entryPoint": "f743aed24a", "fallbackAuth": true, "paymentMethod": [ "cardcvv": "123", "cardexp": "02/25", "cardHolder": "John Doe", "cardnumber": "4111111111111111", "cardzip": "12345", "method": "card" ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/TokenStorage/add?createAnonymous=true")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` Returns a response like this: ### Response (200) ```json { "isSuccess": true, "responseData": { "CustomerId": null, "methodReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ResultCode": 1, "ResultText": "Approved" }, "responseText": "Success" } ``` #### Convert a temp token to permanent This example converts a temporary token to a permanent token. The `temporary` parameter is set to `true` in the request, and the response returns a permanent token. ### Request POST [https://api-sandbox.payabli.com/api/TokenStorage/add](https://api-sandbox.payabli.com/api/TokenStorage/add) **`TemptoPermanent`** ```curl TemptoPermanent curl -X POST https://api-sandbox.payabli.com/api/TokenStorage/add \ -H "requestToken: " \ -H "Content-Type: application/json" \ -d '{ "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "fallbackAuth": true, "methodDescription": "Main card", "paymentMethod": { "method": "card", "tokenId": "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224" } }' ``` **`TemptoPermanent`** ```python TemptoPermanent import requests url = "https://api-sandbox.payabli.com/api/TokenStorage/add" payload = { "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "fallbackAuth": True, "methodDescription": "Main card", "paymentMethod": { "method": "card", "tokenId": "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224" } } headers = { "requestToken": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` **`TemptoPermanent`** ```javascript TemptoPermanent const url = 'https://api-sandbox.payabli.com/api/TokenStorage/add'; const options = { method: 'POST', headers: {requestToken: '', 'Content-Type': 'application/json'}, body: '{"customerData":{"customerId":4440},"entryPoint":"f743aed24a","fallbackAuth":true,"methodDescription":"Main card","paymentMethod":{"method":"card","tokenId":"c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` **`TemptoPermanent`** ```go TemptoPermanent package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/TokenStorage/add" payload := strings.NewReader("{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"methodDescription\": \"Main card\",\n \"paymentMethod\": {\n \"method\": \"card\",\n \"tokenId\": \"c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("requestToken", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` **`TemptoPermanent`** ```ruby TemptoPermanent require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/TokenStorage/add") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"methodDescription\": \"Main card\",\n \"paymentMethod\": {\n \"method\": \"card\",\n \"tokenId\": \"c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224\"\n }\n}" response = http.request(request) puts response.read_body ``` **`TemptoPermanent`** ```java TemptoPermanent import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/TokenStorage/add") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"methodDescription\": \"Main card\",\n \"paymentMethod\": {\n \"method\": \"card\",\n \"tokenId\": \"c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224\"\n }\n}") .asString(); ``` **`TemptoPermanent`** ```php TemptoPermanent request('POST', 'https://api-sandbox.payabli.com/api/TokenStorage/add', [ 'body' => '{ "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "fallbackAuth": true, "methodDescription": "Main card", "paymentMethod": { "method": "card", "tokenId": "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224" } }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` **`TemptoPermanent`** ```csharp TemptoPermanent using RestSharp; var client = new RestClient("https://api-sandbox.payabli.com/api/TokenStorage/add"); var request = new RestRequest(Method.POST); request.AddHeader("requestToken", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"fallbackAuth\": true,\n \"methodDescription\": \"Main card\",\n \"paymentMethod\": {\n \"method\": \"card\",\n \"tokenId\": \"c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` **`TemptoPermanent`** ```swift TemptoPermanent import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "customerData": ["customerId": 4440], "entryPoint": "f743aed24a", "fallbackAuth": true, "methodDescription": "Main card", "paymentMethod": [ "method": "card", "tokenId": "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224" ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/TokenStorage/add")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` Returns a response like this: ### Response (200) ```json { "isSuccess": true, "responseData": { "CustomerId": 4440, "methodReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ResultCode": 1, "ResultText": "Approved" }, "responseText": "Success" } ``` #### Tokenize ACH This example tokenizes an ACH payment method. The `achValidation` parameter is set to `true` to enable real-time validation of the ACH account. ### Request POST [https://api-sandbox.payabli.com/api/TokenStorage/add](https://api-sandbox.payabli.com/api/TokenStorage/add) **`TokenizeACH`** ```curl TokenizeACH curl -X POST "https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true" \ -H "requestToken: " \ -H "Content-Type: application/json" \ -d '{ "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "paymentMethod": { "achAccount": "1111111111111", "achAccountType": "Checking", "achCode": "WEB", "achHolder": "John Doe", "achHolderType": "personal", "achRouting": "123456780", "method": "ach" } }' ``` **`TokenizeACH`** ```python TokenizeACH import requests url = "https://api-sandbox.payabli.com/api/TokenStorage/add" querystring = {"achValidation":"true"} payload = { "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "paymentMethod": { "achAccount": "1111111111111", "achAccountType": "Checking", "achCode": "WEB", "achHolder": "John Doe", "achHolderType": "personal", "achRouting": "123456780", "method": "ach" } } headers = { "requestToken": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers, params=querystring) print(response.json()) ``` **`TokenizeACH`** ```javascript TokenizeACH const url = 'https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true'; const options = { method: 'POST', headers: {requestToken: '', 'Content-Type': 'application/json'}, body: '{"customerData":{"customerId":4440},"entryPoint":"f743aed24a","paymentMethod":{"achAccount":"1111111111111","achAccountType":"Checking","achCode":"WEB","achHolder":"John Doe","achHolderType":"personal","achRouting":"123456780","method":"ach"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` **`TokenizeACH`** ```go TokenizeACH package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true" payload := strings.NewReader("{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"paymentMethod\": {\n \"achAccount\": \"1111111111111\",\n \"achAccountType\": \"Checking\",\n \"achCode\": \"WEB\",\n \"achHolder\": \"John Doe\",\n \"achHolderType\": \"personal\",\n \"achRouting\": \"123456780\",\n \"method\": \"ach\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("requestToken", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` **`TokenizeACH`** ```ruby TokenizeACH require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"paymentMethod\": {\n \"achAccount\": \"1111111111111\",\n \"achAccountType\": \"Checking\",\n \"achCode\": \"WEB\",\n \"achHolder\": \"John Doe\",\n \"achHolderType\": \"personal\",\n \"achRouting\": \"123456780\",\n \"method\": \"ach\"\n }\n}" response = http.request(request) puts response.read_body ``` **`TokenizeACH`** ```java TokenizeACH import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"paymentMethod\": {\n \"achAccount\": \"1111111111111\",\n \"achAccountType\": \"Checking\",\n \"achCode\": \"WEB\",\n \"achHolder\": \"John Doe\",\n \"achHolderType\": \"personal\",\n \"achRouting\": \"123456780\",\n \"method\": \"ach\"\n }\n}") .asString(); ``` **`TokenizeACH`** ```php TokenizeACH request('POST', 'https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true', [ 'body' => '{ "customerData": { "customerId": 4440 }, "entryPoint": "f743aed24a", "paymentMethod": { "achAccount": "1111111111111", "achAccountType": "Checking", "achCode": "WEB", "achHolder": "John Doe", "achHolderType": "personal", "achRouting": "123456780", "method": "ach" } }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` **`TokenizeACH`** ```csharp TokenizeACH using RestSharp; var client = new RestClient("https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true"); var request = new RestRequest(Method.POST); request.AddHeader("requestToken", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"customerData\": {\n \"customerId\": 4440\n },\n \"entryPoint\": \"f743aed24a\",\n \"paymentMethod\": {\n \"achAccount\": \"1111111111111\",\n \"achAccountType\": \"Checking\",\n \"achCode\": \"WEB\",\n \"achHolder\": \"John Doe\",\n \"achHolderType\": \"personal\",\n \"achRouting\": \"123456780\",\n \"method\": \"ach\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` **`TokenizeACH`** ```swift TokenizeACH import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "customerData": ["customerId": 4440], "entryPoint": "f743aed24a", "paymentMethod": [ "achAccount": "1111111111111", "achAccountType": "Checking", "achCode": "WEB", "achHolder": "John Doe", "achHolderType": "personal", "achRouting": "123456780", "method": "ach" ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` Returns a response like this: ### Response (200) ```json { "isSuccess": true, "responseData": { "CustomerId": 4440, "methodReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ReferenceId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", "ResultCode": 1, "ResultText": "Approved" }, "responseText": "Success" } ``` ## Managing tokenized payment methods You can manage saved payment methods with the following endpoints: * [Delete a payment method](/api-reference/tokenstorage/remove-a-payment-method) * [Update a payment method](/api-reference/tokenstorage/update-a-payment-method) * [Get a payment method](/api-reference/tokenstorage/get-a-payment-method) > If you're a software company, you're a payments company™