Affirm Python SDK
Affirm Python SDK is a client library to interact with Affirm. For API reference: https://docs.affirm.com/Integrate_Affirm/Direct_API/Affirm_API_Reference
Affirm helps customers to pay over time for things they want to buy. The customers are in control of how long you get to make monthly payments. They do the approval process in minutes. This client will help you integrate with Affirm.
Usage
Client Creation
from affirm import Client
client = Client(auth=(<PUBLIC_API_KEY>, <PRIVATE_API_KEY>))
Performing Authorize
from affirm import Client
client = Client(auth=(<PUBLIC_API_KEY>, <PRIVATE_API_KEY>))
resp = client.charge.create(data={"checkout_token":<CHECKOUT_TOKEN_FROM_AFFIRM>, "order_id": <YOUR_GENERATED_ORDER_ID>)
Performing Capture
from affirm import Client
client = Client(auth=(<PUBLIC_API_KEY>, <PRIVATE_API_KEY>))
resp = client.charge.capture(charge_id = <CHARGE_ID>, order_id=<YOUR_GENERATED_ORDER_ID>)
Performing Refund
from affirm import Client
client = Client(auth=(<PUBLIC_API_KEY>, <PRIVATE_API_KEY>))
resp = client.charge.capture(charge_id = <CHARGE_ID>, order_id= <YOUR_GENERATED_ORDER_ID>)
Perform Update
from affirm import Client
client = Client(auth=(<PUBLIC_API_KEY>, <PRIVATE_API_KEY>))
resp = client.charge.update(charge_id = <CHARGE_ID>, order_id": <YOUR_GENERATED_ORDER_ID>)
Perform Void
from affirm import Client
client = Client(auth=(<PUBLIC_API_KEY>, <PRIVATE_API_KEY>))
resp = client.charge.void(charge_id=<CHARGE_ID>, order_id=<YOUR_GENERATED_ORDER_ID>)
Using the client for Production(or live)
The only change you need to make pass a prod keyward while to client creation step.
from affirm import Client
client = Client(auth=(<PUBLIC_API_KEY>, <PRIVATE_API_KEY>), prod=True)
If you have any questions please shoot a mail to anshul[dot]jmi[at]gmail[dot]com.
Metadata
Release files for affirm-pay 0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| affirm-pay-0.7.tar.gz | 5.0 kB | Without provenance | Details |
Release files / affirm-pay-0.7.tar.gz
| Download URL | affirm-pay-0.7.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f36f7f8adcfeb9d869a075c268a28e6242529b063710989abcbcfeed5dff1c21
|
|
BLAKE2b-256 checksum How to use checksums |
c4a0e1363800a7703c74e1e369df8f93bbc8537ef4efc3a4bd5740b6e0120352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10
|
Security for affirm-pay 0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.