Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Added
- PaymentLink resource

## [2.34.0] - 2026-05-07
### Changed
Expand Down
172 changes: 172 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ is as easy as sending a text message to your client!
- [DarfPayments](#create-darf-payment): Pay DARFs
- [PaymentPreviews](#preview-payment-information-before-executing-the-payment): Preview all sorts of payments
- [PaymentRequest](#create-payment-requests-to-be-approved-by-authorized-people-in-a-cost-center): Request a payment approval to a cost center
- [PaymentLinks](#create-paymentlinks): Shareable links to collect payments with credit/debit cards
- [CorporateHolders](#create-corporateholders): Manage cardholders
- [CorporateCards](#create-corporatecards): Create virtual and/or physical cards
- [CorporateInvoices](#create-corporateinvoices): Add money to your corporate balance
Expand Down Expand Up @@ -1964,6 +1965,177 @@ for request in requests:
print(request)
```

## Create PaymentLinks

You can create shareable PaymentLinks to collect payments from your customers using credit or debit cards.

```python
import starkbank

links = starkbank.paymentlink.create([
starkbank.PaymentLink(
name="Assinatura Premium",
amount=15000, # R$ 150.00 in cents
usage_mode="single",
allowed_methods=["credit", "debit"],
allowed_installments=[
starkbank.paymentlink.AllowedInstallment(count=1, total_amount=15000),
starkbank.paymentlink.AllowedInstallment(count=2, total_amount=15750),
starkbank.paymentlink.AllowedInstallment(count=3, total_amount=16500),
],
expiration=36000, # 10 hours in seconds
description="Plano trinta dias",
success_url="https://merchant.com/obrigado",
tags=["campanha-abril", "plano-premium"],
items=[
starkbank.paymentlink.Item(
code="PREM-001",
description="Plano Premium Mensal",
quantity=1,
unit_price=15000,
total_price=15000,
discount=0,
),
],
metadata={
"customerId": "5678901234567890",
"orderId": "ORD-2026-001",
},
)
])

for link in links:
print(link)
```

**Note**: Instead of using PaymentLink objects, you can also pass each link element in dictionary format

## Get a PaymentLink

After its creation, information on a PaymentLink may be retrieved by its id.

```python
import starkbank

link = starkbank.paymentlink.get("5155165527080960")

print(link)
```

## Query PaymentLinks

You can query multiple PaymentLinks according to filters.

```python
import starkbank
from datetime import datetime

links = starkbank.paymentlink.query(
status="active",
after=datetime(2020, 1, 1),
before=datetime(2020, 3, 1),
)

for link in links:
print(link)
```

## Update a PaymentLink

You can cancel an active PaymentLink by passing 'canceling' in the status.

```python
import starkbank

link = starkbank.paymentlink.update("5155165527080960", status="canceling")

print(link)
```

## Query PaymentLink logs

Logs help you understand the life cycle of a PaymentLink.

```python
import starkbank

logs = starkbank.paymentlink.log.query(
payment_link_ids=["5155165527080960"],
limit=50,
)

for log in logs:
print(log)
```

## Get a PaymentLink log

You can get a single log by its id.

```python
import starkbank

log = starkbank.paymentlink.log.get("5155165527080960")

print(log)
```

## Query PaymentLink attempts

You can query payment attempts made against a PaymentLink.

```python
import starkbank

attempts = starkbank.paymentlink.attempt.query(
payment_link_ids=["5155165527080960"],
limit=50,
)

for attempt in attempts:
print(attempt)
```

## Get a PaymentLink attempt

You can get a single PaymentLink attempt by its id.

```python
import starkbank

attempt = starkbank.paymentlink.attempt.get("5155165527080960")

print(attempt)
```

## Query PaymentLink attempt logs

You can query logs of payment attempts made against a PaymentLink.

```python
import starkbank

logs = starkbank.paymentlink.attempt.log.query(
payment_link_attempt_ids=["5155165527080960"],
limit=50,
)

for log in logs:
print(log)
```

## Get a PaymentLink attempt log

You can get a single PaymentLink attempt log by its id.

```python
import starkbank

log = starkbank.paymentlink.attempt.log.get("5155165527080960")

print(log)
```

## Corporate

## Create CorporateHolders
Expand Down
3 changes: 3 additions & 0 deletions starkbank/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
from . import paymentrequest
from .paymentrequest.__paymentrequest import PaymentRequest

from . import paymentlink
from .paymentlink.__paymentlink import PaymentLink

from . import invoice
from .invoice.__invoice import Invoice

Expand Down
7 changes: 7 additions & 0 deletions starkbank/paymentlink/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .__paymentlink import create, get, query, page, update
from .log.__log import Log
from . import log
from .attempt.__attempt import Attempt
from . import attempt
from .allowedinstallment.__allowedinstallment import AllowedInstallment
from .item.__item import Item
Loading
Loading