curl --request POST \
--url http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session \
--header 'Content-Type: application/json' \
--header 'wb-key: <api-key>' \
--data '
{
"address": true,
"operation": "add_method",
"detach_previous_on_success": true,
"plan_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"pricing_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"provider": "stripe"
}
'import requests
url = "http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session"
payload = {
"address": True,
"operation": "add_method",
"detach_previous_on_success": True,
"plan_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"pricing_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"provider": "stripe"
}
headers = {
"wb-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'wb-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: true,
operation: 'add_method',
detach_previous_on_success: true,
plan_id: 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
pricing_id: 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
provider: 'stripe'
})
};
fetch('http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session",
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([
'address' => true,
'operation' => 'add_method',
'detach_previous_on_success' => true,
'plan_id' => 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
'pricing_id' => 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
'provider' => 'stripe'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"wb-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"
"strings"
"net/http"
"io"
)
func main() {
url := "http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session"
payload := strings.NewReader("{\n \"address\": true,\n \"operation\": \"add_method\",\n \"detach_previous_on_success\": true,\n \"plan_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"pricing_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"provider\": \"stripe\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("wb-key", "<api-key>")
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("http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session")
.header("wb-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"address\": true,\n \"operation\": \"add_method\",\n \"detach_previous_on_success\": true,\n \"plan_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"pricing_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"provider\": \"stripe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["wb-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": true,\n \"operation\": \"add_method\",\n \"detach_previous_on_success\": true,\n \"plan_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"pricing_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"provider\": \"stripe\"\n}"
response = http.request(request)
puts response.read_body{
"address": true,
"customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"detach_previous_on_success": true,
"operation": "add_method",
"provider": "stripe",
"status": "<string>",
"token": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"wb_customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"setup_intent": {
"address": true,
"customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"wb_customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"stripe": {
"client_secret": "<string>",
"connected_account_id": "<string>",
"pk_key": "<string>"
}
}
}Create Payment Session
Create a Payment Session to collect credit card/direct debit information from the customer using Wingback.js.
curl --request POST \
--url http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session \
--header 'Content-Type: application/json' \
--header 'wb-key: <api-key>' \
--data '
{
"address": true,
"operation": "add_method",
"detach_previous_on_success": true,
"plan_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"pricing_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"provider": "stripe"
}
'import requests
url = "http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session"
payload = {
"address": True,
"operation": "add_method",
"detach_previous_on_success": True,
"plan_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"pricing_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"provider": "stripe"
}
headers = {
"wb-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'wb-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: true,
operation: 'add_method',
detach_previous_on_success: true,
plan_id: 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
pricing_id: 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
provider: 'stripe'
})
};
fetch('http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session",
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([
'address' => true,
'operation' => 'add_method',
'detach_previous_on_success' => true,
'plan_id' => 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
'pricing_id' => 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
'provider' => 'stripe'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"wb-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"
"strings"
"net/http"
"io"
)
func main() {
url := "http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session"
payload := strings.NewReader("{\n \"address\": true,\n \"operation\": \"add_method\",\n \"detach_previous_on_success\": true,\n \"plan_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"pricing_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"provider\": \"stripe\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("wb-key", "<api-key>")
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("http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session")
.header("wb-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"address\": true,\n \"operation\": \"add_method\",\n \"detach_previous_on_success\": true,\n \"plan_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"pricing_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"provider\": \"stripe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8080/v1/c/customer/{customer_id}/payment/session")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["wb-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": true,\n \"operation\": \"add_method\",\n \"detach_previous_on_success\": true,\n \"plan_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"pricing_id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"provider\": \"stripe\"\n}"
response = http.request(request)
puts response.read_body{
"address": true,
"customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"detach_previous_on_success": true,
"operation": "add_method",
"provider": "stripe",
"status": "<string>",
"token": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"wb_customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"setup_intent": {
"address": true,
"customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"wb_customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"stripe": {
"client_secret": "<string>",
"connected_account_id": "<string>",
"pk_key": "<string>"
}
}
}Authorizations
Path Parameters
Id of the customer
Body
An inbound payment session for creation (a different one is used for updating, see FI-360)
whether to collect billing address
The purpose of a payment session:
- AddMethod - add a new payment method
add_method Unique identifier of an object. Consists of object class prefix and a UUID
"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670"
Unique identifier of an object. Consists of object class prefix and a UUID
"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670"
The payment providers known by the backend.
Those variants MUST be kept identical to the variants of the payment_provider enum of the postgres database
authorize, self_handled, stripe "stripe"
Response
payment session
Payment Session used to configure Payment Method
Indicates whether address is required
Unique identifier of an object. Consists of object class prefix and a UUID
"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670"
Determines whether previous payment method will be disabled and deregistered once current setup succeeds
The purpose of a payment session:
- AddMethod - add a new payment method
add_method The payment providers known by the backend.
Those variants MUST be kept identical to the variants of the payment_provider enum of the postgres database
authorize, self_handled, stripe "stripe"
Payment Session Status
Unique identifier of an object. Consists of object class prefix and a UUID
"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670"
Unique identifier of an object. Consists of object class prefix and a UUID
"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670"
Payment Configuration setup intent
Show child attributes
Show child attributes