admin-payment-methods
Create customer payment method
Creates a payment method for a customer. Requires admin authentication.
POST
/
api
/
customers
/
{customer_id}
/
payment_methods
Create customer payment method
curl --request POST \
--url https://api.fluid.app/api/customers/{customer_id}/payment_methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"country_code": "<string>",
"payment_method": {
"token": "<string>",
"last_four": "<string>",
"card_network": "<string>",
"exp_month": 123,
"exp_year": 123,
"token_provider": "<string>"
},
"default_payment_method": true,
"billing_address": {
"address1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country_code": "<string>"
},
"set_customer_payment_method": true
}
'import requests
url = "https://api.fluid.app/api/customers/{customer_id}/payment_methods"
payload = {
"type": "<string>",
"country_code": "<string>",
"payment_method": {
"token": "<string>",
"last_four": "<string>",
"card_network": "<string>",
"exp_month": 123,
"exp_year": 123,
"token_provider": "<string>"
},
"default_payment_method": True,
"billing_address": {
"address1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country_code": "<string>"
},
"set_customer_payment_method": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
country_code: '<string>',
payment_method: {
token: '<string>',
last_four: '<string>',
card_network: '<string>',
exp_month: 123,
exp_year: 123,
token_provider: '<string>'
},
default_payment_method: true,
billing_address: {
address1: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
country_code: '<string>'
},
set_customer_payment_method: true
})
};
fetch('https://api.fluid.app/api/customers/{customer_id}/payment_methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fluid.app/api/customers/{customer_id}/payment_methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'country_code' => '<string>',
'payment_method' => [
'token' => '<string>',
'last_four' => '<string>',
'card_network' => '<string>',
'exp_month' => 123,
'exp_year' => 123,
'token_provider' => '<string>'
],
'default_payment_method' => true,
'billing_address' => [
'address1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'country_code' => '<string>'
],
'set_customer_payment_method' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fluid.app/api/customers/{customer_id}/payment_methods"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"country_code\": \"<string>\",\n \"payment_method\": {\n \"token\": \"<string>\",\n \"last_four\": \"<string>\",\n \"card_network\": \"<string>\",\n \"exp_month\": 123,\n \"exp_year\": 123,\n \"token_provider\": \"<string>\"\n },\n \"default_payment_method\": true,\n \"billing_address\": {\n \"address1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"set_customer_payment_method\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/customers/{customer_id}/payment_methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"country_code\": \"<string>\",\n \"payment_method\": {\n \"token\": \"<string>\",\n \"last_four\": \"<string>\",\n \"card_network\": \"<string>\",\n \"exp_month\": 123,\n \"exp_year\": 123,\n \"token_provider\": \"<string>\"\n },\n \"default_payment_method\": true,\n \"billing_address\": {\n \"address1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"set_customer_payment_method\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/customers/{customer_id}/payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"country_code\": \"<string>\",\n \"payment_method\": {\n \"token\": \"<string>\",\n \"last_four\": \"<string>\",\n \"card_network\": \"<string>\",\n \"exp_month\": 123,\n \"exp_year\": 123,\n \"token_provider\": \"<string>\"\n },\n \"default_payment_method\": true,\n \"billing_address\": {\n \"address1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"set_customer_payment_method\": true\n}"
response = http.request(request)
puts response.read_body{
"card": {
"active": true,
"card_network": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"customer_id": null,
"cvv_token": null,
"default": true,
"email": null,
"fingerprint": null,
"first_six_digits": null,
"fluid": true,
"fluid_pay_account_id": null,
"full_name": "<string>",
"last_four_digits": "<string>",
"member_id": null,
"month": 123,
"number": "<string>",
"test": true,
"token": "<string>",
"token_provider": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"user_id": null,
"uuid_v7": "<string>",
"year": 123,
"address_id": 123,
"billing_address": {
"name": "<string>",
"address1": "<string>",
"address2": "<string>",
"address3": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"subdivision_code": "<string>"
}
},
"customer": {
"default_payment_method_id": 123,
"id": 123
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
},
"payment_method": {
"au_status": null,
"created_at": "2023-11-07T05:31:56Z",
"default": true,
"details": {
"card_brand": "<string>",
"card_network": "<string>",
"exp_month": 123,
"exp_year": 123,
"id": 123,
"last4_digits": "<string>",
"last_four": "<string>",
"logo_url": "<string>",
"requires_3ds": true,
"type": "<string>",
"vgs_card_id": null
},
"id": 123,
"payment_title": "<string>",
"payment_type": "<string>",
"source": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"billing_address": {
"address1": null,
"address2": null,
"city": null,
"country_code": "<string>",
"name": null,
"postal_code": null,
"state": null,
"zip": null
}
},
"was_created": true
}{
"message": "<string>"
}Authorizations
Bearer token authentication
Path Parameters
The customer ID
Body
application/json
⌘I
Create customer payment method
curl --request POST \
--url https://api.fluid.app/api/customers/{customer_id}/payment_methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"country_code": "<string>",
"payment_method": {
"token": "<string>",
"last_four": "<string>",
"card_network": "<string>",
"exp_month": 123,
"exp_year": 123,
"token_provider": "<string>"
},
"default_payment_method": true,
"billing_address": {
"address1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country_code": "<string>"
},
"set_customer_payment_method": true
}
'import requests
url = "https://api.fluid.app/api/customers/{customer_id}/payment_methods"
payload = {
"type": "<string>",
"country_code": "<string>",
"payment_method": {
"token": "<string>",
"last_four": "<string>",
"card_network": "<string>",
"exp_month": 123,
"exp_year": 123,
"token_provider": "<string>"
},
"default_payment_method": True,
"billing_address": {
"address1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country_code": "<string>"
},
"set_customer_payment_method": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
country_code: '<string>',
payment_method: {
token: '<string>',
last_four: '<string>',
card_network: '<string>',
exp_month: 123,
exp_year: 123,
token_provider: '<string>'
},
default_payment_method: true,
billing_address: {
address1: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
country_code: '<string>'
},
set_customer_payment_method: true
})
};
fetch('https://api.fluid.app/api/customers/{customer_id}/payment_methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fluid.app/api/customers/{customer_id}/payment_methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'country_code' => '<string>',
'payment_method' => [
'token' => '<string>',
'last_four' => '<string>',
'card_network' => '<string>',
'exp_month' => 123,
'exp_year' => 123,
'token_provider' => '<string>'
],
'default_payment_method' => true,
'billing_address' => [
'address1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'country_code' => '<string>'
],
'set_customer_payment_method' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fluid.app/api/customers/{customer_id}/payment_methods"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"country_code\": \"<string>\",\n \"payment_method\": {\n \"token\": \"<string>\",\n \"last_four\": \"<string>\",\n \"card_network\": \"<string>\",\n \"exp_month\": 123,\n \"exp_year\": 123,\n \"token_provider\": \"<string>\"\n },\n \"default_payment_method\": true,\n \"billing_address\": {\n \"address1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"set_customer_payment_method\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/customers/{customer_id}/payment_methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"country_code\": \"<string>\",\n \"payment_method\": {\n \"token\": \"<string>\",\n \"last_four\": \"<string>\",\n \"card_network\": \"<string>\",\n \"exp_month\": 123,\n \"exp_year\": 123,\n \"token_provider\": \"<string>\"\n },\n \"default_payment_method\": true,\n \"billing_address\": {\n \"address1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"set_customer_payment_method\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/customers/{customer_id}/payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"country_code\": \"<string>\",\n \"payment_method\": {\n \"token\": \"<string>\",\n \"last_four\": \"<string>\",\n \"card_network\": \"<string>\",\n \"exp_month\": 123,\n \"exp_year\": 123,\n \"token_provider\": \"<string>\"\n },\n \"default_payment_method\": true,\n \"billing_address\": {\n \"address1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"set_customer_payment_method\": true\n}"
response = http.request(request)
puts response.read_body{
"card": {
"active": true,
"card_network": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"customer_id": null,
"cvv_token": null,
"default": true,
"email": null,
"fingerprint": null,
"first_six_digits": null,
"fluid": true,
"fluid_pay_account_id": null,
"full_name": "<string>",
"last_four_digits": "<string>",
"member_id": null,
"month": 123,
"number": "<string>",
"test": true,
"token": "<string>",
"token_provider": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"user_id": null,
"uuid_v7": "<string>",
"year": 123,
"address_id": 123,
"billing_address": {
"name": "<string>",
"address1": "<string>",
"address2": "<string>",
"address3": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"subdivision_code": "<string>"
}
},
"customer": {
"default_payment_method_id": 123,
"id": 123
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
},
"payment_method": {
"au_status": null,
"created_at": "2023-11-07T05:31:56Z",
"default": true,
"details": {
"card_brand": "<string>",
"card_network": "<string>",
"exp_month": 123,
"exp_year": 123,
"id": 123,
"last4_digits": "<string>",
"last_four": "<string>",
"logo_url": "<string>",
"requires_3ds": true,
"type": "<string>",
"vgs_card_id": null
},
"id": 123,
"payment_title": "<string>",
"payment_type": "<string>",
"source": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"billing_address": {
"address1": null,
"address2": null,
"city": null,
"country_code": "<string>",
"name": null,
"postal_code": null,
"state": null,
"zip": null
}
},
"was_created": true
}{
"message": "<string>"
}