Setup a payment method
curl --request POST \
--url https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods \
--header 'X-SALESBRICKS-KEY: <api-key>'import requests
url = "https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods"
headers = {"X-SALESBRICKS-KEY": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-SALESBRICKS-KEY': '<api-key>'}};
fetch('https://api.salesbricks.com/api/v2/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.salesbricks.com/api/v2/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_HTTPHEADER => [
"X-SALESBRICKS-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-SALESBRICKS-KEY", "<api-key>")
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.salesbricks.com/api/v2/customers/{customer_id}/payment-methods")
.header("X-SALESBRICKS-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"stripe_account_id": "acct_1ABC123def456789",
"client_secret": "seti_1ABC123def456789_secret_xyz789",
"publishable_key": "pk_test_ABC123def456789xyz",
"customer_session_client_secret": "cuss_1ABC123def456789_secret_xyz789"
}Payment Methods
Setup a payment method
Creates a Stripe SetupIntent for adding payment methods to a subscription. Returns the necessary Stripe credentials to initialize the payment form. Supports card, bank account, and SEPA direct debit payment methods.
POST
/
customers
/
{customer_id}
/
payment-methods
Setup a payment method
curl --request POST \
--url https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods \
--header 'X-SALESBRICKS-KEY: <api-key>'import requests
url = "https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods"
headers = {"X-SALESBRICKS-KEY": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-SALESBRICKS-KEY': '<api-key>'}};
fetch('https://api.salesbricks.com/api/v2/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.salesbricks.com/api/v2/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_HTTPHEADER => [
"X-SALESBRICKS-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-SALESBRICKS-KEY", "<api-key>")
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.salesbricks.com/api/v2/customers/{customer_id}/payment-methods")
.header("X-SALESBRICKS-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/customers/{customer_id}/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"stripe_account_id": "acct_1ABC123def456789",
"client_secret": "seti_1ABC123def456789_secret_xyz789",
"publishable_key": "pk_test_ABC123def456789xyz",
"customer_session_client_secret": "cuss_1ABC123def456789_secret_xyz789"
}Authorizations
API key for authentication
Path Parameters
Pattern:
^([a-zA-Z\d\-]+)$Response
200 - application/json
Serializer for the payment method setup response containing Stripe credentials needed to initialize payment forms.
The tenant's connected Stripe account ID
Client secret for creating a payment intent within Stripe Elements
Salesbricks' platform public key for Stripe
Client secret for the customer session to enable payment element features