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

MethodHTTP requestDescription
charge_authorizationPOST /transaction/charge_authorizationCharge Authorization
check_authorizationPOST /transaction/check_authorizationCheck Authorization
downloadGET /transaction/exportExport Transactions
eventGET /transaction/{id}/eventGet Transaction Event
fetchGET /transaction/{id}Fetch Transaction
initializePOST /transaction/initializeInitialize Transaction
listGET /transactionList Transactions
partial_debitPOST /transaction/partial_debitPartial Debit
sessionGET /transaction/{id}/sessionGet Transaction Session
timelineGET /transaction/timeline/{id_or_reference}Fetch Transaction Timeline
totalsGET /transaction/totalsTransaction Totals
verifyGET /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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'email='email_example'# str | Customer's email addressamount=56# int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZARauthorization_code='authorization_code_example'# str | Valid authorization code to charge# Charge Authorizationresponse=paystack.Transaction.charge_authorization(
email,
amount,
authorization_code,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
emailstrCustomer's email address
amountintAmount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_codestrValid authorization code to charge
referencestrUnique transaction reference. Only -, ., = and alphanumeric characters allowed.[optional]
currencystrThe transaction currency[optional]
metadatastrStringified JSON object of custom data[optional]
split_codestrThe split code of the transaction split[optional]
subaccountstrThe code for the subaccount that owns the payment[optional]
transaction_chargestrA flat fee to charge the subaccount for a transaction. This overrides the split percentage set when the subaccount was created[optional]
bearerstrThe beare of the transaction charge[optional]
queueboolIf 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 codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'email='email_example'# str | Customer's email addressamount=56# int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR# Check Authorizationresponse=paystack.Transaction.check_authorization(
email,
amount,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
emailstrCustomer's email address
amountintAmount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_codestrValid authorization code to charge[optional]
currencystrThe 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 codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'# Export Transactionsresponse=paystack.Transaction.download(
)
pprint(response)

Parameters

NameTypeDescriptionNotes
per_pageintNumber of records to fetch per page[optional]
pageintThe section to retrieve[optional]
_fromdatetimeThe start date[optional]
todatetimeThe end date[optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
404Entity not found-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'id='id_example'# str | # Get Transaction Eventresponse=paystack.Transaction.event(
id,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
idstr

Return type

Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
404Entity not found-
0Server 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):
importpaystackfrompprintimportpprint# 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 Transactionresponse=paystack.Transaction.fetch(
id,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
idstrThe 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 codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
404Entity not found-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'email='email_example'# str | Customer's email addressamount=56# int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR# Initialize Transactionresponse=paystack.Transaction.initialize(
email,
amount,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
emailstrCustomer's email address
amountintAmount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
currencystrThe transaction currency[optional]
referencestrUnique transaction reference. Only -, ., = and alphanumeric characters allowed.[optional]
callback_urlstrFully qualified url, e.g. https://example.com/ . Use this to override the callback url provided on the dashboard for this transaction[optional]
planstrIf transaction is to create a subscription to a predefined plan, provide plan code here. This would invalidate the value provided in amount[optional]
invoice_limitintNumber of times to charge customer during subscription to plan[optional]
metadatastrStringified JSON object of custom data[optional]
channelslist[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_codestrThe split code of the transaction split[optional]
subaccountstrThe code for the subaccount that owns the payment[optional]
transaction_chargestrA flat fee to charge the subaccount for a transaction. This overrides the split percentage set when the subaccount was created[optional]
bearerstrThe 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 codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'# List Transactionsresponse=paystack.Transaction.list(
)
pprint(response)

Parameters

NameTypeDescriptionNotes
per_pageintNumber of records to fetch per page[optional]
pageintThe section to retrieve[optional]
_fromdatetimeThe start date[optional]
todatetimeThe end date[optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
404Entity not found-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'email='email_example'# str | Customer's email addressamount=56# int | Amount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZARauthorization_code='authorization_code_example'# str | Valid authorization code to chargecurrency='currency_example'# str | The transaction currency# Partial Debitresponse=paystack.Transaction.partial_debit(
email,
amount,
authorization_code,
currency,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
emailstrCustomer's email address
amountintAmount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
authorization_codestrValid authorization code to charge
currencystrThe transaction currency
referencestrUnique transaction reference. Only -, ., = and alphanumeric characters allowed.[optional]
at_leaststrMinimum 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 codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'id='id_example'# str | # Get Transaction Sessionresponse=paystack.Transaction.session(
id,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
idstr

Return type

Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
404Entity not found-
0Server 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):
importpaystackfrompprintimportpprint# 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 Timelineresponse=paystack.Transaction.timeline(
id_or_reference,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
id_or_referencestr

Return type

Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
404Entity not found-
0Server 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):
importpaystackfrompprintimportpprint# Set your API key based on domain (test or live mode)paystack.api_key='sk_domain_xxxxxxxx'# Transaction Totalsresponse=paystack.Transaction.totals(
)
pprint(response)

Parameters

NameTypeDescriptionNotes
per_pageintNumber of records to fetch per page[optional]
pageintThe section to retrieve[optional]
_fromdatetimeThe start date[optional]
todatetimeThe end date[optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Request successful-
401Unauthorized operation-
404Entity not found-
0Server 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):
importpaystackfrompprintimportpprint# 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 Transactionresponse=paystack.Transaction.verify(
reference,
)
pprint(response)

Parameters

NameTypeDescriptionNotes
referencestrThe transaction reference to verify

Return type

Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

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

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