SavedPaymentMethodClient#listSavedPaymentMethods(owningUserType, owningUserId, options);
Customers may wish to store payment methods within the system. The following operations allow you to read, update, and delete customer payment methods.
Note
|
To operate on the customer’s saved payment methods, the customer must be authenticated and their access token must be provided to the function call. |
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide the type of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
|
✅ |
Provide the id of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
❌ |
Options passed to the HTTP request call to customize the request configuration. Including paging related options. |
This function returns a list of SavedPaymentMethodSummaries.
SavedPaymentMethodClient#getSavedPaymentMethod(owningUserType, owningUserId, savedPaymentMethodId, options);
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide the type of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
|
✅ |
Provide the id of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
|
✅ |
Provide the saved payment method id to retrieve. |
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a SavedPaymentMethodSummary.
Parameter | Type | Required? | Description |
---|---|---|---|
|
✅ |
Provide the saved payment method data to add. |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a SavedPaymentMethodSummary.
const createRequest: CreateSavedPaymentMethodRequest = {
id: '123',
name: 'VISA',
defaultForOwner: false,
owningUserType: 'BLC_CUSTOMER',
owningUserId: 'MOCK_CUSTOMER',
type: 'CREDIT_CARD',
gatewayType: 'PASSTHROUGH',
visibleToChildren: 'NO',
billingAddress: {
addressLine1: '123 Street Drive',
city: 'Dallas',
fullName: 'Customer',
postalCode: '12345',
stateProvinceRegion: 'TX',
country: 'US'
},
displayAttributes: {
nameOnAccount: 'Test Test',
expirationMonth: '1',
expirationYear: '2023'
}
};
const savedPayment = await savedPaymentMethodClient.addSavedPaymentMethod(
createRequest,
{ accessToken }
);
console.log(savedPayment);
SavedPaymentMethodClient#updateSavedPaymentMethod(owningUserType, owningUserId, updateSavedPaymentMethodRequest, options);
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide the type of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
|
✅ |
Provide the id of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
✅ |
Provide the saved payment method data to update. |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a SavedPaymentMethodSummary.
const updateRequest: UpdateSavedPaymentMethodRequest = {
savedPaymentMethodId: '123',
name: 'VISA',
defaultForOwner: false,
type: 'CREDIT_CARD',
gatewayType: 'PASSTHROUGH',
visibleToChildren: 'NO',
billingAddress: {
addressLine1: '123 Street Drive',
city: 'Dallas',
fullName: 'Customer',
postalCode: '12345',
stateProvinceRegion: 'TX',
country: 'US'
},
displayAttributes: {
nameOnAccount: 'Test Test',
expirationMonth: '1',
expirationYear: '2023'
},
version: 0
};
const savedPayment = await savedPaymentMethodClient.updateSavedPaymentMethod(
'BLC_CUSTOMER'
'CUSTOMER_ID',
updateRequest,
{
accessToken,
version: 0
}
);
console.log(savedPayment);
SavedPaymentMethodClient#deleteSavedPaymentMethod(owningUserType, owningUserId, savedPaymentMethodId, options);
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
Provide the type of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
|
✅ |
Provide the id of the owning user that owns the saved payment methods you want to fetch. i.e. |
|
|
✅ |
Provide the customer saved payment method id to delete. |
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |