Payment Methods
Delete Customer Payment Method
Delete a payment method from the authenticated customer.
DELETE
/
v1
/
customer-portal
/
customers
/
me
/
payment-methods
/
{id}
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Customers.DeletePaymentMethod(ctx, operations.CustomerPortalCustomersDeletePaymentMethodSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
}, "<id>")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
polar.customer_portal.customers.delete_payment_method(security=polar_sdk.CustomerPortalCustomersDeletePaymentMethodSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Use the SDK ...import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
await polar.customerPortal.customers.deletePaymentMethod({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<id>",
});
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalCustomersDeletePaymentMethodSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->customers->deletePaymentMethod(
security: $requestSecurity,
id: '<id>'
);
if ($response->statusCode === 200) {
// handle response
}curl --request DELETE \
--url https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.delete("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"error": "<string>",
"detail": "<string>"
}{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
customer_sessionmember_session
Customer session tokens are specific tokens that are used to authenticate customers on your organization. You can create those sessions programmatically using the Create Customer Session endpoint.
Path Parameters
Response
Payment method deleted.
Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Customers.DeletePaymentMethod(ctx, operations.CustomerPortalCustomersDeletePaymentMethodSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
}, "<id>")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
polar.customer_portal.customers.delete_payment_method(security=polar_sdk.CustomerPortalCustomersDeletePaymentMethodSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Use the SDK ...import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
await polar.customerPortal.customers.deletePaymentMethod({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<id>",
});
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalCustomersDeletePaymentMethodSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->customers->deletePaymentMethod(
security: $requestSecurity,
id: '<id>'
);
if ($response->statusCode === 200) {
// handle response
}curl --request DELETE \
--url https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.delete("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"error": "<string>",
"detail": "<string>"
}{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
