Customers
Delete Customer by External ID
Delete a customer by external ID.
Immediately cancels any active subscriptions and revokes any active benefits.
Set anonymize=true to also anonymize PII for GDPR compliance.
Scopes: customers:write
DELETE
/
v1
/
customers
/
external
/
{external_id}
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Customers.DeleteExternal(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}from macropay_sdk import Macropay
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
macropay.customers.delete_external(external_id="<id>", anonymize=False)
# Use the SDK ...import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
await macropay.customers.deleteExternal({
externalId: "<id>",
});
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->customers->deleteExternal(
externalId: '<id>'
);
if ($response->statusCode === 200) {
// handle response
}curl --request DELETE \
--url https://api.macropay.ai/v1/customers/external/{external_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/customers/external/{external_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.delete("https://api.macropay.ai/v1/customers/external/{external_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/customers/external/{external_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>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
You can generate an Organization Access Token from your organization's settings.
Path Parameters
The customer external ID.
Query Parameters
If true, also anonymize the customer's personal data for GDPR compliance.
Response
Customer deleted.
Previous
Get SubscriptionGet a subscription by ID.
**Scopes**: `subscriptions:read` `subscriptions:write`
Next
⌘I
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Customers.DeleteExternal(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}from macropay_sdk import Macropay
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
macropay.customers.delete_external(external_id="<id>", anonymize=False)
# Use the SDK ...import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
await macropay.customers.deleteExternal({
externalId: "<id>",
});
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->customers->deleteExternal(
externalId: '<id>'
);
if ($response->statusCode === 200) {
// handle response
}curl --request DELETE \
--url https://api.macropay.ai/v1/customers/external/{external_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/customers/external/{external_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.delete("https://api.macropay.ai/v1/customers/external/{external_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/customers/external/{external_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>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}