# Tokenize payment method POST https://api-sandbox.payabli.com/api/TokenStorage/add Content-Type: application/json Saves a payment method for reuse. This call exchanges sensitive payment information for a token that can be used to process future transactions. The `ReferenceId` value in the response is the `storedMethodId` to use with transactions. Reference: https://docs.payabli.com/developers/api-reference/tokenstorage/save-a-payment-method-tokenize ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Save a payment method (tokenize) version: endpoint_tokenStorage.AddMethod paths: /TokenStorage/add: post: operationId: add-method summary: Save a payment method (tokenize) description: >- Saves a payment method for reuse. This call exchanges sensitive payment information for a token that can be used to process future transactions. The `ReferenceId` value in the response is the `storedMethodId` to use with transactions. tags: - - subpackage_tokenStorage parameters: - name: achValidation in: query required: false schema: $ref: '#/components/schemas/type_:AchValidation' - name: createAnonymous in: query required: true schema: $ref: '#/components/schemas/type_tokenStorage:CreateAnonymous' - name: forceCustomerCreation in: query required: false schema: $ref: '#/components/schemas/type_:ForceCustomerCreation' - name: temporary in: query required: true schema: $ref: '#/components/schemas/type_tokenStorage:Temporary' - name: requestToken in: header required: true schema: type: string - name: idempotencyKey in: header required: false schema: $ref: '#/components/schemas/type_:IdempotencyKey' responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_tokenStorage:AddMethodResponse' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/type_tokenStorage:RequestTokenStorage' components: schemas: type_:AchValidation: type: boolean type_tokenStorage:CreateAnonymous: type: boolean type_:ForceCustomerCreation: type: boolean type_tokenStorage:Temporary: type: boolean type_:IdempotencyKey: type: string type_:AdditionalData: type: object additionalProperties: type: object additionalProperties: description: Any type type_:BillingAddressNullable: type: string type_:BillingAddressAddtlNullable: type: string type_:BillingCityNullable: type: string type_:BillingCountryNullable: type: string type_:Email: type: string format: email type_:PhoneNumber: type: string type_:BillingStateNullable: type: string type_:BillingZip: type: string type_:CustomerId: type: integer format: int64 type_:CustomerNumberNullable: type: string type_:Identifierfields: type: array items: type: string type_:Shippingaddress: type: string type_:Shippingaddressadditional: type: string type_:Shippingcity: type: string type_:Shippingcountry: type: string type_:Shippingstate: type: string type_:Shippingzip: type: string type_:PayorDataRequest: type: object properties: additionalData: $ref: '#/components/schemas/type_:AdditionalData' billingAddress1: $ref: '#/components/schemas/type_:BillingAddressNullable' billingAddress2: $ref: '#/components/schemas/type_:BillingAddressAddtlNullable' billingCity: $ref: '#/components/schemas/type_:BillingCityNullable' billingCountry: $ref: '#/components/schemas/type_:BillingCountryNullable' billingEmail: $ref: '#/components/schemas/type_:Email' billingPhone: $ref: '#/components/schemas/type_:PhoneNumber' billingState: $ref: '#/components/schemas/type_:BillingStateNullable' billingZip: $ref: '#/components/schemas/type_:BillingZip' description: >- Customer's billing ZIP code. For Pay In functions, this field supports 5-digit and 9-digit ZIP codes and alphanumeric Canadian postal codes. For example: "37615-1234" or "37615". company: type: string description: Customer's company name. customerId: $ref: '#/components/schemas/type_:CustomerId' customerNumber: $ref: '#/components/schemas/type_:CustomerNumberNullable' firstName: type: string description: Customer/Payor first name. identifierFields: $ref: '#/components/schemas/type_:Identifierfields' lastName: type: string description: Customer/Payor last name. shippingAddress1: $ref: '#/components/schemas/type_:Shippingaddress' shippingAddress2: $ref: '#/components/schemas/type_:Shippingaddressadditional' shippingCity: $ref: '#/components/schemas/type_:Shippingcity' shippingCountry: $ref: '#/components/schemas/type_:Shippingcountry' shippingState: $ref: '#/components/schemas/type_:Shippingstate' shippingZip: $ref: '#/components/schemas/type_:Shippingzip' type_:Entrypointfield: type: string type_:Cardcvv: type: string type_:Cardexp: type: string type_:Cardholder: type: string type_:Cardnumber: type: string type_:Cardzip: type: string type_tokenStorage:TokenizeCard: type: object properties: method: type: string description: >- The type of payment method to tokenize. For cards, this is always `card`. cardcvv: $ref: '#/components/schemas/type_:Cardcvv' cardexp: $ref: '#/components/schemas/type_:Cardexp' cardHolder: $ref: '#/components/schemas/type_:Cardholder' cardnumber: $ref: '#/components/schemas/type_:Cardnumber' cardzip: $ref: '#/components/schemas/type_:Cardzip' required: - method - cardexp - cardHolder - cardnumber type_:Achaccount: type: string type_:Achaccounttype: type: string enum: - value: Checking - value: Savings type_:AchSecCode: type: string type_:AchHolder: type: string type_:AchHolderType: type: string enum: - value: personal - value: business default: personal type_:Achrouting: type: string type_:Device: type: string type_tokenStorage:TokenizeACH: type: object properties: method: type: string description: >- The type of payment method to tokenize. For ACH, this is always `ach`. achAccount: $ref: '#/components/schemas/type_:Achaccount' achAccountType: $ref: '#/components/schemas/type_:Achaccounttype' achCode: $ref: '#/components/schemas/type_:AchSecCode' achHolder: $ref: '#/components/schemas/type_:AchHolder' achHolderType: $ref: '#/components/schemas/type_:AchHolderType' achRouting: $ref: '#/components/schemas/type_:Achrouting' device: $ref: '#/components/schemas/type_:Device' required: - method - achAccount - achAccountType - achHolder - achRouting type_tokenStorage:ConvertToken: type: object properties: method: type: string description: >- The type of payment method to tokenize. When converting a temp token to a permanent token, this should match the `method` set for the temporary token, either `ach` or `card`. tokenId: type: string description: A temporary stored token ID to be converted to permanent. required: - method - tokenId type_tokenStorage:RequestTokenStoragePaymentMethod: oneOf: - $ref: '#/components/schemas/type_tokenStorage:TokenizeCard' - $ref: '#/components/schemas/type_tokenStorage:TokenizeACH' - $ref: '#/components/schemas/type_tokenStorage:ConvertToken' type_tokenStorage:VendorDataRequest: type: object properties: vendorId: type: integer format: int64 description: >- The unique numeric ID assigned to the vendor in Payabli. Either `vendorId` or `vendorNumber` is required. vendorNumber: type: string description: >- Custom vendor number assigned by the business. Either `vendorId` or `vendorNumber` is required. type_:Source: type: string type_:Subdomain: type: string type_tokenStorage:RequestTokenStorage: type: object properties: customerData: $ref: '#/components/schemas/type_:PayorDataRequest' description: >- Object describing the Customer/Payor owner of payment method. Required for POST requests. Which fields are required depends on the paypoint's custom identifier settings. entryPoint: $ref: '#/components/schemas/type_:Entrypointfield' description: Entrypoint identifier. Required for POST requests. fallbackAuth: type: boolean default: false description: >- When `true`, if tokenization fails, Payabli will attempt an authorization transaction to request a permanent token for the card. If the authorization is successful, the card will be tokenized and the authorization will be voided automatically. fallbackAuthAmount: type: integer default: 100 description: >- The amount for the `fallbackAuth` transaction. Defaults to one dollar (`100`). methodDescription: type: string description: Custom description for stored payment method. paymentMethod: $ref: >- #/components/schemas/type_tokenStorage:RequestTokenStoragePaymentMethod description: Information about the payment method for the transaction. vendorData: $ref: '#/components/schemas/type_tokenStorage:VendorDataRequest' source: $ref: '#/components/schemas/type_:Source' description: Custom identifier to indicate the source for the request subdomain: $ref: '#/components/schemas/type_:Subdomain' type_:IsSuccess: type: boolean type_:ResponseText: type: string type_:MethodReferenceId: type: string type_:ResultCode: type: integer type_:Resulttext: type: string type_tokenStorage:AddMethodResponseResponseData: type: object properties: referenceId: $ref: '#/components/schemas/type_:MethodReferenceId' description: >- Stored method identifier in Payabli platform. This ID is used to manage the stored method. resultCode: $ref: '#/components/schemas/type_:ResultCode' resultText: $ref: '#/components/schemas/type_:Resulttext' customerId: $ref: '#/components/schemas/type_:CustomerId' description: >- Internal unique ID of customer owner of the stored method. Returns `0` if the method wasn't assigned to an existing customer or no customer was created." methodReferenceId: $ref: '#/components/schemas/type_:MethodReferenceId' type_tokenStorage:AddMethodResponse: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseText: $ref: '#/components/schemas/type_:ResponseText' responseData: $ref: '#/components/schemas/type_tokenStorage:AddMethodResponseResponseData' required: - responseText ``` ## SDK Code Examples ```python TokenizeCard from payabli import PayorDataRequest, payabli from payabli.token_storage import TokenizeCard client = payabli( api_key="YOUR_API_KEY", ) client.token_storage.add_method( customer_data=PayorDataRequest( customer_id=4440, ), entry_point="f743aed24a", fallback_auth=True, payment_method=TokenizeCard( cardcvv="123", cardexp="02/25", card_holder="John Doe", cardnumber="4111111111111111", cardzip="12345", method="card", ), ) ``` ```typescript TokenizeCard import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.tokenStorage.addMethod({ body: { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", fallbackAuth: true, paymentMethod: { cardcvv: "123", cardexp: "02/25", cardHolder: "John Doe", cardnumber: "4111111111111111", cardzip: "12345", method: "card" } } }); ``` ```go TokenizeCard import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.TokenStorage.AddMethod( context.TODO(), &sdkgo.AddMethodRequest{ Body: &sdkgo.RequestTokenStorage{ CustomerData: &sdkgo.PayorDataRequest{ CustomerId: sdkgo.Int64( 4440, ), }, EntryPoint: sdkgo.String( "f743aed24a", ), FallbackAuth: sdkgo.Bool( true, ), PaymentMethod: &sdkgo.RequestTokenStoragePaymentMethod{ TokenizeCard: &sdkgo.TokenizeCard{ Cardcvv: sdkgo.String( "123", ), Cardexp: "02/25", CardHolder: "John Doe", Cardnumber: "4111111111111111", Cardzip: sdkgo.String( "12345", ), Method: "card", }, }, }, }, ) ``` ```csharp TokenizeCard using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.TokenStorage.AddMethodAsync( new AddMethodRequest { Body = new RequestTokenStorage { CustomerData = new PayorDataRequest { CustomerId = 4440 }, EntryPoint = "f743aed24a", FallbackAuth = true, PaymentMethod = new TokenizeCard { Cardcvv = "123", Cardexp = "02/25", CardHolder = "John Doe", Cardnumber = "4111111111111111", Cardzip = "12345", Method = "card", }, }, } ); ``` ```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 ``` ```java TokenizeCard 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(); ``` ```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(); ``` ```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() ``` ```python TokenizeCardAnonymous from payabli import payabli from payabli.token_storage import TokenizeCard client = payabli( api_key="YOUR_API_KEY", ) client.token_storage.add_method( create_anonymous=True, entry_point="f743aed24a", fallback_auth=True, payment_method=TokenizeCard( cardcvv="123", cardexp="02/25", card_holder="John Doe", cardnumber="4111111111111111", cardzip="12345", method="card", ), ) ``` ```typescript TokenizeCardAnonymous import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.tokenStorage.addMethod({ createAnonymous: true, body: { entryPoint: "f743aed24a", fallbackAuth: true, paymentMethod: { cardcvv: "123", cardexp: "02/25", cardHolder: "John Doe", cardnumber: "4111111111111111", cardzip: "12345", method: "card" } } }); ``` ```go TokenizeCardAnonymous import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.TokenStorage.AddMethod( context.TODO(), &sdkgo.AddMethodRequest{ Body: &sdkgo.RequestTokenStorage{ CustomerData: &sdkgo.PayorDataRequest{ CustomerId: sdkgo.Int64( 4440, ), }, EntryPoint: sdkgo.String( "f743aed24a", ), FallbackAuth: sdkgo.Bool( true, ), PaymentMethod: &sdkgo.RequestTokenStoragePaymentMethod{ TokenizeCard: &sdkgo.TokenizeCard{ Cardcvv: sdkgo.String( "123", ), Cardexp: "02/25", CardHolder: "John Doe", Cardnumber: "4111111111111111", Cardzip: sdkgo.String( "12345", ), Method: "card", }, }, }, }, ) ``` ```csharp TokenizeCardAnonymous using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.TokenStorage.AddMethodAsync( new AddMethodRequest { CreateAnonymous = true, Body = new RequestTokenStorage { EntryPoint = "f743aed24a", FallbackAuth = true, PaymentMethod = new TokenizeCard { Cardcvv = "123", Cardexp = "02/25", CardHolder = "John Doe", Cardnumber = "4111111111111111", Cardzip = "12345", Method = "card", }, }, } ); ``` ```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 ``` ```java TokenizeCardAnonymous 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(); ``` ```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(); ``` ```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() ``` ```python TemptoPermanent from payabli import PayorDataRequest, payabli from payabli.token_storage import ConvertToken client = payabli( api_key="YOUR_API_KEY", ) client.token_storage.add_method( customer_data=PayorDataRequest( customer_id=4440, ), entry_point="f743aed24a", fallback_auth=True, method_description="Main card", payment_method=ConvertToken( method="card", token_id="c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224", ), ) ``` ```typescript TemptoPermanent import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.tokenStorage.addMethod({ body: { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", fallbackAuth: true, methodDescription: "Main card", paymentMethod: { method: "card", tokenId: "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224" } } }); ``` ```go TemptoPermanent import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.TokenStorage.AddMethod( context.TODO(), &sdkgo.AddMethodRequest{ Body: &sdkgo.RequestTokenStorage{ CustomerData: &sdkgo.PayorDataRequest{ CustomerId: sdkgo.Int64( 4440, ), }, EntryPoint: sdkgo.String( "f743aed24a", ), FallbackAuth: sdkgo.Bool( true, ), PaymentMethod: &sdkgo.RequestTokenStoragePaymentMethod{ TokenizeCard: &sdkgo.TokenizeCard{ Cardcvv: sdkgo.String( "123", ), Cardexp: "02/25", CardHolder: "John Doe", Cardnumber: "4111111111111111", Cardzip: sdkgo.String( "12345", ), Method: "card", }, }, }, }, ) ``` ```csharp TemptoPermanent using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.TokenStorage.AddMethodAsync( new AddMethodRequest { Body = new RequestTokenStorage { CustomerData = new PayorDataRequest { CustomerId = 4440 }, EntryPoint = "f743aed24a", FallbackAuth = true, MethodDescription = "Main card", PaymentMethod = new ConvertToken { Method = "card", TokenId = "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224", }, }, } ); ``` ```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 ``` ```java TemptoPermanent 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(); ``` ```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(); ``` ```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() ``` ```python TokenizeACH from payabli import PayorDataRequest, payabli from payabli.token_storage import TokenizeAch client = payabli( api_key="YOUR_API_KEY", ) client.token_storage.add_method( ach_validation=True, customer_data=PayorDataRequest( customer_id=4440, ), entry_point="f743aed24a", payment_method=TokenizeAch( ach_account="1111111111111", ach_account_type="Checking", ach_code="WEB", ach_holder="John Doe", ach_holder_type="personal", ach_routing="123456780", method="ach", ), ) ``` ```typescript TokenizeACH import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.tokenStorage.addMethod({ achValidation: true, body: { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", paymentMethod: { achAccount: "1111111111111", achAccountType: "Checking", achCode: "WEB", achHolder: "John Doe", achHolderType: "personal", achRouting: "123456780", method: "ach" } } }); ``` ```go TokenizeACH import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.TokenStorage.AddMethod( context.TODO(), &sdkgo.AddMethodRequest{ Body: &sdkgo.RequestTokenStorage{ CustomerData: &sdkgo.PayorDataRequest{ CustomerId: sdkgo.Int64( 4440, ), }, EntryPoint: sdkgo.String( "f743aed24a", ), FallbackAuth: sdkgo.Bool( true, ), PaymentMethod: &sdkgo.RequestTokenStoragePaymentMethod{ TokenizeCard: &sdkgo.TokenizeCard{ Cardcvv: sdkgo.String( "123", ), Cardexp: "02/25", CardHolder: "John Doe", Cardnumber: "4111111111111111", Cardzip: sdkgo.String( "12345", ), Method: "card", }, }, }, }, ) ``` ```csharp TokenizeACH using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.TokenStorage.AddMethodAsync( new AddMethodRequest { AchValidation = true, Body = new RequestTokenStorage { CustomerData = new PayorDataRequest { CustomerId = 4440 }, EntryPoint = "f743aed24a", PaymentMethod = new TokenizeAch { AchAccount = "1111111111111", AchAccountType = Achaccounttype.Checking, AchCode = "WEB", AchHolder = "John Doe", AchHolderType = AchHolderType.Personal, AchRouting = "123456780", Method = "ach", }, }, } ); ``` ```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 ``` ```java TokenizeACH 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(); ``` ```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(); ``` ```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() ``` ```python TokenizeVendorACH from payabli import payabli from payabli.token_storage import TokenizeAch, VendorDataRequest client = payabli( api_key="YOUR_API_KEY", ) client.token_storage.add_method( ach_validation=True, entry_point="f743aed24a", payment_method=TokenizeAch( ach_account="1111111111111", ach_account_type="Checking", ach_code="WEB", ach_holder="John Doe", ach_holder_type="personal", ach_routing="123456780", method="ach", ), vendor_data=VendorDataRequest( vendor_id=7890, ), ) ``` ```typescript TokenizeVendorACH import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.tokenStorage.addMethod({ achValidation: true, body: { entryPoint: "f743aed24a", paymentMethod: { achAccount: "1111111111111", achAccountType: "Checking", achCode: "WEB", achHolder: "John Doe", achHolderType: "personal", achRouting: "123456780", method: "ach" }, vendorData: { vendorId: 7890 } } }); ``` ```go TokenizeVendorACH import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.TokenStorage.AddMethod( context.TODO(), &sdkgo.AddMethodRequest{ Body: &sdkgo.RequestTokenStorage{ CustomerData: &sdkgo.PayorDataRequest{ CustomerId: sdkgo.Int64( 4440, ), }, EntryPoint: sdkgo.String( "f743aed24a", ), FallbackAuth: sdkgo.Bool( true, ), PaymentMethod: &sdkgo.RequestTokenStoragePaymentMethod{ TokenizeCard: &sdkgo.TokenizeCard{ Cardcvv: sdkgo.String( "123", ), Cardexp: "02/25", CardHolder: "John Doe", Cardnumber: "4111111111111111", Cardzip: sdkgo.String( "12345", ), Method: "card", }, }, }, }, ) ``` ```csharp TokenizeVendorACH using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.TokenStorage.AddMethodAsync( new AddMethodRequest { AchValidation = true, Body = new RequestTokenStorage { EntryPoint = "f743aed24a", PaymentMethod = new TokenizeAch { AchAccount = "1111111111111", AchAccountType = Achaccounttype.Checking, AchCode = "WEB", AchHolder = "John Doe", AchHolderType = AchHolderType.Personal, AchRouting = "123456780", Method = "ach", }, VendorData = new VendorDataRequest { VendorId = 7890 }, }, } ); ``` ```ruby TokenizeVendorACH 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 \"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 \"vendorData\": {\n \"vendorId\": 7890\n }\n}" response = http.request(request) puts response.read_body ``` ```java TokenizeVendorACH HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\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 \"vendorData\": {\n \"vendorId\": 7890\n }\n}") .asString(); ``` ```php TokenizeVendorACH request('POST', 'https://api-sandbox.payabli.com/api/TokenStorage/add?achValidation=true', [ 'body' => '{ "entryPoint": "f743aed24a", "paymentMethod": { "achAccount": "1111111111111", "achAccountType": "Checking", "achCode": "WEB", "achHolder": "John Doe", "achHolderType": "personal", "achRouting": "123456780", "method": "ach" }, "vendorData": { "vendorId": 7890 } }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift TokenizeVendorACH import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "entryPoint": "f743aed24a", "paymentMethod": [ "achAccount": "1111111111111", "achAccountType": "Checking", "achCode": "WEB", "achHolder": "John Doe", "achHolderType": "personal", "achRouting": "123456780", "method": "ach" ], "vendorData": ["vendorId": 7890] ] 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() ```