/admin/addresses/:id/payment_methods
Path: /admin/addresses/:id/payment_methods
Namespace: admin
Parent Resource: addresses
Overview
Payment methods represent payment options configured for an address. Each payment method contains payment type, account details, and configuration.
Available Operations
List Payment Methods (GET)
Endpoint: GET /admin/addresses/:id/payment_methods.json
Description: Retrieve all payment methods for a specific address.
Request Example:
GET /admin/addresses/123/payment_methods.jsonResponse (200 OK):
{
"payment_methods": [
{
"id": 1,
"address_id": 123,
"payment_type": "bank_transfer",
"account_number": "1234567890",
"bank_name": "Example Bank"
}
]
}Show Payment Method (GET /:id)
Endpoint: GET /admin/addresses/:id/payment_methods/:id.json
Description: Retrieve a specific payment method.
Request Example:
GET /admin/addresses/123/payment_methods/1.jsonResponse (200 OK):
{
"payment_method": {
"id": 1,
"address_id": 123,
"payment_type": "bank_transfer",
"account_number": "1234567890"
}
}Create Payment Method (POST)
Endpoint: POST /admin/addresses/:id/payment_methods.json
Description: Create a new payment method for an address.
Request Example:
POST /admin/addresses/123/payment_methods.json
Content-Type: application/json
{
"payment_method": {
"payment_type": "credit_card",
"account_number": "4111111111111111",
"expiry_date": "12/25"
}
}Response (201 Created):
{
"payment_method": {
"id": 2,
"address_id": 123,
"payment_type": "credit_card"
}
}Update Payment Method (PATCH /:id)
Endpoint: PATCH /admin/addresses/:id/payment_methods/:id.json
Description: Update an existing payment method.
Request Example:
PATCH /admin/addresses/123/payment_methods/1.json
Content-Type: application/json
{
"payment_method": {
"account_number": "9876543210"
}
}Response (200 OK):
{
"payment_method": {
"id": 1,
"account_number": "9876543210"
}
}Delete Payment Method (DELETE /:id)
Endpoint: DELETE /admin/addresses/:id/payment_methods/:id.json
Description: Delete a payment method.
Request Example:
DELETE /admin/addresses/123/payment_methods/1.jsonResponse (204 No Content)
Batch Actions (POST /batch_action)
Endpoint: POST /admin/addresses/:id/payment_methods/batch_action.json
Description: Perform batch operations on selected payment methods.
Request Example:
POST /admin/addresses/123/payment_methods/batch_action.json
Content-Type: application/json
{
"batch_action": "update",
"collection_selection": [1, 2, 3],
"batch_action_inputs": {
"payment_type": "bank_transfer"
}
}Response (200 OK):
{
"message": "Batch action completed",
"affected_count": 3
}Related Documentation
- Address Resource - Parent address resource