Skip to content

Latest commit

 

History

History
713 lines (492 loc) · 20.9 KB

File metadata and controls

713 lines (492 loc) · 20.9 KB

paystack.Transaction

All URIs are relative to https://api.paystack.co

Method HTTP request Description
charge_authorization POST /transaction/charge_authorization Charge Authorization
check_authorization POST /transaction/check_authorization Check Authorization
download GET /transaction/export Export Transactions
event GET /transaction/{id}/event Get Transaction Event
fetch GET /transaction/{id} Fetch Transaction
initialize POST /transaction/initialize Initialize Transaction
list GET /transaction List Transactions
partial_debit POST /transaction/partial_debit Partial Debit
session GET /transaction/{id}/session Get Transaction Session
timeline GET /transaction/timeline/{id_or_reference} Fetch Transaction Timeline
totals GET /transaction/totals Transaction Totals
verify GET /transaction/verify/{reference} Verify Transaction

charge_authorization

Response charge_authorization(email, amount, authorization_code, reference=reference, currency=currency, metadata=metadata, split_code=split_code, subaccount=subaccount, transaction_charge=transaction_charge, bearer=bearer, queue=queue)

Charge Authorization

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

email = 'email_example' # str | Customer's email address
amount = 56 # int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_code = 'authorization_code_example' # str | Valid authorization code to charge

# Charge Authorization

response = paystack.Transaction.charge_authorization(
    email,
    amount,
    authorization_code,
)

pprint(response)

Parameters

Name Type Description Notes
email str Customer's email address
amount int Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_code str Valid authorization code to charge
reference str Unique transaction reference. Only -, ., = and alphanumeric characters allowed. [optional]
currency str The transaction currency [optional]
metadata str Stringified JSON object of custom data [optional]
split_code str The split code of the transaction split [optional]
subaccount str The code for the subaccount that owns the payment [optional]
transaction_charge str A flat fee to charge the subaccount for a transaction. This overrides the split percentage set when the subaccount was created [optional]
bearer str The beare of the transaction charge [optional]
queue bool If you are making a scheduled charge call, it is a good idea to queue them so the processing system does not get overloaded causing transaction processing errors. [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded, application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

check_authorization

Response check_authorization(email, amount, authorization_code=authorization_code, currency=currency)

Check Authorization

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

email = 'email_example' # str | Customer's email address
amount = 56 # int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR

# Check Authorization

response = paystack.Transaction.check_authorization(
    email,
    amount,
)

pprint(response)

Parameters

Name Type Description Notes
email str Customer's email address
amount int Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_code str Valid authorization code to charge [optional]
currency str The transaction currency [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded, application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

download

Response download(per_page=per_page, page=page, _from=_from, to=to)

Export Transactions

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'


# Export Transactions

response = paystack.Transaction.download(
)

pprint(response)

Parameters

Name Type Description Notes
per_page int Number of records to fetch per page [optional]
page int The section to retrieve [optional]
_from datetime The start date [optional]
to datetime The end date [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

event

Response event(id)

Get Transaction Event

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

id = 'id_example' # str | 

# Get Transaction Event

response = paystack.Transaction.event(
    id,
)

pprint(response)

Parameters

Name Type Description Notes
id str

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

fetch

Response fetch(id)

Fetch Transaction

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

id = 'id_example' # str | The ID of the transaction to fetch

# Fetch Transaction

response = paystack.Transaction.fetch(
    id,
)

pprint(response)

Parameters

Name Type Description Notes
id str The ID of the transaction to fetch

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

initialize

Response initialize(email, amount, currency=currency, reference=reference, callback_url=callback_url, plan=plan, invoice_limit=invoice_limit, metadata=metadata, channels=channels, split_code=split_code, subaccount=subaccount, transaction_charge=transaction_charge, bearer=bearer)

Initialize Transaction

Create a new transaction

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

email = 'email_example' # str | Customer's email address
amount = 56 # int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR

# Initialize Transaction

response = paystack.Transaction.initialize(
    email,
    amount,
)

pprint(response)

Parameters

Name Type Description Notes
email str Customer's email address
amount int Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
currency str The transaction currency [optional]
reference str Unique transaction reference. Only -, ., = and alphanumeric characters allowed. [optional]
callback_url str Fully qualified url, e.g. https://example.com/ . Use this to override the callback url provided on the dashboard for this transaction [optional]
plan str If transaction is to create a subscription to a predefined plan, provide plan code here. This would invalidate the value provided in amount [optional]
invoice_limit int Number of times to charge customer during subscription to plan [optional]
metadata str Stringified JSON object of custom data [optional]
channels list[str] An array of payment channels to control what channels you want to make available to the user to make a payment with [optional]
split_code str The split code of the transaction split [optional]
subaccount str The code for the subaccount that owns the payment [optional]
transaction_charge str A flat fee to charge the subaccount for a transaction. This overrides the split percentage set when the subaccount was created [optional]
bearer str The beare of the transaction charge [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded, application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list

Response list(per_page=per_page, page=page, _from=_from, to=to)

List Transactions

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'


# List Transactions

response = paystack.Transaction.list(
)

pprint(response)

Parameters

Name Type Description Notes
per_page int Number of records to fetch per page [optional]
page int The section to retrieve [optional]
_from datetime The start date [optional]
to datetime The end date [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

partial_debit

Response partial_debit(email, amount, authorization_code, currency, reference=reference, at_least=at_least)

Partial Debit

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

email = 'email_example' # str | Customer's email address
amount = 56 # int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_code = 'authorization_code_example' # str | Valid authorization code to charge
currency = 'currency_example' # str | The transaction currency

# Partial Debit

response = paystack.Transaction.partial_debit(
    email,
    amount,
    authorization_code,
    currency,
)

pprint(response)

Parameters

Name Type Description Notes
email str Customer's email address
amount int Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_code str Valid authorization code to charge
currency str The transaction currency
reference str Unique transaction reference. Only -, ., = and alphanumeric characters allowed. [optional]
at_least str Minimum amount to charge [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded, application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

session

Response session(id)

Get Transaction Session

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

id = 'id_example' # str | 

# Get Transaction Session

response = paystack.Transaction.session(
    id,
)

pprint(response)

Parameters

Name Type Description Notes
id str

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

timeline

Response timeline(id_or_reference)

Fetch Transaction Timeline

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

id_or_reference = 'id_or_reference_example' # str | 

# Fetch Transaction Timeline

response = paystack.Transaction.timeline(
    id_or_reference,
)

pprint(response)

Parameters

Name Type Description Notes
id_or_reference str

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

totals

Response totals(per_page=per_page, page=page, _from=_from, to=to)

Transaction Totals

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'


# Transaction Totals

response = paystack.Transaction.totals(
)

pprint(response)

Parameters

Name Type Description Notes
per_page int Number of records to fetch per page [optional]
page int The section to retrieve [optional]
_from datetime The start date [optional]
to datetime The end date [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

verify

Response verify(reference)

Verify Transaction

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

reference = 'reference_example' # str | The transaction reference to verify

# Verify Transaction

response = paystack.Transaction.verify(
    reference,
)

pprint(response)

Parameters

Name Type Description Notes
reference str The transaction reference to verify

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]