1. Getting Started¶
If you’re new to Moncashify you can get started by following the tutorial Implement Moncashify SDK In Your Python Projects.
Once the package is installed, it is easy to import the package into your project.
import moncashify
Use the API()
method to initialize the process.
moncashify.API(client_id, secret_key, debug)
client_id
and secret_key
can be found in your Moncash administration. The debugging setting (debug
) will define whether you are in production or not. The default is True
, which means you are in development.
moncash = moncashify.API(client_id, secret_key, debug=True)
1.1. Make a payment¶
To receive payment from a customer, you must have the unique identifier for the order and the amount to be invoiced.
moncash = moncashify.API(client_id, secret_key)
payment = moncash.payment(unique_order_id, amount_of_money)
The unique identifier is up to you, make sure you never send duplicate IDs to the API, to avoid duplicates. The returned value is an object with the following attribute: redirect_url
. This attribute is the generated URL that your customer will use to pay for the order.
Use instance.get_response()
to have all the details related to the transaction request whether it’s successful or not.
Use instance.get_redirect_url()
to have the payment url.
1.2. Retrieve transaction details¶
To retrieve the details of a successful transaction, this process can be done with the order_id
provided by you or the transaction_id
generated by the MonCash API itself.
moncash = moncashify.API(client_id, secret_key)
moncash.transaction_details(order_id_or_transaction_id=order_id_or_transaction_id)
If you use transaction_details
method, you will need to provide the parameter key order_id
or transaction_id
and its value.
1.2.1. Using order_id
¶
To get the transaction details with the order_id
, call the method transaction_details_by_order_id()
with the order_id
as parameter.
1.2.2. Using transaction_id
¶
To get the transaction details with the transaction_id
, call the method transaction_details_by_transaction_id()
with the transaction_id
as parameter.
1.3. Change credentials¶
There is no need to re-instantiate a moncashify object to define a new client_id
or secret_key
. The set_credentials(client_id, secret_key)
method will replace the old credentials with the new ones provided as parameters.
1 2 3 4 5 6 7 | moncash = moncashify.API(‘A12’,’POAK32’)
print(moncash)
# Moncashify Object - Client ID A12
moncash.set_credentials(‘0012’,’HAITI3923’)
print(moncash)
# Moncashify Object - Client ID 0012
|