Activate Payment Method
Flip a method to Active, making it usable for checkout and recurring billing.
URL
POST /api/c2a/customer/payment/methods/activate
Request Parameters
| Name | Type | Description |
|---|---|---|
p | string | Query parameter, required. Payment method URN. |
Response Parameters
PaymentMethodActivateResponse returns the updated AzottePaymentMethod with state = Active.
| Name | Type | Description |
|---|---|---|
result | object (AzottePaymentMethod) | Updated method snapshot. |
status | object (AzotteStatus) | Operation status envelope. |
Sample Response
{
"result": {
"paymentMethodUrn": "pm.00.482.3",
"state": "Active"
},
"status": { "messageCode": "SUCCESS" }
}
Sample Codes
- cURL
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
curl --location --request POST \
'https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate?p=pm.00.482.3' \
--header 'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f' \
--header 'x-api-key: sk_dev_acme_sample_123456789'
const res = await fetch(
'https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate?p=pm.00.482.3',
{
method: 'POST',
headers: {
'x-tn': 'e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key': 'sk_dev_acme_sample_123456789'
}
}
);
console.log(await res.json());
import { request } from 'undici';
const { body } = await request(
'https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate?p=pm.00.482.3',
{
method: 'POST',
headers: {
'x-tn': 'e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key': 'sk_dev_acme_sample_123456789'
}
}
);
console.log(await body.json());
import requests
res = requests.post(
"https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate",
params={"p": "pm.00.482.3"},
headers={
"x-tn": "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f",
"x-api-key": "sk_dev_acme_sample_123456789",
},
)
print(res.json())
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate?p=pm.00.482.3"))
.header("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f")
.header("x-api-key", "sk_dev_acme_sample_123456789")
.POST(HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f");
http.DefaultRequestHeaders.Add("x-api-key", "sk_dev_acme_sample_123456789");
var res = await http.PostAsync(
"https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate?p=pm.00.482.3",
null);
Console.WriteLine(await res.Content.ReadAsStringAsync());
<?php
$ch = curl_init('https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate?p=pm.00.482.3');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key: sk_dev_acme_sample_123456789',
],
]);
echo curl_exec($ch);
curl_close($ch);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("POST",
"https://acme.sandbox.azotte.com/api/v1/c2a/customer/payment/methods/activate?p=pm.00.482.3", nil)
req.Header.Set("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f")
req.Header.Set("x-api-key", "sk_dev_acme_sample_123456789")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}