Giter Club home page Giter Club logo

xendit-python's Introduction

Xendit Python SDK

Xendit Python SDK

The official Xendit Python SDK provides a simple and convenient way to call Xendit's REST API in applications written in Python.

  • Package version: 6.0.0

Requirements

Python >= 3.10

Getting Started

Installation

Install directly from Xendit's Github Repository:

pip install git+https://github.com/xendit/xendit-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/xendit/xendit-python.git)

Then import the package:

import xendit

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import xendit

Authorization

The SDK needs to be instantiated using your secret API key obtained from the Xendit Dashboard. You can sign up for a free Dashboard account here.

import xendit
from xendit.apis import BalanceApi
from pprint import pprint

xendit.set_api_key('XENDIT_API_KEY')

client = xendit.ApiClient()

try:
    response = BalanceApi(client).get_balance('CASH')
    pprint(response)
except xendit.XenditSdkException as e:
    print("Exception when calling BalanceApi->get_balance: %s\n" % e)

Documentation

Find detailed API information and examples for each of our product's by clicking the links below,

All URIs are relative to https://api.xendit.co. For more information about our API, please refer to https://developers.xendit.co/.

Further Reading

xendit-python's People

Contributors

adyaksaw avatar bob-xendit avatar cassiewang avatar erikduisheev avatar ervanadetya avatar esadeli avatar flamehamster avatar glendaesutanto avatar javiersuweijie avatar mesmur avatar sekaranglila avatar stanleynguyen avatar stephenthajeb avatar xendit-devx-bot avatar zakiarsyad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xendit-python's Issues

there is no method for create customer

hello, i wanna make payment request using client_id = "xxx" for filter payment per user.
but currently there is no function for create Customer. thanks

IndividualDetail not defined

error di create account
File "/home/boo/mainan/projectkelas/customer.py", line 24, in
individual_detail=IndividualDetail(
NameError: name 'IndividualDetail' is not defined

Create VA All Bank

Hi, is possible to create Open VA for all account banks? or how to make VA not changing for each invoice in same customer

AttributeError: type object 'EWallet' has no attribute 'create_ewallet_charge'

For some reason, it cannot see the create_ewallet_charge function
image

I cannot find create_ewallet_charge anywhere, here's the dir class in shell

>>> xendit_init = xendit.Xendit(settings.XENDIT_SECRET_KEY)
>>> dir(xendit_init)
['Balance', 'BatchDisbursement', 'CardlessCredit', 'CreditCard', 'DirectDebit', 'Disbursement', 'EWallet', 'Invoice', 'PaymentMethod', 'PaymentRequest', 'Payout', 'QRCode', 'RecurringPayment', 'Refund', 'RetailOutlet', 'VirtualAccount', 'XenPlatform', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
>>> dir(xendit_init.EWallet)
['Query', '__annotations__', '__class__', '__dataclass_fields__', '__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__match_args__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']

Python 3.10.10

[new] Tokenization for ewallet

this issue raised to ask for support tokenization flow for ewallet. we'll need Initialize Linked Account Tokenization method to be able to pass in cancel_redirect_url

linkaja example is not working

5.3.0-rc8-0.8-MANJARO-ARM (arm64)
Python 3.8.2

from xendit import EWallet, LinkAjaItem
import json

barang = []
lajaitem = LinkAjaItem(
    id="123123",
    name="Phone Case",
    price=100000,
    quantity=1)
barang.append(lajaitem)
linkaja_payment = EWallet.create_linkaja_payment(
    external_id="linkaja-ewallet-test-1593663498",
    phone="089911111111",
    items=barang,
    amount=300000,
    callback_url="https://my-shop.com/callbacks",
    redirect_url="https://xendit.co/",
)
print(barang)
print(json.dumps(barang))
print(linkaja_payment)

output :

Traceback (most recent call last):
  File "temp.py", line 11, in <module>
    linkaja_payment = EWallet.create_linkaja_payment(
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/xendit/models/ewallet/ewallet.py", line 187, in create_linkaja_payment
    resp = _APIRequestor.post(url, **kwargs)
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/xendit/_api_requestor.py", line 20, in post
    return _APIRequestor._request("POST", url, **kwargs)
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/xendit/_api_requestor.py", line 59, in _request
    resp = http_client.request(method, url, headers=headers, json=body)
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/requests/sessions.py", line 516, in request
    prep = self.prepare_request(req)
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/requests/sessions.py", line 449, in prepare_request
    p.prepare(
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/requests/models.py", line 317, in prepare
    self.prepare_body(data, files, json)
  File "/home/bokuno/Public/akuncenter/venv/lib/python3.8/site-packages/requests/models.py", line 467, in prepare_body
    body = complexjson.dumps(json)
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type LinkAjaItem is not JSON serializable

Invoice object helper

So I want to create customer object for the invoice, but in the invoice there is no helper for building customer.
And there is no global customer object in the library.

And in the API, there is customer_notification_preference object, but that object is not available in the invoice parameter.

So the library is lagging behind the HTTP API Endpoint.

Handling errors from Xendit's APIs with no error_code

Sometimes due to connectivity issues etc. Xendit APIs can return error responses that do not conform to XenditError standard (aka not have the error_code), or it may not even be a valid JSON (e.g. error from Nginx Gateway which is in HTML format). However, some of the APIs may map the http error from the API to the XenditError object, and since it does not have the error_code field it results in an exception that error_code does not exist. This obscures the user from the actual error they encounter. This needs to be

An example of it can be seen below:
image

Make a request with a proxy?

Hi, is it possible to use this SDK with a proxy address? I'm hosting my server on a dynamic IP-based provision, and want to pass the request to the Xendit with a static IP from a proxy.

Typography issues

In Retrieve Accessible Accounts by Linked Account Token API reference (link here):

The DirectDebit.get_accessible_account_by_token() function is actually DirectDebit.get_accessible_accounts_by_token().

Please update documents or change the function name itself.

[SDK][NEW API] Cards Get Token

In regards with cards new API and documentation update we will need new method of CreditCard.get_token on xendit-python client library.

This issue is request for it.

from xendit import Xendit

api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
CreditCard = xendit_instance.CreditCard

token = CreditCard.get_token(
    credit_card_token_id="605c05d3f81fa60011b2fa4e",
)
print(token)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.