Managing payment methods
Get payment method
Returns details about the payment method associated with the specified
subscriptionUuid
tip
This is a good way to get the last four digits of the user's card.
- Node SDK
- Fetch
- cURL
import { initSalable } from '@salable/node-sdk';
const salable = initSalable('your-salable-api-key', 'v3');
const currentPaymentMethod = await salable.subscriptions.getPaymentMethod('your-subscription-uuid');
const response = await fetch(
'https://api.salable.app/subscriptions/your-subscription-uuid/payment-method',
{
headers: {
version: 'v3',
'x-api-key': 'your-salable-api-key',
},
}
);
curl
-XGET
-H 'x-api-key: your-salable-api-key'
-H 'version: v3'
'https://api.salable.app/subscriptions/your-subscription-uuid/payment-method'
Get an "update payment method" link
This will return a link to a Stripe portal where the customer can update their payment method.
tip
Useful if a customer's card is about to expire.
- Node SDK
- Fetch
- cURL
import { initSalable } from '@salable/node-sdk';
const salable = initSalable('your-salable-api-key', 'v3');
const updatePaymentLink = await salable.subscriptions.getUpdatePaymentLink('your-subscription-uuid');
const response = await fetch(
'https://api.salable.app/subscriptions/your-subscription-uuid/updatepaymentlink',
{
headers: {
version: 'v3',
'x-api-key': 'your-salable-api-key',
},
}
);
curl
-XGET
-H 'x-api-key: your-salable-api-key'
-H 'version: v3'
'https://api.salable.app/subscriptions/your-subscription-uuid/updatepaymentlink'