Pending Payments
Pending payments refer to payments that have been initiated but have not yet been processed or completed. This means that the payment has been authorized, but the funds have not yet been transferred from the payer's account to the payee's account.
List pending payments
This endpoint retrieves all pending payments associated with the user in paginated format with filtering & ordering enabled.
Request & Response
GET https://proxy.webshare.io/api/v2/payment/pending/
import requests
response = requests.get(
"https://proxy.webshare.io/api/v2/payment/pending/",
headers={"Authorization": "Token APIKEY"}
)
response.json()
The commands above return JSON structured like this:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"status": "pending",
"failure_reason": null,
"payment_method": 2,
"plan": 2,
"transaction": null,
"is_renewal": false,
"term": "monthly",
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00",
"completed_at": null
}
]
}
Get pending payment
This endpoint returns the pending payment object.
URL parameters
Attributes | Type | Description |
---|---|---|
id | integer | The ID of the pending payment to retrieve. |
Request & Response
GET https://proxy.webshare.io/api/v2/payment/pending/<ID>/
import requests
response = requests.get(
"https://proxy.webshare.io/api/v2/payment/pending/{ID}/",
headers={"Authorization": "Token APIKEY"}
)
response.json()
The commands above return JSON structured like this:
{
"id": 1,
"status": "pending",
"failure_reason": null,
"payment_method": 2,
"plan": 2,
"transaction": null,
"is_renewal": false,
"term": "monthly",
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00",
"completed_at": null
}
Process pending payment
This endpoint processes a pending payment. The status of the pending payment must be
pending
to process a payment.
A pending payment can be processed after the front-end completes the payment tasks.
Parameter | Type | Description |
---|---|---|
id | integer | The ID of the pending payment to process. |
Request & Response
POST https://proxy.webshare.io/api/v2/payment/pending/<ID>/process/
import requests
response = requests.post(
"https://proxy.webshare.io/api/v2/payment/pending/{ID}/process/",
headers={"Authorization": "Token APIKEY"}
)
response.json()
The commands above return JSON structured like this:
{
"id": 1,
"status": "processing",
"failure_reason": null,
"payment_method": 2,
"plan": 2,
"transaction": null,
"is_renewal": false,
"term": "monthly",
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00",
"completed_at": null
}
Cancel pending payment
This endpoint cancels the pending payment. The status of the pending payment must be
pending
to cancel a payment.
URL parameters
Parameters | Type | Description |
---|---|---|
id | integer | The ID of the pending payment to cancel. |
POST https://proxy.webshare.io/api/v2/payment/pending/<ID>/cancel/
Request & Response
import requests
response = requests.post(
"https://proxy.webshare.io/api/v2/payment/pending/<ID>/cancel/",
headers={"Authorization": "Token APIKEY"}
)
response.json()
The commands above return JSON structured like this:
{
"id": 1,
"status": "failed",
"failure_reason": "Cancelled by the user.",
"payment_method": 2,
"plan": 2,
"transaction": null,
"is_renewal": false,
"term": "monthly",
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00",
"completed_at": null
}