Payment Source
Methods for creating and updating a user's saved payment sources, such as credit cards.
Deprecation Notice: These methods are considered legacy and will be removed in a future version. For new integrations and to support various payment instruments, please use the
Payment Methods
.
create
Creates a new user payment source using a stripe card token. emits the PelcroSourceCreated
DOM events when the response is returned successfully.
Example
window.Pelcro.source.create(
{
auth_token: window.Pelcro.user.read().auth_token,
token: "stripe_token"
},
(error, response) => {
if (error) {
return console.log("error", error.message);
}
const createdSource = response.data.sources[response.data.sources.length - 1];
console.log(createdSource);
}
)
Parameters
Parameter | Type |
---|---|
auth_token | string |
token | string |
update
Updates a stripe payment card expiry date. emits the PelcroSourceUpdated
DOM events when the response is returned successfully.
Example
window.Pelcro.source.update(
{
auth_token: window.Pelcro.user.read().auth_token,
source_id: 1234,
cc_exp: "01/25"
},
(error, response) => {
if (error) {
return console.log("error", error.message);
}
const userPaymentSources = response.data.sources;
console.log(userPaymentSources);
}
)
Parameters
Parameter | Type |
---|---|
auth_token | string |
source_id | number |
cc_exp | string
|
Updated about 16 hours ago