Update auto recharge preferences
Update payment auto recharge preferences.
PATCH
/
payment
/
auto_recharge_prefs
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const autoRechargePref = await client.payment.autoRechargePrefs.update();
console.log(autoRechargePref.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
auto_recharge_pref = client.payment.auto_recharge_prefs.update()
print(auto_recharge_pref.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
autoRechargePref, err := client.Payment.AutoRechargePrefs.Update(context.TODO(), telnyx.PaymentAutoRechargePrefUpdateParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", autoRechargePref.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefUpdateParams;
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AutoRechargePrefUpdateResponse autoRechargePref = client.payment().autoRechargePrefs().update();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
auto_recharge_pref = telnyx.payment.auto_recharge_prefs.update
puts(auto_recharge_pref)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$autoRechargePref = $client->payment->autoRechargePrefs->update(
enabled: true,
invoiceEnabled: true,
preference: 'credit_paypal',
rechargeAmount: '104.00',
thresholdAmount: '104.00',
);
var_dump($autoRechargePref);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx payment:auto-recharge-prefs update \
--api-key 'My API Key'curl --request PATCH \
--url https://api.telnyx.com/v2/payment/auto_recharge_prefs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"threshold_amount": "104.00",
"recharge_amount": "104.00",
"enabled": true,
"invoice_enabled": true,
"preference": "credit_paypal"
}
'{
"data": {
"id": "1524126400473204723",
"record_type": "auto_recharge_pref",
"threshold_amount": "104.00",
"recharge_amount": "104.00",
"enabled": true,
"invoice_enabled": true,
"preference": "credit_paypal"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Details to update auto recharge preferences
The threshold amount at which the account will be recharged.
Example:
"104.00"
The amount to recharge the account, the actual recharge amount will be the amount necessary to reach the threshold amount plus the recharge amount.
Example:
"104.00"
Whether auto recharge is enabled.
Example:
true
Example:
true
The payment preference for auto recharge.
Available options:
credit_paypal, ach Example:
"credit_paypal"
Response
Successful response
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const autoRechargePref = await client.payment.autoRechargePrefs.update();
console.log(autoRechargePref.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
auto_recharge_pref = client.payment.auto_recharge_prefs.update()
print(auto_recharge_pref.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
autoRechargePref, err := client.Payment.AutoRechargePrefs.Update(context.TODO(), telnyx.PaymentAutoRechargePrefUpdateParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", autoRechargePref.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefUpdateParams;
import com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AutoRechargePrefUpdateResponse autoRechargePref = client.payment().autoRechargePrefs().update();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
auto_recharge_pref = telnyx.payment.auto_recharge_prefs.update
puts(auto_recharge_pref)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$autoRechargePref = $client->payment->autoRechargePrefs->update(
enabled: true,
invoiceEnabled: true,
preference: 'credit_paypal',
rechargeAmount: '104.00',
thresholdAmount: '104.00',
);
var_dump($autoRechargePref);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx payment:auto-recharge-prefs update \
--api-key 'My API Key'curl --request PATCH \
--url https://api.telnyx.com/v2/payment/auto_recharge_prefs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"threshold_amount": "104.00",
"recharge_amount": "104.00",
"enabled": true,
"invoice_enabled": true,
"preference": "credit_paypal"
}
'{
"data": {
"id": "1524126400473204723",
"record_type": "auto_recharge_pref",
"threshold_amount": "104.00",
"recharge_amount": "104.00",
"enabled": true,
"invoice_enabled": true,
"preference": "credit_paypal"
}
}