跳转到主要内容
GET
/
customers
/
{customer_id}
/
payment-methods
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

const response = await client.customers.retrievePaymentMethods('cus_TV52uJWWXt2yIoBBxpjaa');

console.log(response.items);
import os
from dodopayments import DodoPayments

client = DodoPayments(
bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"), # This is the default and can be omitted
)
response = client.customers.retrieve_payment_methods(
"cus_TV52uJWWXt2yIoBBxpjaa",
)
print(response.items)
package main

import (
"context"
"fmt"

"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)

func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.Customers.GetPaymentMethods(context.TODO(), "cus_TV52uJWWXt2yIoBBxpjaa")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Items)
}
package com.dodopayments.api.example;

import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.customers.CustomerRetrievePaymentMethodsParams;
import com.dodopayments.api.models.customers.CustomerRetrievePaymentMethodsResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

CustomerRetrievePaymentMethodsResponse response = client.customers().retrievePaymentMethods("cus_TV52uJWWXt2yIoBBxpjaa");
}
}
package com.dodopayments.api.example

import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.customers.CustomerRetrievePaymentMethodsParams
import com.dodopayments.api.models.customers.CustomerRetrievePaymentMethodsResponse

fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

val response: CustomerRetrievePaymentMethodsResponse = client.customers().retrievePaymentMethods("cus_TV52uJWWXt2yIoBBxpjaa")
}
require "dodopayments"

dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)

response = dodo_payments.customers.retrieve_payment_methods("cus_TV52uJWWXt2yIoBBxpjaa")

puts(response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Dodopayments\Client;
use Dodopayments\Core\Exceptions\APIException;

$client = new Client(
bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
environment: 'test_mode',
);

try {
$response = $client->customers->retrievePaymentMethods(
'cus_TV52uJWWXt2yIoBBxpjaa'
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using DodoPayments.Client;
using DodoPayments.Client.Models.Customers;

DodoPaymentsClient client = new();

CustomerRetrievePaymentMethodsParams parameters = new()
{
CustomerID = "cus_TV52uJWWXt2yIoBBxpjaa"
};

var response = await client.Customers.RetrievePaymentMethods(parameters);

Console.WriteLine(response);
use dodopayments::Client;

#[tokio::main]
async fn main() -> dodopayments::Result<()> {
let client = Client::from_env()?;
let customer_id = "customer_id";
let result = client
.customers()
.retrieve_payment_methods()
.customer_id(customer_id)
.await?;
println!("{result:?}");
Ok(())
}
curl --request GET \
--url https://test.dodopayments.com/customers/{customer_id}/payment-methods \
--header 'Authorization: Bearer <token>'
{
  "items": [
    {
      "payment_method_id": "<string>",
      "card": {
        "card_holder_name": "<string>",
        "card_network": "<string>",
        "card_type": "<string>",
        "expiry_month": "<string>",
        "expiry_year": "<string>",
        "last4_digits": "<string>"
      },
      "last_used_at": "2023-11-07T05:31:56Z",
      "recurring_enabled": true
    }
  ]
}

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

路径参数

customer_id
string
必填

Customer Id

响应

200 - application/json
items
object[]
必填
最后修改于 2026年4月1日