You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So you are a developer and will start accepting payments with moncash. The PG Rewards Payments SDK is the easiest way to complete the integration in record time. With the PG Rewards Payment SDK, you can create a payment process through moncash to meet the unique needs of your projects.
before we start the integration make sure you have:
9
+
10
+
-[Registered](https://devtopup.pgecom.com) for a PG Rewards developer Account
11
+
- Navigate to Settings > Developer Setting
12
+
- Click on Generate New Credentials to get new credentials
13
+
14
+
### Install pip package
15
+
16
+
```sh
17
+
$ pip install pgrwpy
18
+
```
19
+
20
+
## Getting Started
21
+
22
+
You need to setup your key and secret using the following:
23
+
24
+
To work in production mode you need to specify your production userID & secretKey along with a production_mode True boolean flag
25
+
26
+
```py
27
+
import pgrwpy
28
+
29
+
client = pgrwpy.Client(auth=(userID, secretKey),
30
+
production_mode=True)
31
+
```
32
+
33
+
or
34
+
35
+
To work in sandbox mode you need to specify your sandbox userID & secretKey keys along with a False boolean flag or you could just omit the production_mode flag since it defaults to False if not specified
After setting up the client instance you can get the current pgrwpy SDK version using the following:
45
+
46
+
```py
47
+
print(client.get_version())
48
+
```
49
+
50
+
### Create a paymet with Mon Cash
51
+
52
+
In order to receive payments using this flow, first of all you will need to create a Moncash payment. Following are the important parameters that you can provide for this method:
| amount | Yes | number | Amount in Haitian Currency (gourdes) |
57
+
| referenceId | Yes | string | Your internal reference ID into your own system for tracking purposes |
58
+
| successUrl | Yes | string | Send the user back once the transaction is successfully complete |
59
+
| errorUrl | Yes | string | Send the user back if there is an error with the transaction |
60
+
61
+
For details of all the request and response parameters , check our [PG API Documentation guide](https://docs.pgecom.com/api-endpoint/mon-cash/mon-cash-schema)
62
+
63
+
```py
64
+
data = {
65
+
"amount": 500,
66
+
"referenceId": "12345test",
67
+
"successUrl": "https://example.com",
68
+
"errorUrl": "https://example.com"
69
+
}
70
+
71
+
client.Payment.moncash(data)
72
+
```
73
+
74
+
Did you get a **HTTP 201** response, if yes then you are all set for the next step.
75
+
76
+
<hr>
77
+
78
+
### Get Payment Details
79
+
80
+
Now that you have created a payment, the next step is to implement polling to get Payment Details. We recommend a 4-5 second interval between requests. Following are the important parameters that you can provide for this method:
| orderId | Yes | string | Your internal reference ID into your own system for tracking purposes |
85
+
86
+
### Fetch a particular Moncash payment details
87
+
88
+
```py
89
+
client.Payment.get_payment_details("<orderId>")
90
+
```
91
+
92
+
For details of all the request and response parameters , check our [PG API Documentation guide](https://docs.pgecom.com/api-endpoint/mon-cash/retrieve-an-order-id)
93
+
On successful payment, the status in the response will change to **COMPLETED**
94
+
In case of a pending for Payment, the status in the response will change to **PENDING**
0 commit comments