using Gr4vy;
using Gr4vy.Models.Components;
using Gr4vy.Models.Requests;
var sdk = new Gr4vySDK(
id: "mattilda",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "example"
);
ListBuyerPaymentMethodsRequest req = new ListBuyerPaymentMethodsRequest() {};
var res = await sdk.Buyers.PaymentMethods.ListAsync(req);
// handle responsepackage main
import(
"context"
gr4vygo "github.com/gr4vy/gr4vy-go"
"os"
"github.com/gr4vy/gr4vy-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
privateKey := "...."
withToken := gr4vy.WithToken(privateKey, []JWTScope{ReadAll, WriteAll}, 60)
s := gr4vy.New(
gr4vy.WithID("mattilda"),
gr4vy.WithServer(gr4vy.ServerSandbox),
gr4vy.WithSecuritySource(withToken),
gr4vy.WithMerchantAccountID("default"),
)
res, err := s.Buyers.PaymentMethods.List(ctx, operations.ListBuyerPaymentMethodsRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}package hello.world;
import java.lang.Exception;
import com.gr4vy.sdk.BearerSecuritySource;
import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.Gr4vy.AvailableServers;
import org.openapis.openapi.models.errors.*;
import org.openapis.openapi.models.operations.ListBuyerPaymentMethodsRequest;
import org.openapis.openapi.models.operations.ListBuyerPaymentMethodsResponse;
public class Application {
public static void main(String[] args) throws Exception {
Gr4vy sdk = Gr4vy.builder()
.id("mattilda")
.server(AvailableServers.SANDBOX)
.merchantAccountId("default")
.securitySource(new BearerSecuritySource.Builder(privateKey).build())
.build();
ListBuyerPaymentMethodsRequest req = ListBuyerPaymentMethodsRequest.builder()
.build();
ListBuyerPaymentMethodsResponse res = sdk.buyers().paymentMethods().list()
.request(req)
.call();
if (res.paymentMethodSummaries().isPresent()) {
// handle response
}
}
}declare(strict_types=1);
require 'vendor/autoload.php';
use Gr4vy;
use Gr4vy\Auth;
$privateKey = "...";
$sdk = Gr4vy\SDK::builder()
-\u003esetId('mattilda')
-\u003esetServer('sandbox')
-\u003esetSecuritySource(Auth::withToken($privateKey))
-\u003esetMerchantAccountId('default')
-\u003ebuild();
$request = new Gr4vy\ListBuyerPaymentMethodsRequest();
$response = $sdk->buyers->paymentMethods->list(
request: $request
);
if ($response->paymentMethodSummaries !== null) {
// handle response
}from gr4vy import Gr4vy, auth
import os
with Gr4vy(
id="mattilda",
server="production",
merchant_account_id="example",
bearer_auth=auth.with_token(open("./private_key.pem").read())
) as g_client:
res = g_client.buyers.payment_methods.list(order_by="desc")
# Handle response
print(res)import { Gr4vy } from "@gr4vy/sdk";
const gr4vy = new Gr4vy({
server: "sandbox",
id: "mattilda",
bearerAuth: withToken({
privateKey: fs.readFileSync("private_key.pem", "utf8"),
}),
});
async function run() {
const result = await gr4vy.buyers.paymentMethods.list();
console.log(result);
}
run();{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchant_account_id": "<string>",
"cit_usage_count": 123,
"has_replacement": true,
"usage_count": 123,
"type": "payment-method",
"approval_url": "https://gr4vy.app/redirect/12345",
"country": "US",
"currency": "MXN",
"details": {
"bin": "<string>",
"card_issuer_name": "<string>"
},
"expiration_date": "12/30",
"fingerprint": "a50b85c200ee0795d6fd33a5c66f37a4564f554355c5b46a756aac485dd168a4",
"label": "1234",
"last_replaced_at": "2013-07-16T19:23:00.000+00:00",
"mode": "card",
"scheme": "visa",
"additional_schemes": [
"eftpos-australia"
],
"cit_last_used_at": "2013-07-16T19:23:00.000+00:00",
"last_used_at": "2013-07-16T19:23:00.000+00:00"
}
]
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "method_not_allowed",
"status": 405,
"message": "Method Not Allowed",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "Generic error",
"details": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "error",
"code": "too_early",
"status": 425,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "server_error",
"status": 500,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "bad_gateway",
"status": 502,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "gateway_timeout",
"status": 504,
"message": "Request could not be processed",
"details": []
}List payment methods for a buyer
List all the stored payment methods for a specific buyer.
using Gr4vy;
using Gr4vy.Models.Components;
using Gr4vy.Models.Requests;
var sdk = new Gr4vySDK(
id: "mattilda",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "example"
);
ListBuyerPaymentMethodsRequest req = new ListBuyerPaymentMethodsRequest() {};
var res = await sdk.Buyers.PaymentMethods.ListAsync(req);
// handle responsepackage main
import(
"context"
gr4vygo "github.com/gr4vy/gr4vy-go"
"os"
"github.com/gr4vy/gr4vy-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
privateKey := "...."
withToken := gr4vy.WithToken(privateKey, []JWTScope{ReadAll, WriteAll}, 60)
s := gr4vy.New(
gr4vy.WithID("mattilda"),
gr4vy.WithServer(gr4vy.ServerSandbox),
gr4vy.WithSecuritySource(withToken),
gr4vy.WithMerchantAccountID("default"),
)
res, err := s.Buyers.PaymentMethods.List(ctx, operations.ListBuyerPaymentMethodsRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}package hello.world;
import java.lang.Exception;
import com.gr4vy.sdk.BearerSecuritySource;
import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.Gr4vy.AvailableServers;
import org.openapis.openapi.models.errors.*;
import org.openapis.openapi.models.operations.ListBuyerPaymentMethodsRequest;
import org.openapis.openapi.models.operations.ListBuyerPaymentMethodsResponse;
public class Application {
public static void main(String[] args) throws Exception {
Gr4vy sdk = Gr4vy.builder()
.id("mattilda")
.server(AvailableServers.SANDBOX)
.merchantAccountId("default")
.securitySource(new BearerSecuritySource.Builder(privateKey).build())
.build();
ListBuyerPaymentMethodsRequest req = ListBuyerPaymentMethodsRequest.builder()
.build();
ListBuyerPaymentMethodsResponse res = sdk.buyers().paymentMethods().list()
.request(req)
.call();
if (res.paymentMethodSummaries().isPresent()) {
// handle response
}
}
}declare(strict_types=1);
require 'vendor/autoload.php';
use Gr4vy;
use Gr4vy\Auth;
$privateKey = "...";
$sdk = Gr4vy\SDK::builder()
-\u003esetId('mattilda')
-\u003esetServer('sandbox')
-\u003esetSecuritySource(Auth::withToken($privateKey))
-\u003esetMerchantAccountId('default')
-\u003ebuild();
$request = new Gr4vy\ListBuyerPaymentMethodsRequest();
$response = $sdk->buyers->paymentMethods->list(
request: $request
);
if ($response->paymentMethodSummaries !== null) {
// handle response
}from gr4vy import Gr4vy, auth
import os
with Gr4vy(
id="mattilda",
server="production",
merchant_account_id="example",
bearer_auth=auth.with_token(open("./private_key.pem").read())
) as g_client:
res = g_client.buyers.payment_methods.list(order_by="desc")
# Handle response
print(res)import { Gr4vy } from "@gr4vy/sdk";
const gr4vy = new Gr4vy({
server: "sandbox",
id: "mattilda",
bearerAuth: withToken({
privateKey: fs.readFileSync("private_key.pem", "utf8"),
}),
});
async function run() {
const result = await gr4vy.buyers.paymentMethods.list();
console.log(result);
}
run();{
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchant_account_id": "<string>",
"cit_usage_count": 123,
"has_replacement": true,
"usage_count": 123,
"type": "payment-method",
"approval_url": "https://gr4vy.app/redirect/12345",
"country": "US",
"currency": "MXN",
"details": {
"bin": "<string>",
"card_issuer_name": "<string>"
},
"expiration_date": "12/30",
"fingerprint": "a50b85c200ee0795d6fd33a5c66f37a4564f554355c5b46a756aac485dd168a4",
"label": "1234",
"last_replaced_at": "2013-07-16T19:23:00.000+00:00",
"mode": "card",
"scheme": "visa",
"additional_schemes": [
"eftpos-australia"
],
"cit_last_used_at": "2013-07-16T19:23:00.000+00:00",
"last_used_at": "2013-07-16T19:23:00.000+00:00"
}
]
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "method_not_allowed",
"status": 405,
"message": "Method Not Allowed",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "Generic error",
"details": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "error",
"code": "too_early",
"status": 425,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "server_error",
"status": 500,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "bad_gateway",
"status": 502,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "gateway_timeout",
"status": 504,
"message": "Request could not be processed",
"details": []
}payment-methods.read or embed scope.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The ID of the merchant account to use for this request.
"example"
Query Parameters
The ID of the buyer to query payment methods for.
"fe26475d-ec3e-4884-9553-f7356683f7f9"
The external identifier of the buyer to query payment methods for.
"buyer-12345"
The field to sort the payment methods by.
"last_used_at""last_used_at"
The direction to sort the payment methods in.
asc, desc "desc"
The country code to filter payment methods by. This only applies to payment methods with a country value.
^[A-Z]{2}$"US"
The currency code to filter payment methods by. This only applies to payment methods with a currency value.
^[A-Z]{3}$"MXN"
Response
Successful Response
A list of items returned for this request.
Show child attributes
Show child attributes
Was this page helpful?