Create an authentication token for a customer and for the Authentication URL
curl --request POST \
--url http://127.0.0.1:8080/v1/c/customer/authenticate \
--header 'Content-Type: application/json' \
--header 'wb-key: <api-key>' \
--data '
{
"email": "<string>",
"id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"reference": "<string>"
}
'import requests
url = "http://127.0.0.1:8080/v1/c/customer/authenticate"
payload = {
"email": "<string>",
"id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"reference": "<string>"
}
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({
email: '<string>',
id: 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
reference: '<string>'
})
};
fetch('http://127.0.0.1:8080/v1/c/customer/authenticate', 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/authenticate",
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([
'email' => '<string>',
'id' => 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
'reference' => '<string>'
]),
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/authenticate"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"reference\": \"<string>\"\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/authenticate")
.header("wb-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8080/v1/c/customer/authenticate")
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 \"email\": \"<string>\",\n \"id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyhttps://billing.wingback.com/end-user/auth?token=67a82365-47a1-4b0b-894e-96038c01b2e0
Billing Portal
Login a Customer to the Self-Serve Portal
Create an authentication token for a customer and return a URL for accessing their self-serve billing portal.
POST
/
v1
/
c
/
customer
/
authenticate
Create an authentication token for a customer and for the Authentication URL
curl --request POST \
--url http://127.0.0.1:8080/v1/c/customer/authenticate \
--header 'Content-Type: application/json' \
--header 'wb-key: <api-key>' \
--data '
{
"email": "<string>",
"id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"reference": "<string>"
}
'import requests
url = "http://127.0.0.1:8080/v1/c/customer/authenticate"
payload = {
"email": "<string>",
"id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
"reference": "<string>"
}
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({
email: '<string>',
id: 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
reference: '<string>'
})
};
fetch('http://127.0.0.1:8080/v1/c/customer/authenticate', 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/authenticate",
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([
'email' => '<string>',
'id' => 'Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670',
'reference' => '<string>'
]),
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/authenticate"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"reference\": \"<string>\"\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/authenticate")
.header("wb-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8080/v1/c/customer/authenticate")
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 \"email\": \"<string>\",\n \"id\": \"Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670\",\n \"reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyhttps://billing.wingback.com/end-user/auth?token=67a82365-47a1-4b0b-894e-96038c01b2e0
Code Example
Refer to our Billing Portal Integration Guide for more information and code examples.
Always perform an authorization check on your backend first and never pre-generate the secret URL, as it would otherwise expire before the customer opens it.
201 text response if successful. Finally, redirect the customer to the URL returned by the authenticate endpoint using a 302 redirect (see example).
Once there, your customer will have access to their billing portal, where they can:
- View and update their billing information
- Manage their payment methods
- View their subscription details
- Track their current usage
- Upgrade or downgrade their plan
- View their billing history and download invoices
https://billing.wingback.com/end-user/auth?token=67a82365-47a1-4b0b-894e-96038c01b2e0
Authorizations
api-keywb_user_cookie
Body
application/json
Response
201 - application/json
The response is of type string.