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/method/import requests
response = requests.get(
"https://proxy.webshare.io/api/v2/payment/method/",
headers={"Authorization": "Token APIKEY"}
)
response.json()The commands above return JSON structured like this:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"type": "StripeCard",
"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",
"line": "123 George Street",
"city": "Sydney",
"state": null,
"postal_code": "2000",
"country": "AU"
}
]
}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/method/1/import requests
response = requests.get(
"https://proxy.webshare.io/api/v2/payment/method/1/",
headers={"Authorization": "Token APIKEY"}
)
response.json()The commands above return JSON structured like this:
{
"id": 1,
"type": "StripeCard",
"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",
"line": "123 George Street",
"city": "Sydney",
"state": null,
"postal_code": "2000",
"country": "AU"
}Remove payment method
Remove the card currently saved on the subscription. The endpoint takes no ID: it always
removes the card attached to the subscription, and DELETE on a specific payment method
is not supported. If no card is saved, the request succeeds and nothing changes.
Request & Response
DELETE https://proxy.webshare.io/api/v2/payment/method/import requests
response = requests.delete(
"https://proxy.webshare.io/api/v2/payment/method/",
headers={"Authorization": "Token APIKEY"}
)Returns 204 No Content on success with an empty body.
Error responses
When the card cannot be removed, the endpoint returns a validation error of the form
[{"message": "<message>", "code": "<error code>"}].
| Error code | HTTP code | Description |
|---|---|---|
paid_plan_active | 400 | The subscription has a paid plan: |