A Python library for interacting with the CCPayments API.
Project description
CCPayments Gateway Library
A Python library for interacting with the CCPayments API.
Installation
pip install ccpayments-gateway
Usage
Webhook Verification
from ccpayments_gateway import verify_signature
# Example usage for webhook verification
# This is a simplified example. In a real web framework,
# you would get these values from the request headers and body.
content = '{"some": "payload"}'
signature = "the_signature_from_header"
app_id = "your_app_id"
app_secret = "your_app_secret"
timestamp = "the_timestamp_from_header"
if verify_signature(content, signature, app_id, app_secret, timestamp):
print("Signature is valid!")
else:
print("Signature is invalid!")
Resend Webhooks
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Resend webhooks from a specific time
start_time = int(time.time()) - 3600 # 1 hour ago
response = client.resend_webhooks(start_timestamp=start_time)
print(response)
Get or Create Deposit Address
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get or create a deposit address
response = client.get_or_create_deposit_address(reference_id="user_123", chain="TRX")
print(response)
Create Order Deposit Address
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Create a deposit address for an order
order_id = str(int(time.time()))
response = client.create_order_deposit_address(
coin_id=1280,
price="1",
order_id=order_id,
chain="POLYGON"
)
print(response)
Get Order Info
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get order information
# Replace with a real order ID
response = client.get_order_info(order_id="1709889675")
print(response)
Create Invoice URL
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Create an invoice URL
order_id = str(int(time.time()))
response = client.create_invoice_url(
order_id=order_id,
price="1",
price_coin_id="1280"
)
print(response)
Get Invoice Order Info
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get invoice order information
# Replace with a real order ID
response = client.get_invoice_order_info(order_id="xxxxxxx")
print(response)
Unbind Address
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Unbind an address
response = client.unbind_address(chain="POLYGON", address="0x3720C7f5b352E9da3A102B3b8c49080acAa4ceee")
print(response)
Get Deposit Record
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a deposit record
# Replace with a real record ID
response = client.get_deposit_record(record_id="20250116073333231508600365121536")
print(response)
Get Deposit Record List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a list of deposit records
response = client.get_deposit_record_list()
print(response)
Create Withdrawal Order
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Create a withdrawal order
order_id = str(int(time.time() * 1000))
response = client.create_withdrawal_order(
coin_id=1280,
address="0xBb9C4e7F3687aca1AE2828c18f9E3ae067F569FE",
order_id=order_id,
chain="POLYGON",
amount="0.001",
)
print(response)
Get Withdrawal Record
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a withdrawal record by order ID
response = client.get_withdrawal_record(order_id="some_order_id")
print(response)
# Get a withdrawal record by record ID
response = client.get_withdrawal_record(record_id="some_record_id")
print(response)
Withdraw to Cwallet
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Withdraw to a Cwallet user
order_id = str(int(time.time() * 1000))
response = client.withdraw_to_cwallet(
coin_id=1280,
cwallet_user="9558861",
order_id=order_id,
amount="1"
)
print(response)
Get Withdrawal Record List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a list of withdrawal records
response = client.get_withdrawal_record_list()
print(response)
Get Swap Quote
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a swap quote
response = client.get_swap_quote(coin_id_in=1280, amount_in="100", coin_id_out=1329)
print(response)
Create Swap
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Create a swap
order_id = str(int(time.time() * 1000))
response = client.create_swap(
order_id=order_id,
coin_id_in=1280,
amount_in="1",
coin_id_out=1329,
)
print(response)
Get Swap Record
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a swap record
response = client.get_swap_record(order_id="xxxxxxxxxxx")
print(response)
Get Swap Record List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a list of swap records
response = client.get_swap_record_list()
print(response)
Get User Asset List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get user asset list
response = client.get_user_asset_list(user_id="1709021102608")
print(response)
Get User Coin Asset
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get user coin asset
response = client.get_user_coin_asset(user_id="1709021102608", coin_id=1280)
print(response)
Get or Create User Deposit Address
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get or create a user deposit address
user_id = str(int(time.time() * 1000))
response = client.get_or_create_user_deposit_address(user_id=user_id, chain="BSC")
print(response)
Get User Deposit Record
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a user deposit record
response = client.get_user_deposit_record(record_id="20250116080551231516731711291392")
print(response)
Get User Deposit Record List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a list of user deposit records
response = client.get_user_deposit_record_list(user_id="1737014581861")
print(response)
User Withdraw to Network
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# User withdraw to network
order_id = str(int(time.time() * 1000))
response = client.user_withdraw_to_network(
user_id="1709021102608",
coin_id=1280,
address="0x12438F04093EBc87f0Ba629bbe93F2451711d967",
order_id=order_id,
chain="POLYGON",
amount="0.001",
)
print(response)
User Withdraw to Cwallet
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# User withdraw to Cwallet
order_id = str(int(time.time() * 1000))
response = client.user_withdraw_to_cwallet(
user_id="1709021102608",
coin_id=1280,
cwallet_user="9558861",
order_id=order_id,
amount="0.01"
)
print(response)
Get User Withdrawal Record
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a user withdrawal record
response = client.get_user_withdrawal_record(record_id="202403010604081763445093768892416")
print(response)
Get User Withdrawal Record List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a list of user withdrawal records
response = client.get_user_withdrawal_record_list(user_id="1709021102608")
print(response)
Create Internal Transaction
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Create an internal transaction
order_id = str(int(time.time() * 1000))
response = client.create_internal_transaction(
from_user_id="1709021102608",
to_user_id="1709021101247",
coin_id=1280,
amount="0.005",
order_id=order_id,
)
print(response)
Get User Internal Transaction Record
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a user internal transaction record
response = client.get_user_internal_transaction_record(record_id="202403010610541763446796748591104")
print(response)
Get User Internal Transaction Record List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a list of user internal transaction records
response = client.get_user_internal_transaction_record_list(from_user_id="1709021102608")
print(response)
User Get Swap Quote
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a user swap quote
response = client.get_swap_quote(coin_id_in=1280, amount_in="100", coin_id_out=1482, extra_fee_rate="0.01")
print(response)
User Create Swap
from ccpayments_gateway import CCPayments
import time
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Create a user swap
order_id = str(int(time.time() * 1000))
response = client.user_create_swap(
order_id=order_id,
user_id="user-swap1",
coin_id_in=1280,
amount_in="100",
coin_id_out=1329,
)
print(response)
Get User Swap Record
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a user swap record
response = client.get_user_swap_record(record_id="20240722021342166923068583059456")
print(response)
Get User Swap Record List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get a list of user swap records
response = client.get_user_swap_record_list()
print(response)
Get Token List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get token list
response = client.get_token_list()
print(response)
Get Token Info
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get token info
response = client.get_token_info(coin_id=1280)
print(response)
Get Token Price
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get token price
response = client.get_token_price(coin_ids=[1329])
print(response)
Get Balance List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get balance list
response = client.get_balance_list()
print(response)
Get Coin Balance
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get coin balance
response = client.get_coin_balance(coin_id=1280)
print(response)
Rescan Lost Transaction
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Rescan a lost transaction
response = client.rescan_lost_transaction(
chain="XLM",
to_address="GBSCAK4DTAS4TUNZJUQ5QO5FCJBEXVH7JSMZNZLRTSIZGIDS3H7CWE7O",
tx_id="9f1597024ca2fabdef4048c4b203fbc2ee2cda1ba2504f184f3a8304d97c1487",
memo="109"
)
print(response)
Get Cwallet User Info
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get Cwallet user info
response = client.get_cwallet_user_info(cwallet_user_id="9558861")
print(response)
Check Withdrawal Address Validity
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Check withdrawal address validity
response = client.check_withdrawal_address_validity(chain="POLYGON", address="0x43fEeF6879286BBAC5082f17AD3dA55EE456B934")
print(response)
Get Withdrawal Network Fee
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get withdrawal network fee
response = client.get_withdrawal_network_fee(coin_id=1280, chain="POLYGON")
print(response)
Get Fiat List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get fiat list
response = client.get_fiat_list()
print(response)
Get Swap Coin List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get swap coin list
response = client.get_swap_coin_list()
print(response)
Get Chain List
from ccpayments_gateway import CCPayments
client = CCPayments(app_id="your_app_id", app_secret="your_app_secret")
# Get chain list
response = client.get_chain_list(chains=["ETH", "POLYGON"])
print(response)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ccpayments_gateway-0.1.0.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ccpayments_gateway-0.1.0.tar.gz.
File metadata
- Download URL: ccpayments_gateway-0.1.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa148fee8c0d7883c7046975ba8049f8849a222c11f1851f02eeb5398047df90
|
|
| MD5 |
ccc0a27b6bfd266c21ad142781a007d8
|
|
| BLAKE2b-256 |
97f8a1d66412dda054b16693c602d20b9c06fcf189d5fce0e342228e8f132a84
|
File details
Details for the file ccpayments_gateway-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ccpayments_gateway-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d46a29b5da60c75dd04ef3a667498f23f4f5667640f83be4f999c823e1db27f
|
|
| MD5 |
f4182ec391ba3df2515113bf7418f4f7
|
|
| BLAKE2b-256 |
f1f71e742cecd34016846260ea465e067d875f497c67e1b00e0d1dbf57f845d6
|