PelcroPaymentMethodCreated
Fired when a payment method is added
Overview
Fired when a new payment method is successfully added to the user's account.
Triggered By
| Method | Description |
|---|---|
Pelcro.paymentMethods.create() | Adding a new payment method |
Event Detail
The event.detail object contains the created payment method:
| Property | Type | Description |
|---|---|---|
id | number | Payment method ID |
type | string | Payment method type |
card | object | Card details (if card payment) |
card.brand | string | Card brand (visa, mastercard, etc.) |
card.last4 | string | Last 4 digits of card |
card.exp_month | number | Expiration month |
card.exp_year | number | Expiration year |
Example
document.addEventListener('PelcroPaymentMethodCreated', (event) => {
const paymentMethod = event.detail;
console.log(`Payment method added: ${paymentMethod.card.brand} ending in ${paymentMethod.card.last4}`);
showMessage('Payment method saved successfully');
// Track payment method addition
analytics.track('Payment Method Added', {
type: paymentMethod.type,
brand: paymentMethod.card?.brand
});
});Related
- Events Overview - All available events
- PelcroPaymentMethodUpdated - Update event
- PelcroPaymentMethodDeleted - Deletion event
Updated 1 day ago
