Skip to main content

Manage virtual cards on Extend

Project description

Extend API

Programmatically manage virtual cards on Extend

[!CAUTION] This is an unofficial client that is not affiliated with or endorsed by Extend. Using this client may violate Extend's Terms of Service. By using this client, you acknowledge and accept all associated risks.

Installation

pip install extend-vcc

Device Verification

  1. Login to the Extend dashboard
  2. Open the browser's developer tools
  3. Run the following JavaScript in the console:
function lookup(suffix) {
  const key = Object.keys(localStorage).find(
    (key) =>
      key.startsWith("CognitoIdentityServiceProvider") && key.endsWith(suffix)
  );
  if (!key) return;
  console.log(suffix, localStorage[key]);
}
lookup("deviceGroupKey");
lookup("deviceKey");
lookup("randomPasswordKey");

Quick Start

Initialize the client

from extend_vcc import Client
from extend_vcc.cognito import Cognito, AuthParams

# Initialize authentication
auth = Cognito(AuthParams(
    username="user@email.com",
    password="password",
    device_group_key="device_group_key",  # deviceGroupKey from browser
    device_key="device_key",  # deviceKey from browser
    device_password="device_password",  # randomPasswordKey from browser
))

# Create client
client = Client(auth)

Create a virtual card

from extend_vcc.virtual_card import CreateVirtualCardOptions
from extend_vcc.types import Currency
from datetime import datetime, timedelta

card = client.create_virtual_card(CreateVirtualCardOptions(
    credit_card_id="cc_id",
    display_name="Team Expenses",
    balance_cents=10000,
    currency=Currency.USD,
    valid_to=datetime.now() + timedelta(days=30),
    recipient="team@company.com",
    notes="This card is for team expenses"
))

Get a virtual card

card = client.get_virtual_card("vc_id")

Cancel a virtual card

card = client.cancel_virtual_card("vc_id")

Close a virtual card

card = client.close_virtual_card("vc_id")

List virtual cards with pagination

from extend_vcc.types import PaginationOptions, SortDirection
from extend_vcc.virtual_card import ListVirtualCardsOptions, VirtualCardStatus

# Create listing options
options = ListVirtualCardsOptions(
    pagination_options=PaginationOptions(
        page=0,
        count=10,
        sort_direction=SortDirection.ASC,
        sort_field="activeClosedUpdatedAt"
    ),
    cardholder_or_viewer="me",
    issued=True,
    statuses=[VirtualCardStatus.ACTIVE]
)

# Get paginator
cards = client.list_virtual_cards(options)

# Iterate through pages
for page in cards:
    for card in page.items():
        # Process each card
        print(f"Card: {card.display_name}")

Bulk create virtual cards

from extend_vcc.virtual_card import BulkCreateVirtualCard, VirtualCardType
from datetime import datetime, timedelta

# Prepare card configurations
cards = [
    BulkCreateVirtualCard(
        card_type=VirtualCardType.STANDARD,
        recipient="user1@company.com",
        display_name="Marketing Card 1",
        balance_cents=10000,
        valid_to=datetime.now() + timedelta(days=30)
    ),
    BulkCreateVirtualCard(
        card_type=VirtualCardType.STANDARD,
        recipient="user2@company.com",
        display_name="Marketing Card 2",
        balance_cents=20000,
        valid_to=datetime.now() + timedelta(days=30)
    )
]

# Create cards in bulk
upload = client.bulk_create_virtual_cards("cc_id", cards)

# Check bulk upload status
status = client.get_bulk_virtual_card_upload(upload.bulk_virtual_card_push.bulk_virtual_card_upload_id)

Contributing

Contributions are welcome! Please see our contributing guidelines for more details.

License

MIT

Support

For issues, please open a GitHub issue in the repository.

Credits

This is a python version of the golang package made by saucesteals which can be found here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

extend_vcc-0.1.6.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

extend_vcc-0.1.6-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file extend_vcc-0.1.6.tar.gz.

File metadata

  • Download URL: extend_vcc-0.1.6.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for extend_vcc-0.1.6.tar.gz
Algorithm Hash digest
SHA256 04be03647527eda9b507ec7ea50c9f7df1add9f19ec6596d609535b5bfd4af88
MD5 d65fbda1eb2b2106c1464620114df469
BLAKE2b-256 cbec1c0d8ca065e11b26551d3b72787710ba4e4708c799d1d93eaf36f49cd6f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for extend_vcc-0.1.6.tar.gz:

Publisher: python-publish.yml on christianobora/extend-vcc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file extend_vcc-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: extend_vcc-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for extend_vcc-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 38fcaac29eb3f5a1c062716ffd169d27df36b580ace69c81e06d08cb64f03c69
MD5 d9ad6248e36fab83508c4320056f2b56
BLAKE2b-256 599ebb46555caeb85b618b0e8b322f189df69d66b8d18a59065824a038042d92

See more details on using hashes here.

Provenance

The following attestation bundles were made for extend_vcc-0.1.6-py3-none-any.whl:

Publisher: python-publish.yml on christianobora/extend-vcc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page