Package: xfers-sdk
Xfers Python LibraryThis library is the abstraction of Xfers API for access from applications written with Python.Table of ContentsAPI DocumentationRequirementsInstallationUsageAPI KeyUsing Custom HTTP ClientBalanceGet BalanceBankBank Account ValidationList Disbursement BanksPaymentVirtual AccountQRISRetail OutletE-WalletRetrieve a PaymentManaging PaymentsDisbursementsAPI DocumentationPlease checkXfers API Reference.RequirementsPython 3.7 or laterInstallationTo use the package, runpip install xfers-sdkUsageAPI Keyfromlandx_xfers_sdkimportXfersxfers=Xfers(api_key="test-key123",secret_key="12345678")# Then access each class from x attributebalance=xfers.Balancebalance.get()BalanceGet Balancebalance=xfers.Balancebalance.get()Usage example:fromlandx_xfers_sdkimportXfersxfers=Xfers(api_key="test-key123",secret_key="12345678",production=False)# Then access each class from x attributebalance=xfers.Balanceprint(balance.get())Reference:https://docs.xfers.com/reference/account-balanceBank ServiceBank Account Validationbank=xfers.Bankbank.account_validation(account_no="123456",bank_short_code="BNI")Reference:https://docs.xfers.com/reference/bank-account-validationList Disbursement Banksbank=xfers.Bankbank.list()Reference:https://docs.xfers.com/reference/list-disbursement-banksPaymentThere are 2 main ways to accept payments with Xfers.One time payment
Usexfers.PaymentinstancePersistent payment method linked to one of your customers
Usexfers.PaymentMethodinstanceReference:https://docs.xfers.com/docs/accepting-paymentsVirtual AccountCreate One Time Paymentpayment=xfers.Paymentpayment.create(type="virtual_bank_account",amount=10000,expired_at=datetime.now()+timedelta(days=1),# One Dayreference_id="va_12345678",bank_short_code="SAHABAT_SAMPOERNA",display_name="Your preferred name",description="Payment Description"# suffix_no="12345678")API Reference:https://docs.xfers.com/reference/create-paymentCreate Persistent Paymentpayment_method=xfers.PaymentMethodpayment_method.create(type="virtual_bank_accounts",reference_id="12345678",bank_short_code="SAHABAT_SAMPOERNA",display_name="Your preferred name",# suffix_no="12345678")API Reference:https://docs.xfers.com/reference/create-payment-methodQRISCreate One Time Paymentpayment=xfers.Paymentpayment.create(type="qris",amount=10000,expired_at=datetime.now()+timedelta(days=1),# One Dayreference_id="qris_12345678",display_name="Your preferred name",description="Payment Description")API Reference:https://docs.xfers.com/reference/create-paymentCreate Persistent Paymentpayment_method=xfers.PaymentMethodpayment_method.create(type="qris",reference_id="12345678",display_name="Your preferred name")API Reference:https://docs.xfers.com/reference/create-payment-methodRetail OutletCreate Paymentpayment=xfers.Paymentpayment.create(type="retail_outlet",amount=10000,expired_at=datetime.now()+timedelta(days=1),# One Dayreference_id="qris_12345678",retail_outlet_name="ALFAMART",display_name="Your preferred name",description="Payment Description")Available Outlets:https://docs.xfers.com/docs/retail-store#available-outletsAPI Reference:https://docs.xfers.com/reference/create-paymentE-WalletCreate Paymentpayment=xfers.Paymentpayment.create(type="e-wallet",amount=10000,expired_at=datetime.now()+timedelta(days=1),# One Dayreference_id="qris_12345678",provider_code="SHOPEEPAY",after_settlement_return_url="https://pay.examplessee.co.id/return-pay-here?0340450",display_name="Your preferred name",description="Payment Description")List of E-Wallet:https://docs.xfers.com/docs/e-wallet#list-of-e-walletAPI Reference:https://docs.xfers.com/reference/create-paymentRetrieve a PaymentRetrieves a Payment object that was previously requested.One time paymentpayment=xfers.Paymentpayment.get(payment_id="va_1234567")API Reference:https://docs.xfers.com/reference/retrieve-paymentPersistent paymenttype = The type of payment method. Currently support "virtual_bank_accounts" and "qris".payment_method=xfers.PaymentMethodpayment_method.get(type="virtual_bank_accounts",payment_id="va_1234567")API Reference:https://docs.xfers.com/reference/retrieve-payment-methodManaging PaymentsPersistent Payment (PaymentMethod)Receive PaymentSimulates a payment received from the customer for a given payment. Status will be changed to 'paid'.payment_method=xfers.PaymentMethodpayment_method.receive_payment(payment_method_id="va_123456789",amount=90000)One Time Payment (Payment)Receive Payment [Sandbox Mode]Simulates a payment received from the customer for a given payment. Status will be changed to 'paid'.payment=xfers.Paymentpayment.receive_payment(payment_method_id="va_123456789",)Receive Payment [Sandbox Mode]Simulates a payment received from the customer for a given payment. Status will be changed to 'paid'.payment=xfers.Paymentpayment.receive_payment(payment_method_id="va_123456789",)Cancel PaymentCancel a payment when it is still in pending state. Status will be changed to 'cancelled'.
(This is only available for One-off Virtual Account at the moment.)payment=xfers.Paymentpayment.cancel(payment_method_id="va_123456789",)Settle Payment [Sandbox Mode]Simulates funds for a payment being made available for transfer or withdrawal. Status will be changed to 'completed'.payment=xfers.Paymentpayment.settle(payment_method_id="va_123456789",)DisbursementsCreate DisbursementsCreates a Disbursement object that will send funds from your Xfers account to an intended recipient.xfers.Disbursements.create(amount="10000",reference_id="123",bank_shortcode="BCA",bank_account_no="0123123123",bank_account_holder_name="john doe")Retrieve a DisbursementRetrieves a Disbursement object that was previously requested.xfers.Disbursements.get(disbursement_id="id")List All DisbursementReturns a list of Disbursements.xfers.Disbursements.list(created_after="2022-04-15")