Payment method endpoints
GET
List payment methods
GET
List payment methodshttps://submarine.discolabs.com/api/v1/customers/{{ customer_id }}/payment_methods.json
Fetch a list of the current customer's active payment methods.
Parameter | Name | Required | Type | Description |
---|---|---|---|---|
Path | customer_id | Yes | integer | ID of the currently logged in customer. |
Response:
{
"data": [
{
"id": "75199384",
"type": "customer_payment_method",
"attributes": {
"status": "active",
"payment_data": {
"brand": "Visa",
"last4": "4242",
"exp_year": 2022,
"exp_month": 1,
"processor": "stripe"
},
"payment_method_type": "credit-card",
"authorized_payment_method_id": 825022
}
},
{
"id": "75199212",
"type": "customer_payment_method",
"attributes": {
"status": "active",
"payment_data": {
"email": "[email protected]",
"processor": "braintree"
},
"payment_method_type": "paypal",
"authorized_payment_method_id": 221099
}
}
]
}
Successfully retrieved a list of payment methods.
POST
Create new payment method
POST
Create new payment methodhttps://submarine.discolabs.com/api/v1/customers/{{ customer_id }}/payment_methods.json
Create a new payment method for the current customer. Body parameters should be passed as a JSON object wrapped in a payment_method
namespace.
Parameter | Name | Required | Type | Description |
---|---|---|---|---|
Path | customer_id | Yes | integer | ID of the currently logged in customer. |
Body | payment_token | Yes | string | A payment token retrieved from a payment processor's JS SDK. |
Body | payment_method_type | Yes | string | The type of payment method. One of credit-card , paypal or sepa . |
Body | payment_processor | Yes | string | The payment processor. Either stripe or braintree . |
Body | status | Yes | string | Status of the new method. Should be active . |
Response:
{
"data": {
"id": "5208432",
"type": "customer_payment_method",
"attributes": {
"status": "active",
"payment_data": {
"brand": "Visa",
"last4": "4242",
"exp_month": 1,
"exp_year": 2022,
"processor": "stripe"
},
"payment_method_type": "credit-card",
"authorized_payment_method_id": 9012424
}
}
}
DELETE
Remove existing payment method
DELETE
Remove existing payment methodhttps://submarine.discolabs.com/api/v1/customers/{{ customer_id }}/payment_methods/{{ id }}.json
Remove (disable) an existing payment method belonging to the current customer.
Parameter | Name | Required | Type | Description |
---|---|---|---|---|
Path | customer_id | Yes | integer | ID of the currently logged in customer. |
Path | id | Yes | integer | ID of the currently logged in customer. |
Response:
{
"data": {
"id": "5208432",
"type": "customer_payment_method",
"attributes": {
"status": "disabled",
"payment_data": {
"brand": "Visa",
"last4": "1111",
"exp_year": 2020,
"exp_month": 1,
"processor": "stripe"
},
"payment_method_type": "credit-card",
"authorized_payment_method_id": 9012424
}
}
}
Updated about 3 years ago