The payment method endpoint provides access to logos for popular payment methods and credit card brands. This is useful for displaying accepted payment methods in checkout flows, transaction history, and payment settings.
Get payment method logo
Retrieve a payment method or credit card logo by code.
import { Client, Avatars, CreditCard } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');
const avatars = new Avatars(client);
const result = avatars.getCreditCard({
code: CreditCard.Visa,
width: 100,
height: 100
});
console.log(result); // Resource URL
Parameters
The getCreditCard method accepts the following parameters:
| Parameter | Type | Description |
code | string | The payment method or credit card code. Supported codes include visa, mastercard, amex, discover, paypal, and others. |
width | integer | The width of the output image in pixels. Accepts values between 0-2000. |
height | integer | The height of the output image in pixels. Accepts values between 0-2000. |
Supported payment methods
Common payment method codes include:
import { CreditCard } from "appwrite";
// Visa
const visa = avatars.getCreditCard({
code: CreditCard.Visa,
width: 100,
height: 100
});
// Mastercard
const mastercard = avatars.getCreditCard({
code: CreditCard.Mastercard,
width: 100,
height: 100
});
// American Express
const amex = avatars.getCreditCard({
code: CreditCard.AmericanExpress,
width: 100,
height: 100
});
// Discover
const discover = avatars.getCreditCard({
code: CreditCard.Discover,
width: 100,
height: 100
});
Use cases
Payment method logos are commonly used for:
- Checkout flows: Display accepted payment methods during checkout
- Payment settings: Show saved payment methods in user account settings
- Transaction history: Display payment method used for each transaction
- Subscription management: Show payment methods associated with subscriptions
- Billing information: Display payment method logos in invoices and receipts