Payment Methods
List payment methods
This endpoint retrieves all payment methods associated with the user in paginated format with filtering & ordering enabled.
Request & Response
GET https://proxy.webshare.io/api/v2/payment/card/
list_payment_methods.py
import requests
response = requests.get(
"https://proxy.webshare.io/api/v2/payment/card/",
headers={"Authorization": "Token APIKEY"}
)
response.json()
The commands above return JSON structured like this:
response.json
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"brand": "visa",
"last4": "4242",
"name": null,
"expiration_year": 2023,
"expiration_month": 6,
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00"
}
]
}
Get payment method
This endpoint retrieves the payment method by ID. You can find the active payment method id from the subscription object.
URL parameters
Parameter | Type | Description |
---|---|---|
id | integer | The ID of the payment method to retrieve |
Request & Response
GET https://proxy.webshare.io/api/v2/payment/card/1/
get_payment_methods.py
import requests
response = requests.get(
"https://proxy.webshare.io/api/v2/payment/card/1/",
headers={"Authorization": "Token APIKEY"}
)
response.json()
The commands above return JSON structured like this:
response.json
{
"id": 1,
"brand": "visa",
"last4": "4242",
"name": null,
"expiration_year": 2023,
"expiration_month": 6,
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00"
}
Cancel pending payment
This endpoint cancels the pending payment. The status of the pending payment must be
pending
to cancel a payment.
URL parameters
Attributes | Type | Description |
---|---|---|
id | integer | The ID of the pending payment to cancel |
Request & Response
POST https://proxy.webshare.io/api/v2/payment/pending/<ID>/cancel/
cancel_payments.py
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:
response.json
{
"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
}